尽管 modiagram 存在 bug(LaTeX3 MOdiagram 包中的错误) 我决定根据以下公式绘制我自己的氯化碘 ICl 分子轨道图这。您能否建议如何添加各种轨道的相对垂直能量轴,并可能添加特征值?
\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}
先感谢您
答案1
当一个图形被构建时,它的边界框会随着它的构建而更新。这个边界框是一个名为 的节点current bounding box
。
因此我通过将其移到代码最末端的左侧来追踪它的左侧。
\draw[red,line width=3pt] ([xshift=-3mm]current bounding box.north west) -- (current bounding box.south west);
\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}