[Tex/LaTex] Easy way to draw atomic orbitals and integrate them into ChemFig structures

chemfigtikz-pgf

I'm looking for a method to draw molecules as skeleton structures via chemfig and include some atomic orbitals (i.e. s, p and d orbitals and some sp-hybrid orbitals too) into them (at positions where chemfig places atomlabels, i.e. at the ends of bonds). I give you an example:

enter image description here

The shapes needed for the different orbitals essentially boil down to the following

enter image description here

The right appearence would then be achieved by rotating and scaling these orbitals. This should ideally work with a simple command which tells chemfig to insert an orbital of a certain type (i.e. s, p, d, …) at an atomic position and how this orbital shall be rotated, scaled or colored and which phase it should have. Is this doable? Or is there a package out there which provides such a functionality?

Best Answer

The chemmacros package offers s,p and sp-hybrid orbitals (based on TikZ), d orbitals are missing (for now). These are examples from the documentation:

\documentclass{article}
\usepackage{chemfig,chemmacros}

\begin{document}

 \setbondoffset{0pt}
 \chemsetup[orbital]{
   overlay ,
   opacity = .75 ,
   p/scale = 1.6 ,
   s/color = blue!50 ,
   s/scale = 1.6
 }
 \chemfig{\orbital{s}-[:-20]{\orbital[scale=2]{p}}{\orbital[half,angle=0]{p}}{\orbital[angle=170,half]{p}}{\orbital[angle=-150,half]{p}}(-[:-150]\orbital{s})-\orbital{s}}

\end{document}

enter image description here

\documentclass{article}
\usepackage{chemfig,chemmacros}

\begin{document}

 \chemsetup[orbital]{
   overlay,
   p/color = black!70
 }
 \setbondoffset{0pt}
 \chemfig{?\orbital{p}-[,1.3]{\orbital[phase=-]{p}}-[:30,1.1]\orbital{p}-[:150,.9]{\orbital[phase=-]{p}}-[4,1.3]\orbital{p}-[:-150,1.1]{\orbital[phase=-]{p}}?}

\end{document}

enter image description here