Recently I learned that in Mathematica it is possible to create chemical structures here: Chemical formulas with Mathematica

I am having a problem with a structure called "Sucrose benzoate" (here's the reference: https://www.sigmaaldrich.com/catalog/product/aldrich/458333?lang=en&region=US). Since the simple MoleculePlot@Molecule["Sucrose benzoate"] doesn't work, I am trying the following:

(*Sucrose benzoate*)

which gives (with no red circle):

enter image description here

The problem is that there are two rings colliding with each other (as shown with the red circle). How can I fix that so that they look separated (at least not colliding)?.


1 Answer 1


Mathematica uses a number of libraries for generating 2D structure diagram coordinates. The automatic method produces a suboptimal result for this molecule. Probably the system should try to check for overlapping bonds after getting coordinates and try another method, but it doesn't do this right now.

There is an undocumented method to specify which library to use when generating coordinates:

m = Molecule @ "O=C(OC[C@H]1O[C@H](O[C@]3(COC(=O)c2ccccc2)O[C@H](COC(=O)c4ccccc4)[C@@H](OC(=O)c5ccccc5)[C@@H]3OC(=O)c6ccccc6)[C@H](OC(=O)c7ccccc7)[C@@H](OC(=O)c8ccccc8)[C@@H]1OC(=O)c9ccccc9)c%10ccccc%10";
Map[MoleculePlot[m, AtomDiagramCoordinates -> #, PlotLabel -> #] &,
    {Automatic, "CoordGen", "OpenBabel", "Avalon", "PubChem"}

enter image description here

Be aware that the "PubChem" method requires an internet connection, and can hang if the service is unavailable. All the usual caveats about undocumented features apply here. The above works in version 12.2, in version 12.1 the "Avalon" method is not available but the others work. This syntax is not available in version 12.0

In a future release, these should be available as documented options, possibly using different syntax.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.