1

I would like to display some bond lengths, bond angles, and torsion angles of a molecule with MoleculePlot3D.

For the example

mol = Molecule["hydrogenperoxide"];

I would like to obtain something like the following figures:

enter image description here

enter image description here

enter image description here

TobiR
  • 254
  • 1
  • 6
  • 1
    You can use Show[MoleculePlot3D[mol], Graphics3D[{Text[<your text>, <coordinates>]}]]. You just need to compute the coordinates you want to place the text at. – Jason B. Nov 05 '21 at 16:17
  • @JasonB. Thank you. I have updated my question with the figures that I would like to generate. – TobiR Nov 05 '21 at 16:35
  • Which part are you struggling with? Computing the planes/lines to display or actually displaying them as Graphics3D objects? – b3m2a1 Nov 05 '21 at 18:21
  • @b3m2a1 I can calculate the distances and angles, so they can be assumed to be known. – TobiR Nov 05 '21 at 18:27
  • 2
    Then just add a InfintePlane from the normals needed for the dihedral angle {Dashed, Line[{...}]} for the bond distance line, and use this https://mathematica.stackexchange.com/questions/10957/an-efficient-circular-arc-primitive-for-graphics3d?noredirect=1&lq=1 for the arcs for the angles. Then layer on @JasonB.'s comment for the text labels and you're done – b3m2a1 Nov 05 '21 at 18:29
  • @b3m2a1 Thank you very much! I am now interested in the dashed "distance" line. I can draw this line between atomic positions P1 and P2, but I am struggling seriously with the label. My preferences about the label are as follows: (a) it should be placed ABOVE the dashed line, (b) it should be located around the CENTER of the dashed line, P1+P2, and (c) it should be PARALLEL to the dashed line even while the output figure is rotated. Is there any chance to have all the three settings? – TobiR Nov 06 '21 at 02:04
  • @TobiR that's a harder problem but that's really a label placement problem and I'm guessing has been answered somewhere on this site. You'll in effect have Text["label", Dynamic@getLabelPosition[p1, p2]] and getLabelPosition will refer to the EvaluationBox to get settings for the Graphics3D – b3m2a1 Nov 06 '21 at 03:55
  • @b3m2a1 Thanks. I tried to use Graphics3D[{Dashed, Line[{p1, p2}], {Text["szarfos", EvaluationBox -> Dynamic@getLabelPosition[p1, p2]]}}, Boxed -> False], but this command places the text in a wrong place and orientation, and does not follow the rotation of the figure. Could you please help me what the problem is? – TobiR Nov 06 '21 at 14:52
  • @b3m2a1 I have posted a separate question about this problem: https://mathematica.stackexchange.com/questions/257846/rotate-the-label-when-rotating-the-output-image-with-graphics3d. Could you please provide an answer to that? – TobiR Nov 06 '21 at 17:18

0 Answers0