I'm trying to generate a figure for a physics textbook to show examples of the vector addition of dipole moments in small molecules. For this purpose, I would like to render pictures of a bunch of small molecules, such as CS2, formaldehyde, benzene, SF6, and chloroform. I've got avogadro running on my linux box, but I'm finding it very time-consuming and confusing to construct the molecules using the GUI. Is there anywhere that I could find pre-made CML files for small molecules like these?
DSVA's comment pointed me to a database that contains the information I need. The wikipedia articles contain links to an app called jsmol, but that app appears to be getting its data from a database called ChEBI. You can search the database using search terms such as "formaldehyde" or "sf6." The entry for each molecule contains a link to a .mol file, which avogadro can read.
Wikipedia includes many entries about chemicals, and often, the property box right on top of the page (left, or right, depends on your script) include the condensed structure representation as a SMILES string:
(credit, the Arabic entry about toluene)
With above mentioned freely available, open source structure explorer which you may run without installation from a web browser (further description, e.g., in J Cheminform 7, 10 (2015)) you may query all of these entries by a (sub)structure search, a keyword, or a combination of both to access the English article and find the Wikipedia page on the right hand pane:
(screen photo of the explorer)
As by today, the public index contains 18484 entries.
With the help of OpenBabel, you may convert the SMILES string into the CML format (the the documentation presents many additional input/output formats, too). After installation of OpenBabel, the program may used from the CLI /
cmd.exe, or from a GUI. Then, you have at least two options:
a) You save the SMILES string from wikipedia in as file, for example
toluene.smi. If you opt for a conversion from the CLI, the command
obabel -ismi toluene.smi -ocml -O toluene.cml
writes the new file
b) You paste the SMILES string into the command on the CLI when writing
obabel -:CC1=CC=CC=C1 -ocml -O toluene.cml
to generate the
.cmlfile right in the current working directory. (No, do not set a space between the colon and the SMILES string.)
The documentation lists many more examples and showcases the use of the GUI. OpenBabel may work on multiple input files at once (e.g.,
obabel *.xyz -opdb -mto convert all
.xyzof a folder into
.pdb) and interacts well with other programming languages, too (introduction).
If you have Microsoft Word installed on a Windows machine you can use our open source Add In called Chem4Word to search the ChEBI database and import structures. Once imported they can be optionally edited, then exported as CML.
You can find Chem4Word here https://www.chem4word.co.uk/download