7

I want to draw the molecule attached with chemfig. Could not find anything for the core of the connections. Any idea?

enter image description here

2
  • 1
    Welcome to TeX.SE! Could you please add the code that shows what you've tried? This will make it much more likely that you get a good answer very fast.
    – user121799
    Dec 31, 2018 at 17:52
  • Please see tex.stackexchange.com/questions/52722/…
    – user152057
    Dec 31, 2018 at 18:22

1 Answer 1

15

Maybe not the answer you like but I do not know an elegant way to subject chemfig pictures to 3d projection that does not either nest tikzpictures or use \saveboxes, in which case you can no longer access the nodes from outside. So I propose to draw the hexagons with elementary TikZ methods, and to use tikz-3dplot as well as the 3d library to do the projections. I acknowledge comments by andselisk, which clarified a couple of things for me which I did not know. I am not a chemist, so I do not know what a point group D_{3h} is, even though, like any marmot, I would know what a point group D_3 is. Anyway, this is an update with big thanks going to andselisk. (As requested, I add some explanations to the code. The idea is to use 3d coordinates and let TikZ do the projections. The tikz-3dplot package allows you to choose a view, defined by two angles, and the 3d library allows you to draw things in planes in 3d coordinates. So we are going to draw 3 hexagons in 3 planes which are rotated w.r.t. each other by 120 degrees. And then we are going to connect them in 3d. I added some annotations to the code.)

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{shapes.geometric,3d,calc}
\begin{document}
\tdplotsetmaincoords{70}{20} % sets the view angles, see the tik-3dplot manual for details 
\begin{tikzpicture}[tdplot_main_coords,% use the above view
hexa/.style={regular polygon, % just a hexagon shape; the corners are anchors
regular polygon sides=6,minimum size=3cm,draw}] 
\foreach \Z in {1,2,3} % \Z labels three planes
{\tdplotsetrotatedcoords{0}{\Z*120}{0}
\begin{scope}[tdplot_rotated_coords,transform shape,
canvas is yz plane at x=0] % switch to a rotated plane
  \node[hexa] (h\Z) at (0,{3*sin(60)}) {}; % draw a hexagon in the plane
  \foreach \X [evaluate=\X as \Y using {int(mod(\X+1,6))}] in {2,4,6} 
  {\draw ($(h\Z.corner \X)!0.2!(h\Z.center)$) -- 
  ($(h\Z.corner \Y)!0.2!(h\Z.center)$);} % draw thick hexagon edges
  \draw[ultra thick] (h\Z.corner 2) -- (h\Z.corner 3) -- (h\Z.corner 4);
% uncomment these out to see where the rotated coordinate axes point to
% \begin{scope}[blue]
% \draw[-latex] (0,0,0) -- (2,0,0) node[pos=1.1]{$x'$};
% \draw[-latex] (0,0,0) -- (0,2,0) node[pos=1.1]{$y'$};
% \draw[-latex] (0,0,0) -- (0,0,2) node[pos=1.1]{$z'$};
% \end{scope}
 \end{scope}
\draw (h\Z.corner 5) -- (0,{3*sin(60)/2},0); % thin connecting the 3 hexagons in the back
\path (h\Z.corner 4) -- (0,{-3*sin(60)/2},0) coordinate[midway](aux);
\draw[ultra thick] (h\Z.corner 4) -- (aux);
\draw[double distance=1.6pt,ultra thick,white,double=black] (aux) --
(0,{-3*sin(60)/2},0); % draw the thick connections to the point between the
% three hexagons in the foreground (with "gaps" around the path
}
% uncomment these out to see where the main coordinate axes point to
% \draw[-latex] (0,0,0) -- (3,0,0) node[pos=1.1]{$x$};
% \draw[-latex] (0,0,0) -- (0,3,0) node[pos=1.1]{$y$};
% \draw[-latex] (0,0,0) -- (0,0,3) node[pos=1.1]{$z$};
\end{tikzpicture}
\end{document}

enter image description here

The advantage of this is that you can change the view angle at will.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{shapes.geometric,3d,calc}
\begin{document}
\foreach \ZZ in {5,15,...,355}
{\tdplotsetmaincoords{70+20*sin(\ZZ)}{\ZZ}
\pgfmathtruncatemacro{\itest}{sign(cos(\ZZ))}
\begin{tikzpicture}[tdplot_main_coords,hexa/.style={regular polygon,regular polygon sides=6,
minimum size=3cm,draw}]
 \path[tdplot_screen_coords,use as bounding box] (-5,-5) rectangle (5,5);
 \foreach \Z in {1,2,3}
 {\tdplotsetrotatedcoords{0}{\Z*120}{0}
 \begin{scope}[tdplot_rotated_coords,transform shape,canvas is yz plane at x=0]
   \node[hexa] (h\Z) at (0,{3*sin(60)}) {};
   \foreach \X [evaluate=\X as \Y using {int(mod(\X+1,6))}] in {2,4,6}
   {\draw ($(h\Z.corner \X)!0.2!(h\Z.center)$) -- ($(h\Z.corner \Y)!0.2!(h\Z.center)$);}
   \ifnum\itest=1
    \draw[ultra thick] (h\Z.corner 2) -- (h\Z.corner 3) -- (h\Z.corner 4);
   \else
    \draw[ultra thick] (h\Z.corner 1) -- (h\Z.corner 6) -- (h\Z.corner 5);
   \fi  
  \end{scope}
  \ifnum\itest=1
   \path (h\Z.corner 4) -- (0,{-3*sin(60)/2},0) coordinate[midway](aux);
   \draw[ultra thick] (h\Z.corner 4) -- (aux);
   \draw[double distance=1.6pt,ultra thick,white,double=black] (aux) --
   (0,{-3*sin(60)/2},0);
   \draw (h\Z.corner 5) -- (0,{3*sin(60)/2},0);
  \else
   \path (h\Z.corner 5) -- (0,{3*sin(60)/2},0) coordinate[midway](aux);
   \draw[ultra thick] (h\Z.corner 5) -- (aux);
   \draw[double distance=1.6pt,ultra thick,white,double=black] (aux) --
   (0,{3*sin(60)/2},0);
   \draw (h\Z.corner 4) -- (0,{-3*sin(60)/2},0);
  \fi 
 }
\end{tikzpicture}}
\end{document}

enter image description here

I always felt that some of the Star Wars space ships were inspired by molecules. This also explains why they can produce sound waves in vacuum.;-)

8
  • 4
    That's definitely some titanic work well done and I don't really understand the magic behind it, but I'd like to point out few things: a) triptycene belongs to D3h point group, which is not evident looking at both images image (valence angles look uneven for two carbon atoms lying on C3 axis); b) "bold" line on a rotating 3D image should not be static as it's sole purpose is to denote the part of the molecule located closer to the viewer in 3D space.
    – andselisk
    Jan 1, 2019 at 2:04
  • 1
    @andselisk Thanks for you feedback. As you probably could have guessed, I am not a chemist. Such things happen if the OP does not provide an MWE. I will wait for more feedback from the OP. Apart from the things you mention, I also have no information on the 3d location of the points between the hexagons where the lines meet.
    – user121799
    Jan 1, 2019 at 2:15
  • 4
    For a non-chemist it's still a great piece of work:) And yes, an MWE would be nice. Just in case, here is a 3D model and a molecular editor to play around with to better understand the geometry/
    – andselisk
    Jan 1, 2019 at 2:28
  • 1
    @andselisk Is it better now? (I tried to guess the 3d coordinates from the nice interactive viewer under your link.)
    – user121799
    Jan 1, 2019 at 17:34
  • 1
    @MohamadMoosavi I added some explanations to the code. The tikz-3dplot package has a nice manual, shapes.geometric is documented in the pgfmanual but unfortunately AFAIK the 3d library has not yet an official manual.
    – user121799
    Jan 3, 2019 at 11:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .