Skip to content

RossVerploegh/blender-chemicals

 
 

Repository files navigation

Chemicals in Blender

Draws chemicals in Blender using common input formats (smiles, molfiles, cif files, etc.). For details, read my blog post.

Samples

####Caffeine, ball and stick

####Penicillin, ball and stick, Cycles render

####NU-100, ball and stick

####NU-100, 3D printed from Blender output

Usage

In order to locally convert files to the required format, you will need the Open Babel library and Python bindings for chemical file format parsing, which is best installed from source. For more, read through the Open Babel installation instructions.

git clone https://github.com/openbabel/openbabel
mkdir build && cd build
cmake ../openbabel -DPYTHON_BINDINGS=ON
make && make install

From here, you can convert files to Javascript Object Notation with something like

python format_converter *data* *in_format* json > molecule.json

format is any format in this list, and data is either a string or a file containing the data specified by format. From here, use blender -P molecule_to_blender.py to load the molecule.

The shell script is a light wrapper around these two commands. For example,

sh draw_molecule.sh "CC(C)(C)C1=CC2(C=C(C(C)(C)C)C1=O)CC2(c1ccccc1)c1ccccc1" smi

will convert the input data (string or file path) and load into Blender.

About

Draws chemicals in Blender using common input formats (smiles, molfiles, cif files, etc.)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.5%
  • Shell 3.5%