2

While modiagram is bugged (LaTeX3 Error in MOdiagram package) I decide to make my own molecular orbitals diagram for iodine chloride ICl based on this. Could you suggest how to add the relative vertical energy axis of the various orbitals, and possibly add the eigenvalues as well?

\documentclass{article}
\usepackage{tikz}
\usepackage{textcomp}
\usepackage[version=3]{mhchem}

\newcommand{\moup}{\textuparrow}
\newcommand{\modown}{\textdownarrow}
\newcommand{\moupdown}{\textuparrow\textdownarrow}

\begin{document}

\begin{tikzpicture}[scale=1]
\centering
\def\sbaseline{0em};
\def\pbaseline{14em};
\def\ssplit{6em};
\def\psplit{12em};
\def\pextend{5em};
\def\psso{4em};
\def\pxyoffset{1em};
\def\mwidth{3em};
\def\hsep{2em};

\tikzstyle{split} = [densely dashed,draw=gray]
\tikzstyle{orbital} = [rectangle, rounded corners, fill=white, draw=black, minimum width=3.5ex, minimum height=3.5ex]
\tikzstyle{label}   = [rectangle, minimum width=3.5ex, node distance=3.5ex]

%1s splitting
\draw        (\mwidth/-2-\hsep*2,\sbaseline)            -- (\mwidth/-2-\hsep  ,\sbaseline);
\draw[split] (\mwidth/-2-\hsep  ,\sbaseline)            -- (\mwidth/-2        ,\sbaseline+\ssplit/2);
\draw        (\mwidth/-2        ,\sbaseline+\ssplit/2)  -- (\mwidth/2         ,\sbaseline+\ssplit/2);
\draw[split] (\mwidth/2         ,\sbaseline+\ssplit/2)  -- (\mwidth/2+\hsep   ,\sbaseline);
\draw        (\mwidth/2+\hsep   ,\sbaseline)            -- (\mwidth/+2+\hsep*2,\sbaseline);
\draw[split] (\mwidth/-2-\hsep  ,\sbaseline)            -- (\mwidth/-2        ,\sbaseline+\ssplit/-2);
\draw        (\mwidth/-2        ,\sbaseline+\ssplit/-2) -- (\mwidth/2         ,\sbaseline+\ssplit/-2);
\draw[split] (\mwidth/2         ,\sbaseline+\ssplit/-2) -- (\mwidth/2+\hsep   ,\sbaseline);

%left 1s
\draw[] (-\mwidth-\hsep,0em) node[orbital] (l1s) {\moupdown};
\node[label, below of=l1s] (l1sl) {$5s$};

%right 1s
\draw[] (\mwidth+\hsep,0em) node[orbital] (r1s) {\moupdown};
\node[label, below of=r1s] (r1sl) {$3s$};

%sigma bonding
\draw[] (0em,\ssplit/-2) node[orbital] (sb) {\moupdown};
\node[label, below of=sb]  (sbl) {$\sigma$};
\node[label, left of=sb, node distance = 9ex] {\tiny{\color{gray}{$\Psi_{a}+\Psi_{b}$}}};

%sigma antibonding
\draw[] (0em,\ssplit/2) node[orbital] (sa) {\moupdown};
\node[label, below of=sa] (sal) {$\sigma^{*}$};
\node[label, left of=sa, node distance = 9ex] {\tiny{\color{gray}{$\Psi_{a}-\Psi_{b}$}}};

%orbital labels
\node[label, below of=l1sl, node distance=6em]   (a)    {\smash[b]{\ce{I}}};
\node[label, right of=a   , node distance=\mwidth+\hsep]   (ab)   {\ce{ICl}};
\node[label, right of=a   , node distance=\mwidth*2+\hsep*2]  (b)    {\ce{Cl}};

%Title
\node[label, below of=ab  , node distance=3em]   (desc) {Cloruro di iodio ICl};

