The truth is rarely pure and never simple

Visualization of charges on chemical structures

Sometimes chemical structures are not enough to present your data. Instead of adding tables, you can graphically annotate compounds. For example the results of a charge fitting procedure (hence the decimal values for electron charges) can be visualized as follows
C3O-MP2-charge

Here is how to do it:

  1. Download the indigo toolkit and its python bindings. You will need at least version 1.1, so for now the packaged version of debian stable is not enough. indigo will be responsible for rendering the structure. However, this toolkit is capable of many other tasks, as well. Having a look at the documentation is worth your time.
  2. Use openbabel (or something similar) to create a structure in SDF file format.
  3. Make sure that you have matplotlib installed.
  4. Call the following python script with three arguments on the command line: The SDF file, the annotation file and a PNG output file. The annotation file should consist of three columns: atom id, atom type and annotated value (i.e. charge).

Example

Download these files: SDF and annotation file. Now you can call the python script with

n_visualize.py C3O-MP2-opt.sdf C3O-MP2.charge C3O-MP2-charge.png

and you will get the image shown above.

Leave a comment

Your email address will not be published.