<commit_before>Chemicals in Blender
====================

Draws chemicals in Blender using common input formats (smiles, molfiles, cif files, etc.). For details, read my [blog post](http://www.patrick-fuller.com/molecules-from-smiles-molfiles-in-blender/).

Usage
-----

###Without dependencies

Use [this online tool](patrick-fuller.com/imolecule.html) to convert a chemical file
from any input format to Javascript Object Notation (drag input file into window,
then click "save as"). Rename it to `molecule.json`, and place it in the same
directory as these scripts. Then, load the file into Blender with

```
blender -P molecule_to_blender.py
```

Without the command line, you can copy and paste the contents of `molecule_to_blender.py` into Blender, update paths to `atomic_diameters.json`, `atomic_colors.json`, and `molecule.json`, and run.

The drawing function has the option to set a scale limit on molecules via
`max_molecule_size`. It can also generate space-filling models by setting
`show_bonds=False`.

It's a short script - don't be afraid to open it up and hack it to suit your needs.

Samples
-------

###With dependencies

In order to locally convert files to the required format, you will need the
[Open Babel](http://openbabel.org/wiki/Main_Page) library and Python bindings
for chemical file format parsing. which can be installed via apt-get/macports
(the pip repository doesn't work).

```bash
apt-get/port install openbabel-python
```

In the case of OSX + homebrew, the default installer doesn't include python
bindings. Instead, use

```bash
brew install https://raw.github.com/rwest/homebrew/open-babel-new/Library/Formula/eigen2.rb
brew install https://raw.github.com/rwest/homebrew/open-babel-new/Library/Formula/open-babel.rb
```

If you have problems, refer to the Open Babel website.

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](http://openbabel.org/docs/2.3.0/FileFormats/Overview.html), 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.
<commit_msg>Updated link to blog<commit_after>Chemicals in Blender
====================

Draws chemicals in Blender using common input formats (smiles, molfiles, cif files, etc.). For details, read my [blog post](http://www.patrick-fuller.com/molecules-from-smiles-molfiles-in-blender/).

Usage
-----

###Without dependencies

Use [this online tool](http://www.patrick-fuller.com/imolecule.html) to convert a chemical file
from any input format to Javascript Object Notation (drag input file into window,
then click "save as"). Rename it to `molecule.json`, and place it in the same
directory as these scripts. Then, load the file into Blender with

```
blender -P molecule_to_blender.py
```

Without the command line, you can copy and paste the contents of `molecule_to_blender.py` into Blender, update paths to `atomic_diameters.json`, `atomic_colors.json`, and `molecule.json`, and run.

The drawing function has the option to set a scale limit on molecules via
`max_molecule_size`. It can also generate space-filling models by setting
`show_bonds=False`.

It's a short script - don't be afraid to open it up and hack it to suit your needs.

###With dependencies

In order to locally convert files to the required format, you will need the
[Open Babel](http://openbabel.org/wiki/Main_Page) library and Python bindings
for chemical file format parsing, which can be installed via apt-get/macports
(the pip repository doesn't work).

```bash
apt-get/port install openbabel-python
```

In the case of OSX + homebrew, the default installer doesn't include python
bindings. Instead, use

```bash
brew install https://raw.github.com/rwest/homebrew/open-babel-new/Library/Formula/eigen2.rb
brew install https://raw.github.com/rwest/homebrew/open-babel-new/Library/Formula/open-babel.rb
```

If you have problems, refer to the Open Babel website.

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](http://openbabel.org/docs/2.3.0/FileFormats/Overview.html), 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.

{'fraction_non_alphanumeric': 0.10461744367610974, 'fraction_numerical': 0.0017845192951148785, 'mean_word_length': 4.647355163727959, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3329134', 'n_tokens_mistral': 1374, 'n_tokens_neox': 1282, 'n_words': 536}