"babel ... -o svg -xC" - Hide Terminal C in SVG

Q

How to hide those C symbols for terminal carbon atoms in SVG with the "babel" command?

✍: FYIcenter.com

A

If you want to hide those C symbols for terminal carbon atoms in SVG format, you can use the "-o svg -xC" option with the "babel" command.

Here is how the "-xC" option is described in Open Babel help documebnt: "C - do not draw terminal C (and attached H) explicitly The default is to draw all hetero atoms and terminal C explicitly, together with their attched hydrogens."

For example, the following command generate a SVG picture without C symbols for terminal carbon atoms for the aspirin molecule:

fyicenter$ obabel "-:O=C(Oc1ccccc1C(=O)O)C" -O aspirin-no-carbon.svg --gen2D -xC

1 molecule converted

As a comparison, running the following command generates a SVG picture with C symbols for terminal carbon atoms for the same molecule:

fyicenter$ obabel "-:O=C(Oc1ccccc1C(=O)O)C" -O aspirin.svg --gen2D

1 molecule converted

Open both output files, aspirin.svg and aspirin-no-carbon.svg, in a Web browser, you see the differences:

Aspirin Molecule without and with Carbon Symbols
Aspirin Molecule without and with Carbon Symbols

 

"babel ... -o svg" - Two "svg" Tag Levels

"babel ... -o svg -xX" - Hide Implicit H in SVG

"babel ... -o svg" - Generating SVG Pictures

⇑⇑ Open Babel Tutorials

2020-07-22, 264👍, 0💬