$\require{mhchem}$I would like to take the acetone $\cf{((CH3)2CO)}$ and chloroform $\cf{(HCCl_3)}$ molecules that Mathematica's chemical data provides, and plot them together. I want to show how chloroform can hydrogen bond to acetone. Right now I have them plotted on top of each other :/

Show[ChemicalData["Chloroform", "MoleculePlot"], 
 ChemicalData["Acetone", "MoleculePlot"]]

acetone and chloroform

  • $\begingroup$ ...I don't think Mathematica is the best software to use for this. Why not use a dedicated 3D chemical drawing program? $\endgroup$ Commented Apr 7, 2013 at 19:31
  • $\begingroup$ @J.M. upload.wikimedia.org/wikipedia/en/e/e6/… $\endgroup$ Commented Apr 7, 2013 at 19:40
  • $\begingroup$ If you examine the FullForm of the molecular plots, you may come up with a one-off solution. Some assembly may be required. $\endgroup$
    – DavidC
    Commented Apr 7, 2013 at 20:11
  • $\begingroup$ Are there any free 3D chemical drawing programs? $\endgroup$
    – olliepower
    Commented Apr 7, 2013 at 20:17
  • $\begingroup$ Somewhat related (for post-processing): Can a LatticeData image be displayed in a space filled fashion. $\endgroup$
    – Jens
    Commented Apr 7, 2013 at 20:24

2 Answers 2


A quick way of showing how the two structures can be positioned relative to each other in a single Graphics3D is as follows:

With[{rMax = 500},
   {First@ChemicalData["Acetone", "MoleculePlot"], 
     First@ChemicalData["Chloroform", "MoleculePlot"], 
      TranslationTransform[{displacementX, displacementY, 
       rotationAngle, {Cos[axisAzimuth] Sin[axisPolar], 
        Sin[axisAzimuth] Sin[axisPolar], Cos[axisPolar]}]]]},
   PlotRange -> {{-rMax, rMax}, {-rMax, rMax}, {-rMax, rMax}}
  {{displacementX, 0}, -rMax, rMax}, {{displacementY, 0}, -rMax, 
   rMax}, {{displacementZ, 0}, -rMax, rMax}, {rotationAngle, 0, 
   2 Pi},
  {axisPolar, 0, 2 Pi}, {axisAzimuth, 0, 2 Pi}


The Manipulate is just to let you do some manual re-positioning. You can eventually get better results by doing pre-calculated shifts and rotations based on the exact locations of the atoms. But I'm focusing here on the basic ingredients. For the display, this involves mainly the use of First to extract the contents of the Graphics3D of the molecule, then the translation and rotation using GeometricTransformation with a Composition of the former two operations.

The variable rMax sets the plot range and the maximum displacement of the chloroform molecule relative to the acetone.

  • 1
    $\begingroup$ +1 Very nice! Now this is the first step to do genetic manipulation completely inside Mma :D $\endgroup$ Commented Apr 7, 2013 at 21:05
  • $\begingroup$ wow, excellent work. This is exactly what I was looking for. $\endgroup$
    – olliepower
    Commented Apr 7, 2013 at 23:59

Here is a less impressive take on the question.

positionsA = 
   ChemicalData["Acetone", "AtomPositions"] /. {x_, y_, z_} -> {x + 400, y + 400, z + 400};
positionsC = ChemicalData["Chloroform", "AtomPositions"];
{atomsA, atomsC} = {ChemicalData["Acetone", "VertexTypes"], 
                     ChemicalData["Chloroform", "VertexTypes"]};
{colorsA, colorsC} = {Map[ColorData["Atoms", #] &, atomsA], 
                       Map[ColorData["Atoms", #] &, atomsC]};
{radiiA, radiiC} = {Map[ElementData[#, "VanDerWaalsRadius"] &, atomsA], 
                     Map[ElementData[#, "VanDerWaalsRadius"] &, atomsC]};
{molA, molC} = {Graphics3D[{Specularity[White, 40], 
                MapThread[{#1, Sphere[#2, #3]} &, {colorsA, positionsA, radiiA}]}], 
                 Graphics3D[{Specularity[White, 40], 
                MapThread[{#1, Sphere[#2, #3]} &, {colorsC, positionsC, radiiC}]}]};

Show[molA, molC, Lighting -> "Neutral"]

enter image description here


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.