%2p splitting
\draw        (\mwidth/-2-\hsep*2-\pextend,\pbaseline)            -- (\mwidth/-2-\hsep  ,\pbaseline);
\draw[split] (\mwidth/-2-\hsep  ,\pbaseline)            -- (\mwidth/-2        ,\pbaseline+\psplit/2);
\draw        (\mwidth/-2        ,\pbaseline+\psplit/2)  -- (\mwidth/2         ,\pbaseline+\psplit/2);
\draw[split] (\mwidth/2         ,\pbaseline+\psplit/2)  -- (\mwidth/2+\hsep   ,\pbaseline);
\draw        (\mwidth/2+\hsep   ,\pbaseline)            -- (\mwidth/+2+\hsep*2+\pextend,\pbaseline);
\draw[split] (\mwidth/-2-\hsep  ,\pbaseline)            -- (\mwidth/-2        ,\pbaseline+\psplit/-2);
\draw        (\mwidth/-2        ,\pbaseline+\psplit/-2) -- (\mwidth/2         ,\pbaseline+\psplit/-2);
\draw[split] (\mwidth/2         ,\pbaseline+\psplit/-2) -- (\mwidth/2+\hsep   ,\pbaseline);

\draw[split] (\mwidth/-2-\hsep  ,\pbaseline)            -- (\mwidth/-2        ,\pbaseline-\psso+\psplit/2);
\draw        (\mwidth/-2        ,\pbaseline-\psso+\psplit/2)  -- (\mwidth/2         ,\pbaseline-\psso+\psplit/2);
\draw[split] (\mwidth/2         ,\pbaseline-\psso+\psplit/2)  -- (\mwidth/2+\hsep   ,\pbaseline);
\draw[split] (\mwidth/-2-\hsep  ,\pbaseline)            -- (\mwidth/-2        ,\pbaseline+\psso+\psplit/-2);
\draw        (\mwidth/-2        ,\pbaseline+\psso+\psplit/-2) -- (\mwidth/2         ,\pbaseline+\psso+\psplit/-2);
\draw[split] (\mwidth/2         ,\pbaseline+\psso+\psplit/-2) -- (\mwidth/2+\hsep   ,\pbaseline);

%left 2p
\draw[] (-\mwidth-\hsep,\pbaseline) node[orbital] (l2pa) {\moupdown};
\node[orbital, left of=l2pa] (l2pb) {\moup};
\node[orbital, left of=l2pb] (l2pc) {\moup};

\node[label, below of=l2pb] (l2pl) {$2p$};

%right 2p

\draw[] (\mwidth+\hsep,\pbaseline) node[orbital] (r2pa) {\moupdown};
\node[orbital, right of=r2pa] (r2pb) {\moup};
\node[orbital, right of=r2pb] (r2pc) {\moup};

\node[label, below of=r2pb] (r2pl) {$2p$};

%sigmap bonding
\draw[] (0em,\pbaseline+\psplit/-2) node[orbital] (spb) {\moupdown};
\node[label, below of=spb]  (spbl) {$\sigma$};

%sigmap antibonding
\draw[] (0em,\pbaseline+\psplit/2) node[orbital] (spab) {};
\node[label, below of=spab]  (spabl) {$\sigma^{*}$};

%pi antibonding levels
\draw[] (-\pxyoffset,\pbaseline+\psso-\psplit/2) node[orbital] (ppabx) {\moupdown};
\node[label, below of=ppabx]  (ppabxl) {$\pi_{x}$};
\draw[] (+\pxyoffset,\pbaseline+\psso-\psplit/2) node[orbital] (ppaby) {\moupdown};
\node[label, below of=ppaby]  (ppabyl) {$\pi_{y}$};

%pi antibonding levels
\draw[] (-\pxyoffset,\pbaseline-\psso+\psplit/2) node[orbital] (ppbx) {\moup};
\node[label, below of=ppbx]  (ppbxl) {$\pi^{*}_{x}$};
\draw[] (+\pxyoffset,\pbaseline-\psso+\psplit/2) node[orbital] (ppby) {\moup};
\node[label, below of=ppby]  (ppbyl) {$\pi^{*}_{y}$};

\end{tikzpicture}

\end{document}

enter image description here

Thank you in advance

8
  • At least to me it is completely unclear what you are asking. At the very least, please add the code that you are using, the link is ambiguous. – user194703 Oct 30 '19 at 18:43
  • Code added. In barely words, I need an axis placed left to the diagram with the energy values (e.g. 0.3819 elettronvolt) of the orbitals – user3204810 Oct 30 '19 at 18:47
  • I'm not a chemist and I don't understand the chemistry jargon. Can you add a freehand drawing of the desired result. – AndréC Oct 30 '19 at 18:57
  • @AndréC imgur.com/r6RHLzf – user3204810 Oct 30 '19 at 19:22
  • Please edit your question with the image. – AndréC Oct 30 '19 at 19:28
