2

Are there any latex packages that allow for drawing the ball and stick models of different molecules (or packages that are meant for a different purpose but can be used to draw ball and stick models). Ball and stick models such as this ones: enter image description here

I'm currently using avogadro -> exporting as svg -> inkscape svg -> pdf+latex -> insert into document. I would preferably like a tikz package.

New Question

I have found that Avogadro can export the coordinates of the atoms. I would like to know how to make the joins cylinders and add shading on the cylinders. I would also like to change the view angle and is there a more natural 3d rather than a tikz 3d view? Here is the TiKz code for the molecule I am trying to draw (not the one above)

\begin{tikzpicture}[scale=1]
\node (C1)  at         (-3.19898,        0.68575,       -0.09137) {};
\node (N1)  at         (-2.00788,       -0.15303,       -0.05472) {};
\node (H1)  at         (-3.17155,        1.39571,       -0.92422) {};
\node (H2)  at         (-3.31563,        1.23754,        0.84706) {};
\node (H3)  at         (-4.08519,        0.05549,       -0.21396) {};
\node (C2)  at         (-0.78815,        0.67831,        0.01256) {};
\node (H4)  at         (-1.95362,       -0.69266,       -0.92177) {};
\node (C3)  at         ( 0.47237,       -0.18670,        0.21998) {};
\node (H5)  at         (-0.86520,        1.39211,        0.84227) {};
\node (H6)  at         (-0.69535,        1.26040,       -0.91400) {};
\node (C4)  at         ( 1.73163,        0.67172,        0.09304) {};
\node (N2)  at         ( 0.51467,       -1.32801,       -0.73516) {};
\node (H7)  at         ( 0.46502,       -0.59296,        1.23918) {};
\node (H8)  at         ( 1.39360,       -1.82407,       -0.57104) {};
\node (H9)  at         (-0.23067,       -1.96899,       -0.46111) {};
\node (O1)  at         ( 1.80456,        1.88884,        0.13111) {};
\node (O2)  at         ( 2.86188,       -0.07112,        0.00360) {};
\node (H10) at         ( 3.57354,        0.59879,       -0.06651) {};
\shade [ball color=white] (H1) circle (0.15);
\shade [ball color=white] (H2) circle (0.15);
\shade [ball color=white] (H3) circle (0.15);
\shade [ball color=white] (H4) circle (0.15);
\shade [ball color=white] (H5) circle (0.15);
\shade [ball color=white] (H6) circle (0.15);
\shade [ball color=white] (H7) circle (0.15);
\shade [ball color=white] (H8) circle (0.15);
\shade [ball color=white] (H9) circle (0.15);
\shade [ball color=white] (H10) circle (0.15);
\shade [ball color=black!75] (C1) circle (0.25);
\shade [ball color=black!75] (C2) circle (0.25);
\shade [ball color=black!75] (C3) circle (0.25);
\shade [ball color=black!75] (C4) circle (0.25);
\shade [ball color=blue!75] (N1) circle (0.25);
\shade [ball color=blue!75] (N2) circle (0.25);
\shade [ball color=red!75] (O1) circle (0.25);
\shade [ball color=red!75] (O2) circle (0.25);
\draw (H1) -- (C1) -- (N1) -- (C2) -- (C3) -- (C4) -- (O1);
\draw (H2) -- (C1);
\draw (H3) -- (C1);
\draw (N1) -- (H4);
\draw (C2) -- (H5);
\draw (C2) -- (H6);
\draw (C3) -- (H7);
\draw (C3) -- (N2) -- (H8);
\draw (N2) -- (H9);
\draw (C4) -- (O2) -- (H10);
\end{tikzpicture}

The code above does not do cylinders as bonds but rather just lines by the \draw function. How do I make cylinders shading and change the 3d view angles?

  • 2
    Yes, this can be done with asymptote. See e.g. this answer. There are a few others. – user121799 Oct 4 '18 at 5:17
  • Hi @marmot would you know of any method to figure out the location of each atom (sphere) – sab hoque Oct 4 '18 at 13:00
  • I am sorry, I do not understand the question. You need a model/theory to tell where the atoms sit, I think. I guess that these things should be described in a chemistry or molecular physics book. Naively I'd say in your example the atoms sit on nodes of the root lattice of A_3\simeq SU(4), but that's just guesswork. – user121799 Oct 4 '18 at 15:27
  • Thanks anyways, in the end I just decided to go with tikz and use the \shade with balls. As it is a margin figure I did not bother with making the bonds cylinders with shading. – sab hoque Oct 4 '18 at 16:13
  • You can do that with TikZ (and even shade the cylinders) but you have to be very careful with order in which you draw things and also compute the intersection of the cylinders with the spheres (which is, however, straightforward in this case). However, this does not spare you from determining the coordinates of the atoms. If they are indeed, on the root lattice of A_3, maybe this may help. (Of course, you are not going to pack these things.) – user121799 Oct 4 '18 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.