Debian Codegraph @

texmf-dist/doc/latex/mohelper/mohelper-doc.tex

raw
1 \documentclass[12pt, a4paper]{article}
2
3 \usepackage[utf8]{inputenc}
4 \usepackage[T1]{fontenc}
5 \usepackage{amsmath}
6 \usepackage{color}
7 \usepackage{listings}
8 \usepackage{hyperref}
9 \usepackage{etoolbox}
10 \usepackage{float}
11 \usepackage[version=4]{mhchem}
12 \usepackage[
13 top=2cm,
14 bottom=3cm,
15 left=2cm,
16 right=2cm
17 ]{geometry}
18
19
20 \usepackage{mohelper}
21
22 % dddddddddddddddddddddddddddddddddddddddd
23
24 \definecolor{codegreen}{rgb}{0,0.6,0}
25 \definecolor{codegray}{rgb}{0.5,0.5,0.5}
26 \definecolor{codepurple}{rgb}{0.58,0,0.82}
27 \definecolor{backcolour}{rgb}{0.95,0.95,0.92}
28
29 \lstdefinestyle{mystyle}{
30 language=[LaTeX]TeX,
31 backgroundcolor=\color{backcolour},
32 commentstyle=\color{codegreen},
33 numberstyle=\tiny\color{darkgray},
34 stringstyle=\color{codepurple},
35 basicstyle=\ttfamily\footnotesize,
36 breakatwhitespace=false,
37 breaklines=true,
38 captionpos=b,
39 keepspaces=false,
40 showspaces=false,
41 tabsize=4,
42 classoffset=0,
43 keywordsprefix=\\,
44 morekeywords={begin,end,documentclass,usepackage,fragment},
45 keywordstyle=\color{magenta}\bfseries,
46 }
47
48 \hypersetup{
49 colorlinks=true,
50 linkcolor=black,
51 filecolor=magenta,
52 urlcolor=blue,
53 }
54
55 \lstset{style=mystyle}
56
57 \makeatletter
58 \newcommand{\degeneratelabel}{\degener@telabel}
59 \makeatother
60 \AddToHook{shipout/background}{%
61 \put(0.5\paperwidth, -0.96\paperheight){%
62 \makebox(0,0)[b]{%
63 \footnotesize \color{gray} © 2026 modiagram-latex-integration. Licensed under \href{https://www.gnu.org/licenses/gpl-3.0.html}{GPL v3}.%
64 }%
65 }%
66 }
67 % dddddddddddddddddddddddddddddddddddddddd
68
69
70
71 \title{Reference Manual for mohelper \\[1ex] \large \colorbox{green}{v1.0}}
72
73 \author{Viktor Altergott}
74 \date{\today}
75
76
77 \begin{document}
78
79 \maketitle
80
81 \begin{figure}[H]
82 \centering
83 \fbox{
84 \begin{mohelper}
85 \def\columndistance{3}
86 \def\diagrammode{compact}
87 \fragment{
88 \addOrbital{energy=0,sym={t2g,eg},config={,,,,},labels=3d}
89 \addOrbital{energy=3,sym=a1g,labels=4s}
90 \addOrbital{energy=4.5,sym=t1u,config={,,},labels=4p}
91 \addLabel{$Me^{n+}$}{0}
92 }
93 \fragment{
94 \addOrbital{energy=-4,sym=a1g}
95 \addOrbital{energy=-3,sym=t1u,config={,,}}
96 \addOrbital{energy=-2,sym=eg,config={,}}
97 \addOrbital{energy=0,sym=t2g,config={,,}}
98 \addOrbital{energy=1,sym=eg,config={,}}
99 \addOrbital{energy=6,sym=a1g}
100 \addOrbital{energy=6.5,sym=t1u,config={,,}}
101 }
102 \fragment{
103 \addOrbital{energy=-1,sym={a1g,t1u,eg},config={,,,,,},labels=SALCs}
104 \addLabel{6L}{0}
105 }
106 \addEnergyScale{0}
107 \end{mohelper}
108 }
109 \caption{Octahedral Complex}
110 \label{fig:modiagram0}
111 \end{figure}
112
113
114 \newpage
115
116 \tableofcontents
117
118 \newpage
119
120
121 \section{Introduction}
122 Stop fighting with pure TikZ. mohelper is a LaTeX package designed to create professional Molecular Orbital (MO) diagrams with minimal code. It handles the positioning, electron population, and dashed connection lines automatically, so you can focus on the chemistry, not the coordinates.
123 Have a look:
124
125 \newcommand{\showfigureone}{
126 \begin{mohelper}
127 \def\columndistance{3}
128 \def\diagrammode{normal}
129 \degenerate{0}{1s/up}{0}
130 \degenerate{-2}{$\sigma$/pair}{1}
131 \degenerate{2}{$\sigma^*$/empty}{1}
132 \degenerate{0}{1s/up}{2}
133 \connectorbital{0}{1}{-2}{1}{0}
134 \connectorbital{0}{1}{2}{1}{0}
135 \connectorbital{-2}{1}{0}{1}{2}
136 \connectorbital{2}{1}{0}{1}{2}
137 \addenergyscale{0}
138 \end{mohelper}
139 }
140
141 \begin{figure}[h]
142 \centering
143 \begin{mohelper}
144 \fragment{
145 \addOrbital{energy=0,label=1s,config=up}
146 }
147 \fragment{
148 \addOrbital{energy=-2,label=$\sigma$,config=pair}
149 \addOrbital{energy=2,label=$\sigma^*$}
150 }
151 \fragment{
152 \addOrbital{energy=0,label=1s,config=up}
153 }
154 \addEnergyScale{0}
155 \end{mohelper}
156 \caption{Hydrogen Molecule}
157 \label{fig:modiagram1}
158 \end{figure}
159
160
161 \begin{lstlisting}
162 \begin{mohelper}
163 \fragment{
164 \addOrbital{energy=0,label=1s,config=up}
165 }
166 \fragment{
167 \addOrbital{energy=-2,label=$\sigma$,config=pair}
168 \addOrbital{energy=2,label=$\sigma^*$}
169 }
170 \fragment{
171 \addOrbital{energy=0,label=1s,config=up}
172 }
173 \addEnergyScale{0}
174 \end{mohelper}
175 \end{lstlisting}
176
177 \section{Quick Start}
178 To use the diagrams generated by this tool in your LaTeX project, follow these steps:
179 \subsection{Include the Package}
180 \subsubsection{From CTAN}
181 \label{subsub:fromctan}
182 \begin{lstlisting}
183 \usepackage{mohelper}
184 \end{lstlisting}
185 Include this into your preamble. Note that this might not be the newest version. In case you depend on using a newer version go to \ref{subsub:fromlocal}.
186 \subsubsection{From Local}
187 \label{subsub:fromlocal}
188 Download the package and include it into your project. To do so download the \texttt{mohelper.sty} file from
189 \begin{enumerate}
190 \item \href{https://github.com/thevicraft/modiagram-latex-integration/releases}{Releases} (recommended, stable)
191 \item \href{https://thevicraft.github.io/modiagram-latex-integration/}{Repository} (only if you know what you are doing)
192 \end{enumerate}
193 and paste the file into your project's root directory. Ensure you have the mohelper package included in your preamble:
194 \begin{lstlisting}
195 \usepackage{mohelper}
196 \end{lstlisting}
197 If you put \texttt{mohelper.sty} into a subdirectory, you must specify its path. Therefore, have this example shown:
198 \begin{lstlisting}
199 \usepackage{./lib/mohelper}
200 \end{lstlisting}
201 {\textcolor{red}{Note that this method will throw a compiler warning because it is trying to find a package called \texttt{/lib/mohelper}. However, it still finds the package and it should work. Still, to avoid this warning put the package into your project's root directory, and input only through package name.}}
202
203 \subsection{Configure your Diagram}
204 Open the \href{https://thevicraft.github.io/modiagram-latex-integration/}{Web Helper} and set up your orbitals, energies, and labels.
205
206 \subsection{Copy and Paste}
207 Copy the generated LaTeX code and paste it into your \texttt{figure} environment or document body.
208
209 \section{Dependencies}
210 \texttt{mohelper} uses some other pakets which are listed here:
211 \begin{itemize}
212 \item \texttt{tikz}, and some \texttt{tikzlibraries}
213 \begin{itemize}
214 \item \texttt{arrows.meta}
215 \item \texttt{backgrounds}
216 \end{itemize}
217 \item \texttt{xstring}
218 \item \texttt{etoolbox}
219 \end{itemize}
220
221 \section{Basic Usage}
222 The heart of the package is the \texttt{mohelper} environment. It follows a \textcolor{red}{multi}-column logic:
223
224 \begin{figure}[H]
225 \centering
226 \begin{mohelper}[scale=0.7]
227 \def\columndistance{5}
228 \def\diagrammode{normal}
229 \fragment{
230 \addOrbital{config={e,e,e,e,e},sym={t2g,eg},energy=0}
231 \addLabel{\color{blue}{column 0}}{0}
232 }
233 \fragment{
234 \addOrbital{energy=-0.8,sym=t2g,config={e,e,e}}
235 \addOrbital{energy=1.2,sym=eg,config={e,e}}
236 \addLabel{\color{blue}{column 1}}{0}
237 }
238 \fragment{
239 \addOrbital{energy=1.5,sym={eg,a},config=e}
240 \addOrbital{energy=0.9,sym={eg,b},config=e}
241 \addOrbital{energy=-0.2,sym={t2g,c},config={e}}
242 \addOrbital{energy=-1.1,sym={t2g,d},config={e,e}}
243 \addLabel{\color{blue}{column 2}}{0}
244 }
245
246 \fragment{
247 \addOrbital{energy=1.9,sym=a,config=e}
248 \addOrbital{energy=0,sym=b,config=e}
249 \addOrbital{energy=1.0,sym=c,config={e}}
250 \addOrbital{energy=-1.5,sym=d,config={e,e}}
251 \addLabel{\color{blue}{column 3}}{0}
252 }
253
254 \end{mohelper}
255 \caption{Ligand Field Splitting in Octahedral, Jahn-Teller, Square Planar}
256 \label{fig:modiagram2}
257 \end{figure}
258
259 \noindent The package therefore extends above normal MO diagrams. \texttt{mohelper} allows having indefinite columns. They are not hard-coded to \texttt{left}, \texttt{middle} and \texttt{right}.
260
261 \section{Macro Reference}
262
263 \subsection{The Environment}
264
265 \begin{lstlisting}
266 \begin{mohelper}[options]
267 ...
268 \end{mohelper}
269 \end{lstlisting}
270
271 Wraps a \texttt{tikzpicture}. You can pass standard TikZ options like \texttt{[scale=0.8]}.
272
273 \subsection{Defining Fragments}
274
275 Each MO diagram consists of fragments. Each fragment is represented by a column. A standard MO diagram has 3 fragments.
276 \begin{itemize}
277 \item Left Atom
278 \item Molecule
279 \item Right Atom
280 \end{itemize}
281 Figure \ref{fig:modiagram2} has 4 fragments. It is quite easy when you forget the fragment part and just think about columns.
282
283 \paragraph{}
284
285 \begin{lstlisting}
286 \fragment{
287 ... % draw orbitals, etc.
288 }
289 \end{lstlisting}
290
291 \noindent The \texttt{\textbackslash fragment} command builds a new column into your diagram. It acts as a shell in which you have to define orbitals etc. All important definitions are done within these scopes.
292
293 \subsubsection{Orbitals}
294
295 \begin{lstlisting}
296 \addOrbital{ [attributes] }
297 \end{lstlisting}
298
299 \noindent Adding orbitals is easier than you think. Between the scopes you need to set attributes. The syntax\footnote{It is managed using an external library called \texttt{pgfkeys}.} looks like this:
300
301 \begin{lstlisting}
302 \addOrbital{
303 attribute1=value1,
304 attribute2=value2,
305 ...
306 }
307 \end{lstlisting}
308
309 \noindent The following table shows all attributes and their corresponding values.
310
311 \newcommand{\previewdegeneratelabel}[1]{
312 \colorbox{lightgray}{
313 \begin{mohelper}[scale=0.6]
314 \fragment{
315 \addOrbital{labelposition=#1,label=$\color{blue}{a_{1g}}$,config={up,up}}
316 }
317 \end{mohelper}
318 }
319 }
320
321 \begin{center}
322 \begin{tabular}{|c| p{8cm} |p{5cm}|}
323 \hline
324 Attribute & Description & Example \\ [0.5ex]
325 \hline%\hline
326 \texttt{energy} & \textbf{Y-Level} (Energy) & \texttt{-2.5} \\
327 \hline
328 \texttt{sym} & \textbf{Symmetry Group} (irreducible representation) & \texttt{t2g}, \texttt{a1}, \texttt{eg} \newline(no special characters allowed!)
329 \\
330 \hline
331 \texttt{config} & \textbf{Electron Configuration}, Array of spin values (Format: \texttt{\{spin1, spin2, spin3\}}) & \begin{tabular}{p{3.5cm}}
332
333 \texttt{up}, \texttt{down} or \texttt{pair} (any other value will result in an empty orbital) \\ \hline example:\newline\texttt{\{pair, up, up\}}\newline \colorbox{lightgray}{\begin{mohelper}[scale=0.6]\fragment{\addOrbital{config={pair,up,up}}}\end{mohelper}} \\
334 \end{tabular}
335 \\
336 \hline
337 \texttt{labels} & \textbf{Individual Labels Array}: label each orbital of the degenerated group individually & \texttt{\{\$p\_x\$, \$p\_y\$, \$p\_z\$\}} \newline \colorbox{lightgray}{\begin{mohelper}[scale=0.6]\fragment{\addOrbital{config={pair,up,up},labels={$p_x$,$p_y$,$p_z$}}}\end{mohelper}} \\
338 \hline
339 \texttt{label} & \textbf{Single Label}: a single label for all degenerated orbitals & \texttt{\$a\_\{1g\}\$} \\
340 \hline
341 \texttt{labelposition} & \textbf{Position of Label}: this affects only the single label, individual labels are untouched & \begin{tabular}{p{1.5cm}| c}
342
343 \texttt{left} & \previewdegeneratelabel{left} \\ \hline\texttt{right} & \previewdegeneratelabel{right}\\ \hline \texttt{bottom} & \previewdegeneratelabel{bottom}\\ \hline \texttt{top} & \previewdegeneratelabel{top} \\
344 \end{tabular}
345 \\[1ex]
346 \hline
347 \end{tabular}
348 \end{center}
349
350 % energy=0,
351 % sym=a1,
352 % config={empty},
353 % labels={},
354 % label=,
355 % labelposition=bottom,
356 % column=,
357 \noindent{\color{red}{Note: It is possible to execute \texttt{\textbackslash addOrbital} outside of \texttt{\textbackslash fragment}. To do so, you must specify the additional attribute \texttt{column} with a corresponding number. However, drawing fragment labels (\ref{fragmentlabels}) or energy difference arrows (\ref{energydifference}) is not possible outside of \texttt{\textbackslash fragment}. It is not recommended to do that, as it will result in strange bugs!}}
358
359 \paragraph{Important~Attributes}
360
361 \subparagraph{energy} comes in pakets, quants. Therefore all states are quantized and $E=h\cdot\nu$. You know this theorem very well. This means for the diagram that the energy level you specify will mark the y-coordinate in the diagram. The diagram does not use any fancy scale like \texttt{$eV$}. Instead it uses paper units whereas $1\text{unit} \approx 1cm$. It is as if you would draw the diagram on paper. \textcolor{red}{If not specified the standard value is \texttt{0}.}
362
363 \subparagraph{sym(metry)} is quite intuitive when you understand it. This irreducible representation ($\Gamma$) is meant to help \texttt{mohelper} (yes, we help the helper) to choose which orbitals are actually overlapping. These orbitals are then connected with dotted lines. Only orbitals with the same symmetry ($\Gamma_{\psi_1}=\Gamma_{\psi_2}$) have a relevant constructive interference.
364 \newline Note, that the \texttt{string} or \texttt{string array} you set for the \texttt{sym} attribute is only required for internal calculations within the \texttt{mohelper} package. Therefore it is disallowed to use special characters. Styling or math formula is supposed to be done in labels. Instead of \texttt{\$t\_\{2g\}\$} just type \texttt{t2g}. It is fast, no one will see it except you, and if you read the code, you still know it means $t_{2g}$.
365 \newline And yes, you can specify more than one symmetry group. Put them in these brackets \texttt{\{\}} and separate them by comma.
366 \newline This is very helpful when you initialize degenerated Ligand Group Orbitals (LGO) as Symmetry Adapted Linear Combinations (SALCs). \textcolor{red}{If not specified the standard value is \texttt{a1}.}
367
368 \begin{figure}[H]
369 \centering
370 \fbox{
371 \begin{mohelper}[scale=0.5]
372 \def\columndistance{4}
373 \fragment{
374 \addOrbital{energy=-1,sym=a1,config={pair},label=$\color{blue}{a1}$,labelposition=right}
375 \addOrbital{energy=4,sym=a1,label=$\color{blue}{a1}$,labelposition=right}
376 \addOrbital{energy=0,sym=t2,config={pair,pair,pair},label=$\color{blue}{t2}$,labelposition=right}
377 \addOrbital{energy=5,sym=t2,config={e,e,e},label=$\color{blue}{t2}$,labelposition=right}
378 }
379 \fragment{
380 \addOrbital{energy=3,sym={a1,t2},config={up,up,up,up},label=$\color{blue}{a_1,t_2}$,labelposition=right}
381 }
382 \end{mohelper}
383 }
384 \end{figure}
385
386 \subparagraph{config(uration)} attribute is what defines the degeneration and electron configuration of the orbital. In this \texttt{array} you specify the spin values. \texttt{up}, \texttt{down} or \texttt{pair} are the allowed values, every other string value will be treated as if there is no electron.
387 \newline This excited electron configuration \texttt{\{pair,up,\}} will result in three degenerated orbitals. Empty spaces separated by comma are treated as empty orbitals. \newline\textcolor{red}{If not specified the standard value is \texttt{\{empty\} which will result in a non-degenerated empty orbital.}.}
388
389 \paragraph{Example}
390 Have a look at this nice example ...
391 \begin{figure}[H]
392 \centering
393 \fbox{
394 \begin{mohelper}[scale=0.8]
395 \def\columndistance{4}
396 \fragment{
397 \addOrbital{energy=2,sym=t2,config={up,up,e},labels={$p_x$,$p_y$,$p_z$},label=$\color{blue}{t_2}$,labelposition=left}
398 \addOrbital{energy=0,sym=a1,config={pair},labels={2s},label=$\color{blue}{a_1}$,labelposition=left}
399 }
400 \fragment{
401 \addOrbital{energy=-1,sym=a1,config={pair},label=$\color{blue}{1a_1}$,labelposition=bottom}
402 \addOrbital{energy=4,sym=a1,label=$\color{blue}{1a_1^*}$,labelposition=bottom}
403 \addOrbital{energy=0,sym=t2,config={pair,pair,pair},label=$\color{blue}{1t_2}$,labelposition=bottom}
404 \addOrbital{energy=5,sym=t2,config={e,e,e},label=$\color{blue}{1t_2^*}$,labelposition=bottom}
405 }
406 \fragment{
407 \addOrbital{energy=3,sym={a1,t2},config={up,up,up,up},label=$\color{blue}{a_1,t_2}$,labelposition=right}
408 }
409 \end{mohelper}
410 }
411 \end{figure}
412 ... and its code:
413 \begin{lstlisting}
414 \begin{mohelper}
415 \fragment{
416 \addOrbital{
417 energy=2, sym=t2, config={up,up,e},
418 labels={$p_x$,$p_y$,$p_z$},
419 label=$\color{blue}{t_2}$, labelposition=left
420 }
421 \addOrbital{
422 energy=0, sym=a1, config={pair},
423 labels={2s},
424 label=$\color{blue}{a_1}$, labelposition=left
425 }
426 }
427 \fragment{
428 \addOrbital{
429 energy=-1, sym=a1, config={pair},
430 label=$\color{blue}{1a_1}$, labelposition=bottom
431 }
432 \addOrbital{
433 energy=4, sym=a1,
434 label=$\color{blue}{1a_1^*}$, labelposition=bottom
435 }
436 \addOrbital{
437 energy=0, sym=t2, config={pair,pair,pair},
438 label=$\color{blue}{1t_2}$, labelposition=bottom
439 }
440 \addOrbital{
441 energy=5, sym=t2, config={e,e,e},
442 label=$\color{blue}{1t_2^*}$, labelposition=bottom
443 }
444 }
445 \fragment{
446 \addOrbital{
447 energy=3, sym={a1,t2}, config={up,up,up,up},
448 label=$\color{blue}{a_1,t_2}$, labelposition=right
449 }
450 }
451 \end{mohelper}
452 \end{lstlisting}
453 You see, it's not so difficult when you get an example. By the way this is supposed to be methane (\ce{CH4}).
454
455 \paragraph{Manually Drawing Orbitals}~\\~\\
456 Aside of \texttt{fragments} and \texttt{symmetry groups} you can manually declare orbitals. Note, they will not connect to other orbitals as they are not included into the auto-connection process.
457
458 \begin{lstlisting}
459 \orbital{x}{y}{label}{spin}
460 \end{lstlisting}
461
462 \noindent \texttt{\textbackslash orbital} manually draws a single orbital at the specified coordinates. For standard orbital diagrams it should not be necessary to use this macro. Only use \texttt{\textbackslash addOrbital} inside of \texttt{\textbackslash fragment\{\}}.
463
464 \begin{center}
465 \begin{tabular}{|c| p{7cm} |p{3cm}|}
466 \hline
467 Parameter & Description & Example \\ [0.5ex]
468 \hline%\hline
469 \texttt{\#1} & \textbf{x} coordinate & \texttt{4.2} \\
470 \hline
471 \texttt{\#2} & \textbf{y} coordinate (energy) & {2.0}
472 \\
473 \hline
474 \texttt{\#3} & Label & \texttt{1s} \\
475 \hline
476 \texttt{\#4} & Spin & \texttt{up}, \texttt{down} or \texttt{pair} (any other value will result in an empty orbital) \\ [1ex]
477 \hline
478 \end{tabular}
479 \end{center}
480
481 \subsubsection{Fragment Labels}
482 \label{fragmentlabels}
483
484 \begin{lstlisting}
485 \fragment{
486 ... % draw orbitals
487 \addLabel{text}{offset}
488 }
489 \end{lstlisting}
490 Labels a fragment. All fragment labels are horizontally aligned under the diagram.
491 \newline \texttt{offset} (number) specifies the additional vertical offset from the diagram. As a default, just set it to \texttt{0}. \textcolor{red}{\texttt{\textbackslash addLabel} has to be executed inside \texttt{\textbackslash fragment} or the anchor of the label will be set completely wrong.}
492
493 \begin{figure}[H]
494 \centering
495 \fbox{\begin{mohelper}[scale=0.5]
496 \def\columndistance{4}
497 \def\diagrammode{normal}
498 \fragment{
499 \addOrbital{config={e,e,e,e,e},sym={t2g,eg},energy=0}
500 }
501 \fragment{
502 \addOrbital{energy=-0.8,sym=t2g,config={e,e,e}}
503 \addOrbital{energy=1.2,sym=eg,config={e,e}}
504 \addLabel{\color{blue}{Octahedral}}{0}
505 }
506 \fragment{
507 \addOrbital{energy=1.5,sym={eg,a},config=e}
508 \addOrbital{energy=0.9,sym={eg,b},config=e}
509 \addOrbital{energy=-0.2,sym={t2g,c},config={e}}
510 \addOrbital{energy=-1.1,sym={t2g,d},config={e,e}}
511 \addLabel{\color{blue}{Jahn-Teller}}{0}
512 }
513
514 \fragment{
515 \addOrbital{energy=1.9,sym=a,config=e}
516 \addOrbital{energy=0,sym=b,config=e}
517 \addOrbital{energy=1.0,sym=c,config={e}}
518 \addOrbital{energy=-1.5,sym=d,config={e,e}}
519 \addLabel{\color{blue}{Square Planar}}{0}
520 }
521 \end{mohelper}}
522 \label{fig:modiagram4}
523 \end{figure}
524
525 \begin{center}
526
527 \begin{tabular}{|c p{9cm}|}
528 \hline
529 \textcolor{blue}{Tipp}: & To color the label you can use standard macros like \texttt{\textbackslash color\{color\}\{text\}} in the \texttt{text} argument of \texttt{\textbackslash addLabel} \\ [0.5ex]
530 \hline
531 \end{tabular}
532 \end{center}
533
534 \subsection{Miscellaneous}
535
536 \subsubsection{Adding Energy Scale}
537
538 \begin{lstlisting}
539 \fragment{ ... }
540 % other fragments, other stuff
541 \addEnergyScale{offset}
542 \end{lstlisting}
543 Adds an energy scale. \texttt{offset} (number) specifies the additional horizontal offset from the diagram. As a default, just set it to \texttt{0}.
544 {\color{red}{This macro has to be executed after the last fragment is defined. Otherwise the scale's size and position will be calculated incorrect.}}
545
546
547
548 \subsubsection{Showing Energy Difference}
549 \label{energydifference}
550
551 \begin{lstlisting}
552 \fragment{
553 ... % draw orbitals & labels
554 \showEnergyDifference{energy1, energy2}{offset}{text}
555 }
556 \end{lstlisting}
557
558 \noindent Draws a double-sided red arrow pointing out an energy difference. \texttt{offset} (number) specifies an additional horizontal offset. As a default, just set it to \texttt{0} which will center it. \textcolor{red}{This macro has to be executed inside \texttt{\textbackslash fragment} or the horizontal position will be completely wrong.}
559
560 \begin{center}
561 \begin{tabular}{|c| p{7cm} |c|}
562 \hline
563 Parameter & Description & Example \\ [0.5ex]
564 \hline%\hline
565 \texttt{\#1} & \textbf{Energy Array} (Format: \texttt{energy1, energy2}) & \texttt{2.0, 4.0} \\
566
567 \hline
568 \texttt{\#2} & \textbf{Horizontal offset}, moves the arrow along x-axis & \texttt{0} (centered) \\
569 \hline
570 \texttt{\#3} & \textbf{Label} & \texttt{\$\textbackslash Delta\_O\$ ($\Delta_O$)} \\ [1ex]
571 \hline
572 \end{tabular}
573 \end{center}
574
575 \begin{figure}[H]
576 \centering
577 \fbox{\begin{mohelper}[scale=0.8]
578 \fragment{
579 \addOrbital{energy=0,config={,,},label=$\color{blue}{t_{2g}}$,labelposition=right}
580 \addOrbital{energy=1.4,config={,},label=$\color{blue}{e_{g}^*}$,labelposition=right}
581 \showEnergyDifference{0, 1.4}{0}{$\Delta_O$}
582 }
583 \end{mohelper}}
584 \label{fig:modiagram45}
585 \end{figure}
586
587
588
589 \subsection{Customization}
590 You can tweak the look for each diagram by redefining these values:
591
592 \begin{itemize}
593 \item \texttt{\textbackslash def\textbackslash columndistance\{value\}}: Set \texttt{value} to a number. It defines space between the AO und MO columns.
594 \item \texttt{\textbackslash def\textbackslash diagrammode\{compact\}}: Switches to vertical stacking for degenerate orbitals (perfect for large systems).
595 \newcommand{\previewcompact}[1]{
596 \begin{mohelper}[scale=0.6]
597 \def\diagrammode{#1}
598 \ifstrequal{#1}{compact}{\def\electroncolor{red}}{}
599
600 \fragment{
601 \addOrbital{energy=-0.5,sym=a1,config=pair,labels=2s}
602 \addOrbital{energy=2,sym={a1,b1,b2},config={pair,up,up},labels=2p}
603 \addLabel{$\ce{O}$}{0.5}
604 }
605 \fragment{
606 \addOrbital{energy=-3,sym=a1,config=pair,labels=$\sigma$}
607 \addOrbital{energy=-1,sym=b1,config=pair,labels=$\pi$}
608 \addOrbital{energy=1,sym=a1,config=pair}
609 \addOrbital{energy=2,sym=b2,config=pair}
610 \addOrbital{energy=4,sym=b1,labels=$\pi^*$}
611 \addOrbital{energy=6,sym=a1,labels=$\sigma^*$}
612 \addLabel{$\ce{H2O}$}{0.5}
613 }
614 \fragment{
615 \addOrbital{energy=3,sym={a1,b1},config={pair,}}
616 \addLabel{$\ce{H2}$}{0.5}
617 }
618 \end{mohelper}
619 }
620 \begin{center}
621 \begin{tabular}{|c c|}
622 \hline
623 \texttt{normal} & \texttt{compact} \\
624 \hline
625 \previewcompact{normal} \vline & \previewcompact{compact} \\
626 \hline
627 \end{tabular}
628 \end{center}
629 \item \texttt{\textbackslash def\textbackslash electroncolor\{color\}}: Set \texttt{color} to a valid color value. Changes the electron color to a specified one. The redefining has to stand before the relevant orbital is created using \texttt{\textbackslash degenerate}.
630 \end{itemize}
631
632 \section{Example}
633 \begin{figure}[H]
634 \centering
635 \begin{mohelper}[scale=0.8] % scale it to 0.8 of original size to fit on page
636 \def\columndistance{5.4} % set column distance to 5.4
637 \def\diagrammode{normal} % draw in normal mode
638 \fragment{
639 \addOrbital{energy=0,sym={t2g,eg},config={pair,pair,pair,up,up},label=3d}
640 \addOrbital{energy=3,sym=a1g,label=4s}
641 \addOrbital{energy=4.5,sym=t1u,config={,,},label=4p}
642 \addLabel{$Ni^{2+}$}{0}
643 }
644 \fragment{
645 \addOrbital{energy=-4,sym=a1g,config=pair,label=$\color{blue}{1a_{1g}}$,labelposition=right}
646 \addOrbital{energy=-3,sym=t1u,config={pair,pair,pair},label=$\color{blue}{1t_{1u}}$,labelposition=right}
647 \addOrbital{energy=-2,sym=eg,config={pair,pair},label=$\color{blue}{1e_g}$,labelposition=right}
648 \addOrbital{energy=0,sym=t2g,config={pair,pair,pair},label=$\color{blue}{1t_{2g}}$,labelposition=right}
649 \addOrbital{energy=1,sym=eg,config={up,up},label=$\color{blue}{2e_g^*}$,labelposition=right}
650 \addOrbital{energy=6,sym=a1g,label=$\color{blue}{2a_{1g}^*}$,labelposition=right}
651 \addOrbital{energy=6.5,sym=t1u,config={,,},label=$\color{blue}{2t_{1u}^*}$,labelposition=right}
652 \showEnergyDifference{0,1}{2.5}{$\Delta_O$} % show ligand field splitting
653 \addLabel{$[Ni(H_2O)_6]^{2+}$}{0}
654 }
655 \fragment{
656 \addOrbital{energy=-1,sym={a1g,t1u,t2g,eg},config={pair,pair,pair,pair,pair,pair},label=SALCs}
657 \addLabel{$6 \times H_2O$}{0}
658 }
659 \addEnergyScale{0} % add the energy scale
660 \end{mohelper}
661 \caption{$[Ni(H_2O)_6]^{2+}$ complex}
662 \label{fig:modiagram3}
663 \end{figure}
664
665 \begin{lstlisting}
666 \begin{mohelper}[scale=0.8] % scale it to 0.8 of original size to fit on page
667 \def\columndistance{5.4} % set column distance to 5.4
668 \def\diagrammode{normal} % draw in normal mode
669 \fragment{
670 \addOrbital{energy=0,sym={t2g,eg},config={pair,pair,pair,up,up},label=3d}
671 \addOrbital{energy=3,sym=a1g,label=4s}
672 \addOrbital{energy=4.5,sym=t1u,config={,,},label=4p}
673 \addLabel{$Ni^{2+}$}{0}
674 }
675 \fragment{
676 \addOrbital{energy=-4,sym=a1g,config=pair,label=$\color{blue}{1a_{1g}}$,labelposition=right}
677 \addOrbital{energy=-3,sym=t1u,config={pair,pair,pair},label=$\color{blue}{1t_{1u}}$,labelposition=right}
678 \addOrbital{energy=-2,sym=eg,config={pair,pair},label=$\color{blue}{1e_g}$,labelposition=right}
679 \addOrbital{energy=0,sym=t2g,config={pair,pair,pair},label=$\color{blue}{1t_{2g}}$,labelposition=right}
680 \addOrbital{energy=1,sym=eg,config={up,up},label=$\color{blue}{2e_g^*}$,labelposition=right}
681 \addOrbital{energy=6,sym=a1g,label=$\color{blue}{2a_{1g}^*}$,labelposition=right}
682 \addOrbital{energy=6.5,sym=t1u,config={,,},label=$\color{blue}{2t_{1u}^*}$,labelposition=right}
683 \showEnergyDifference{0,1}{2.5}{$\Delta_O$} % show ligand field splitting
684 \addLabel{$[Ni(H_2O)_6]^{2+}$}{0}
685 }
686 \fragment{
687 \addOrbital{energy=-1,sym={a1g,t1u,t2g,eg},config={pair,pair,pair,pair,pair,pair},label=SALCs}
688 \addLabel{$6 \times H_2O$}{0}
689 }
690 \addEnergyScale{0} % add the energy scale
691 \end{mohelper}
692 \end{lstlisting}
693
694 \section{License}
695
696 Distributed under the GPL-3.0 License. See \texttt{LICENSE} for more information.
697
698 \end{document}