2

When a figure is built, its bounding box is updated as it is built. This bounding box is a node named current bounding box.

So I traced its left side by shifting it to the left at the very end of the code.

\draw[red,line width=3pt] ([xshift=-3mm]current bounding box.north west) -- (current bounding box.south west);

screenshot

\documentclass{article}
\usepackage{tikz}
\usepackage{textcomp}
\usepackage[version=3]{mhchem}

\newcommand{\moup}{\textuparrow}
\newcommand{\modown}{\textdownarrow}
\newcommand{\moupdown}{\textuparrow\textdownarrow}

\begin{document}

\begin{tikzpicture}[scale=1]
\centering
\def\sbaseline{0em};
\def\pbaseline{14em};
\def\ssplit{6em};
\def\psplit{12em};
\def\pextend{5em};
\def\psso{4em};
\def\pxyoffset{1em};
\def\mwidth{3em};
\def\hsep{2em};

\tikzstyle{split} = [densely dashed,draw=gray]
\tikzstyle{orbital} = [rectangle, rounded corners, fill=white, draw=black, minimum width=3.5ex, minimum height=3.5ex]
\tikzstyle{label}   = [rectangle, minimum width=3.5ex, node distance=3.5ex]

%1s splitting
\draw        (\mwidth/-2-\hsep*2,\sbaseline)            -- (\mwidth/-2-\hsep  ,\sbaseline);
\draw[split] (\mwidth/-2-\hsep  ,\sbaseline)            -- (\mwidth/-2        ,\sbaseline+\ssplit/2);
\draw        (\mwidth/-2        ,\sbaseline+\ssplit/2)  -- (\mwidth/2         ,\sbaseline+\ssplit/2);
\draw[split] (\mwidth/2         ,\sbaseline+\ssplit/2)  -- (\mwidth/2+\hsep   ,\sbaseline);
\draw        (\mwidth/2+\hsep   ,\sbaseline)            -- (\mwidth/+2+\hsep*2,\sbaseline);
\draw[split] (\mwidth/-2-\hsep  ,\sbaseline)            -- (\mwidth/-2        ,\sbaseline+\ssplit/-2);
\draw        (\mwidth/-2        ,\sbaseline+\ssplit/-2) -- (\mwidth/2         ,\sbaseline+\ssplit/-2);
\draw[split] (\mwidth/2         ,\sbaseline+\ssplit/-2) -- (\mwidth/2+\hsep   ,\sbaseline);

%left 1s
\draw[] (-\mwidth-\hsep,0em) node[orbital] (l1s) {\moupdown};
\node[label, below of=l1s] (l1sl) {$5s$};

%right 1s
\draw[] (\mwidth+\hsep,0em) node[orbital] (r1s) {\moupdown};
\node[label, below of=r1s] (r1sl) {$3s$};

%sigma bonding
\draw[] (0em,\ssplit/-2) node[orbital] (sb) {\moupdown};
\node[label, below of=sb]  (sbl) {$\sigma$};
\node[label, left of=sb, node distance = 9ex] {\tiny{\color{gray}{$\Psi_{a}+\Psi_{b}$}}};

%sigma antibonding
\draw[] (0em,\ssplit/2) node[orbital] (sa) {\moupdown};
\node[label, below of=sa] (sal) {$\sigma^{*}$};
\node[label, left of=sa, node distance = 9ex] {\tiny{\color{gray}{$\Psi_{a}-\Psi_{b}$}}};

%orbital labels
\node[label, below of=l1sl, node distance=6em]   (a)    {\smash[b]{\ce{I}}};
\node[label, right of=a   , node distance=\mwidth+\hsep]   (ab)   {\ce{ICl}};
\node[label, right of=a   , node distance=\mwidth*2+\hsep*2]  (b)    {\ce{Cl}};

%Title
\node[label, below of=ab  , node distance=3em]   (desc) {Cloruro di iodio ICl};

%2p splitting
\draw        (\mwidth/-2-\hsep*2-\pextend,\pbaseline)            -- (\mwidth/-2-\hsep  ,\pbaseline);
\draw[split] (\mwidth/-2-\hsep  ,\pbaseline)            -- (\mwidth/-2        ,\pbaseline+\psplit/2);
\draw        (\mwidth/-2        ,\pbaseline+\psplit/2)  -- (\mwidth/2         ,\pbaseline+\psplit/2);
\draw[split] (\mwidth/2         ,\pbaseline+\psplit/2)  -- (\mwidth/2+\hsep   ,\pbaseline);
\draw        (\mwidth/2+\hsep   ,\pbaseline)            -- (\mwidth/+2+\hsep*2+\pextend,\pbaseline);
\draw[split] (\mwidth/-2-\hsep  ,\pbaseline)            -- (\mwidth/-2        ,\pbaseline+\psplit/-2);
\draw        (\mwidth/-2        ,\pbaseline+\psplit/-2) -- (\mwidth/2         ,\pbaseline+\psplit/-2);
\draw[split] (\mwidth/2         ,\pbaseline+\psplit/-2) -- (\mwidth/2+\hsep   ,\pbaseline);

\draw[split] (\mwidth/-2-\hsep  ,\pbaseline)            -- (\mwidth/-2        ,\pbaseline-\psso+\psplit/2);
\draw        (\mwidth/-2        ,\pbaseline-\psso+\psplit/2)  -- (\mwidth/2         ,\pbaseline-\psso+\psplit/2);
\draw[split] (\mwidth/2         ,\pbaseline-\psso+\psplit/2)  -- (\mwidth/2+\hsep   ,\pbaseline);
\draw[split] (\mwidth/-2-\hsep  ,\pbaseline)            -- (\mwidth/-2        ,\pbaseline+\psso+\psplit/-2);
\draw        (\mwidth/-2        ,\pbaseline+\psso+\psplit/-2) -- (\mwidth/2         ,\pbaseline+\psso+\psplit/-2);
\draw[split] (\mwidth/2         ,\pbaseline+\psso+\psplit/-2) -- (\mwidth/2+\hsep   ,\pbaseline);

%left 2p
\draw[] (-\mwidth-\hsep,\pbaseline) node[orbital] (l2pa) {\moupdown};
\node[orbital, left of=l2pa] (l2pb) {\moup};
\node[orbital, left of=l2pb] (l2pc) {\moup};

\node[label, below of=l2pb] (l2pl) {$2p$};

%right 2p

\draw[] (\mwidth+\hsep,\pbaseline) node[orbital] (r2pa) {\moupdown};
\node[orbital, right of=r2pa] (r2pb) {\moup};
\node[orbital, right of=r2pb] (r2pc) {\moup};

\node[label, below of=r2pb] (r2pl) {$2p$};

%sigmap bonding
\draw[] (0em,\pbaseline+\psplit/-2) node[orbital] (spb) {\moupdown};
\node[label, below of=spb]  (spbl) {$\sigma$};

%sigmap antibonding
\draw[] (0em,\pbaseline+\psplit/2) node[orbital] (spab) {};
\node[label, below of=spab]  (spabl) {$\sigma^{*}$};

%pi antibonding levels
\draw[] (-\pxyoffset,\pbaseline+\psso-\psplit/2) node[orbital] (ppabx) {\moupdown};
\node[label, below of=ppabx]  (ppabxl) {$\pi_{x}$};
\draw[] (+\pxyoffset,\pbaseline+\psso-\psplit/2) node[orbital] (ppaby) {\moupdown};
\node[label, below of=ppaby]  (ppabyl) {$\pi_{y}$};

%pi antibonding levels
\draw[] (-\pxyoffset,\pbaseline-\psso+\psplit/2) node[orbital] (ppbx) {\moup};
\node[label, below of=ppbx]  (ppbxl) {$\pi^{*}_{x}$};
\draw[] (+\pxyoffset,\pbaseline-\psso+\psplit/2) node[orbital] (ppby) {\moup};
\node[label, below of=ppby]  (ppbyl) {$\pi^{*}_{y}$};

\draw[red,line width=3pt] ([xshift=-3mm]current bounding box.north west) -- (current bounding box.south west);
\end{tikzpicture}

\end{document}
2
  • Yes, thank you very much! – user3204810 Oct 30 '19 at 19:49
  • explanation added :-) – AndréC Oct 30 '19 at 19:50

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.