diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/tikzorbital/tikzorbital.pdf | bin | 0 -> 189684 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/tikzorbital/tikzorbital.tex | 535 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tikzorbital/tikzorbital.sty | 371 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-pictures.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/tikzorbital.tlpsrc | 0 |
6 files changed, 908 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/tikzorbital/tikzorbital.pdf b/Master/texmf-dist/doc/latex/tikzorbital/tikzorbital.pdf Binary files differnew file mode 100644 index 00000000000..771593b6f16 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikzorbital/tikzorbital.pdf diff --git a/Master/texmf-dist/doc/latex/tikzorbital/tikzorbital.tex b/Master/texmf-dist/doc/latex/tikzorbital/tikzorbital.tex new file mode 100644 index 00000000000..3053542a8e4 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikzorbital/tikzorbital.tex @@ -0,0 +1,535 @@ +\documentclass[10pt]{article} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[english]{babel} + +\usepackage{url} +\usepackage{xcolor} +\usepackage[version=3]{mhchem} +\usepackage[top=2cm,bottom=2cm,left=2cm,right=2cm]{geometry} + +\usepackage{tikz} +\usetikzlibrary{shadows} + +\usepackage{palatino} +\setlength{\parskip}{1.5ex plus 0.5ex minus 0.5ex} +\setlength{\parindent}{0em} +\usepackage{setspace} +\AtBeginDocument{\onehalfspacing} + +\usepackage[toc]{multitoc} +\setlength{\columnsep}{2cm} +\renewcommand{\columnseprule}{.14pt} + +% ------------------------------------------------------------------------------ +% section format +% ------------------------------------------------------------------------------ +\usepackage{titlesec} +\titleformat*{\section}{\sffamily\Large\bfseries} +\titleformat*{\subsection}{\sffamily\large\bfseries} +\titleformat*{\subsubsection}{\sffamily\bfseries} + +% ------------------------------------------------------------------------------ +% listing package +% ------------------------------------------------------------------------------ +\usepackage{listings} +\definecolor{keycolor}{RGB}{172, 42, 42} + +\lstset{% general command to set parameter(s) +language=[LaTeX]TeX, +numbers=left, +numberstyle=\tiny\color{black!50}, +identifierstyle=, +basicstyle={\small\color{black!95}\ttfamily}, +stringstyle=, +keywordstyle=\bfseries\color{keycolor}, +commentstyle=\color{black!50}, +backgroundcolor=, +emph={ifthenelse,equal,draw,node,tikzstyle,pgfsetlayers,pgfkeys,ProvidesPackage, + colorlet,default,store, in, cd, setOrbitalDrawing, orbitalDrawing, + path,text,RequirePackage,pgfdeclarelayer,usetikzlibrary,command}, +emphstyle=\bfseries\color{red!60!black}, +emph=[2]{orbital,drawLevel,@alobe}, +emphstyle=[2]\itshape\color{blue!50!black}, +moredelim=[s][\color{green!40!black}]{[}{]}, +} + +% ------------------------------------------------------------------------------ +% new float example +% ------------------------------------------------------------------------------ +\usepackage{float} +\newfloat{example}{htbp}{exple}[section] +\floatname{example}{Example} + +% ------------------------------------------------------------------------------ +% newcommand +% ------------------------------------------------------------------------------ +\usepackage{xspace} +\newcommand*{\cmd}[1]{{\ttfamily\color{blue!50!black}$\setminus$#1}\xspace} +\newcommand*{\opt}[1]{{\ttfamily\itshape\color{green!60!black}[<#1>]}\xspace} +\newcommand*{\marg}[1]{{\ttfamily\itshape\color{red!95!black}<#1>}\xspace} +\newcommand{\package}{\textsc{\sffamily\color{blue!50!black}tikzorbiltal}\xspace} + +% ------------------------------------------------------------------------------ +% hyperref +% ------------------------------------------------------------------------------ +\usepackage{hyperref} +\hypersetup{% Modifiez la valeur des champs suivants +pdftex,% Sets up hyperref for use with the pdftex program +colorlinks=true,% active les liens +pdfborder={0 0 0},% bordure des liens +urlcolor=blue!50!black, +linkcolor=,% Color for normal internal links. +pdfstartpage=1,% page affichee a l'ouverture du pdf +pdfauthor={Germain Vallverdu},% +pdftitle={tikzorbital package},% +pdfkeywords={latex,orbital,package,tikz},% +pdfcreator={PDFLaTeX},% +pdfproducer={PDFLaTeX},% +} + +% ------------------------------------------------------------------------------ +\title{\package Package} +\author{Germain \textsc{Salvato-Vallverdu} \\ \url{<germain.vallverdu@univ-pau.fr>}\\\url{http://gvallver.perso.univ-pau.fr/}} +\date{\today} + +\usepackage{tikzorbital} + +% ------------------------------------------------------------------------------ +\begin{document} +% ------------------------------------------------------------------------------ + +\maketitle + +\begin{abstract} + This package provides several \LaTeX{} macros in order to draw easily molecular diagrams and atomic orbital of type $s$, $p$ and $d$ inside tikzpicture environment. This documentation gives the syntax of the commands and complete examples of their utilization. The source code is give at the end. +\end{abstract} + +{\singlespacing +\tableofcontents +} + +\section{Requirements and licence} + +\package underlies the \LaTeX{} project public license (lppl) version 1.3 or later (\url{http://www.latex-project.org/lppl.txt}). It requires the following packages which all are usually included in standard texlive or MikTex distribution : + +\begin{itemize} + \item tikz, pgfkeys (part of tikz) and tikz library shapes + \item ifthen +\end{itemize} + +Feel, free to send comments, contribution or suggestion by email. + +\section{Installation and utilization} + +Download the tarball which contains the files \verb!tikzorbital.sty! and \verb!tikzorbital.pdf! which are respectively the package file and its documentation (\url{http://gvallver.perso.univ-pau.fr/}). After extracting the files, copy them to directories where \LaTeX{} will be able to find them. For example, under Linux operating systems : + +\begin{lstlisting} +% for the .sty file +/home/you/texmf/tex/latex/tikzorbital + +% for the pdf documentation file +/home/you/texmf/doc/latex/tikzorbital +\end{lstlisting} + +Under a macOS operating system the \verb!texmf! directory is not in your home directory but in the \verb!Library! directory. + +Package \package do not have any options. After you have copied it in a directory where \LaTeX{} will find it, simply load it as other \LaTeX{} package : + +\begin{lstlisting} +\usepackage{tikzorbital} +\end{lstlisting} + +All macros provided by \package must be uses inside a tikzpicture environment. The \opt{pos} option of the macro is a position which can be given in the tikz syntax. + +Options of macros provided by \package must be given in a \texttt{key = value} syntax. For example : +% +\begin{lstlisting} +\command[option 1 = <value1>, option2 = <value2> ...]{argument} +\end{lstlisting} + +\section{Molecular orbital diagrams} + +The package \package provides the following command in order to draw easily molecular orbital diagrams : + +\cmd{drawLevel}\opt{options}\texttt{\{}\marg{name}\texttt{\}} + +This command draw a thick line with zero, one or two electrons which represent the occupation of the orbital and are drew as vertical arrows which indicate the spin of each electron. \marg{name} is the name of the orbital and is used in order to define anchors which could be used in order to draw correlation lines or to add labels (see example \ref{expl:molecular_diagram}). The following anchor are created : + +\begin{itemize} + \item \texttt{left name} : at the left of the orbital level + \item \texttt{right name} : at the right of the orbital level + \item \texttt{middle name} : at the middle of the orbital level +\end{itemize} + +The following \opt{options} are available : +% +\begin{description} + \item \opt{elec} : Number of electrons, \texttt{<value>} must be one of \{\texttt{up, down, updown, pair}\} where \texttt{pair} and \texttt{updown} have got the same effect.\\ + \texttt{default = no} + + \item \opt{pos} : left position of the level\\ + \texttt{default = \{(0,0)\}} + + \item \opt{width} : level width\\ + \texttt{default = 2} + + \item \opt{style} : a set of tikz commands which define the way levels have to be drawn\\ + \texttt{default = \{line width = 2pt, color = black!80, line cap = round\}} + + \item \opt{spinstyle} : a set of tikz commands which define the way the arrows which represents the electrons have to be drawn\\ + \texttt{default = \{very thick, color = red!80, -stealth\}} + + \item \opt{spinlength} : length of spin arrows \\ + \texttt{default = 1} +\end{description} + +Note that if the value of an option contains comma or parenthesis, you should enclose its in curly brace. + +Example \ref{expl:molecular_diagram} shows how to use \cmd{drawLevel} for molecule \ce{HHe}. + +\begin{example}[h] +\begin{minipage}{0.6\textwidth} +\begin{lstlisting} +\begin{tikzpicture} + \drawLevel[elec = up, pos = {(0,0)}, width = 2]{1sH} + \drawLevel[elec = updown, pos = {(6,-2)}, width = 2]{1sHe} + + \drawLevel[elec = pair, pos = {(3,-3)}, width = 2]{sigma} + \drawLevel[elec = up, pos = {(3,3)}, width = 2]{sigmastar} + + \draw[dashed] (right 1sH) -- (left sigma) + (right 1sH) -- (left sigmastar) + (left 1sHe) -- (right sigmastar) + (left 1sHe) -- (right sigma) ; + + \node[left] at (left 1sH) {\ce{1s_H}} ; + \node[right] at (right 1sHe) {\ce{1s_{He}}} ; + \node[left] at (left sigma) {$\sigma$}; + \node[left] at (left sigmastar) {$\sigma^*$}; +\end{tikzpicture} +\end{lstlisting} +\end{minipage} +\hfill +\begin{minipage}{0.39\textwidth} +\centering +\begin{tikzpicture}[scale=0.7] + \drawLevel[elec = up, pos = {(0,0)}, width = 2]{1sH} + \drawLevel[elec = updown, pos = {(6,-2)}, width = 2]{1sHe} + + \drawLevel[elec = pair, pos = {(3,-3)}, width = 2]{sigma} + \drawLevel[elec = up, pos = {(3,3)}, width = 2]{sigmastar} + + \draw[dashed] (right 1sH) -- (left sigma) + (right 1sH) -- (left sigmastar) + (left 1sHe) -- (right sigmastar) + (left 1sHe) -- (right sigma) ; + + \node[left] at (left 1sH) {\ce{1s_H}} ; + \node[right] at (right 1sHe) {\ce{1s_{He}}} ; + \node[left] at (left sigma) {$\sigma$}; + \node[left] at (left sigmastar) {$\sigma^*$}; +\end{tikzpicture} +\end{minipage} +\caption{Example of the molecular diagram of the molecule \ce{HHe+} drew with the command \cmd{drawLevel}.} +\label{expl:molecular_diagram} +\end{example} + +\section{Molecular orbitals drawings} + +The package \package, provides the command \cmd{orbital} in order to draw atomic orbital $s$, $p$ or $d$. The general syntax is : + +\cmd{orbital}\opt{options}\{\marg{type}\} + +where \marg{type} is the type of the atomic orbital : \texttt{lobe, s, px, py, pz, dxy, dxz, dyz, dx2y2} or \texttt{dz2}. See example \ref{expl:all_OA} to see all atomic orbital types. The \texttt{lobe} type simply draw one lobe of a $p$ or $d$ atomic orbital and may be used, for example, to draw hybrid orbital. With the \texttt{lobe} type you can also represent electrons as small spheres inside the orbital. + +\begin{minipage}{.75\textwidth} +\begin{lstlisting} +\begin{tikzpicture} + \node (s) {S}; + \orbital[nelec = 2, scale = 1.5, pos = (s.east)]{lobe} +\end{tikzpicture} +\end{lstlisting} +\end{minipage} +\begin{minipage}{.25\textwidth} +\centering +\begin{tikzpicture} + \node (s) {S}; + \orbital[nelec = 2, scale = 1.5, pos = (s.east)]{lobe} +\end{tikzpicture} +\end{minipage} + +\subsection*{General options} + +The following options, allow to change the position, the aspect and the size the atomic orbital. They are available for all type of atomic orbital. : +% +\begin{description} + \item \opt{pos} : position of the center of the atomic orbital\\ + \texttt{default = \{(0,0)\}} + + \item \opt{scale} : scaling factor\\ + \texttt{default = 1} + + \item \opt{opacity} : opacity of the atomic orbital. Useful if you wish to superimpose atomic orbital\\ + \texttt{default = 1} +\end{description} + +\subsubsection*{Color options} + +The color of atomic orbitals can be selected with options : \opt{pcolor}, \opt{ncolor} or \opt{color}. The options \opt{pcolor} and \opt{ncolor} stand for the positive and the negative lobes of $p$ or $d$-type atomic orbitals. The \opt{color} option define the color of $s$-type or \texttt{lobe}-type orbital. For these types of atomic orbital, if no color is given the \opt{pcolor} is used. + +\begin{description} + \item \opt{color} : color of the atomic orbital for $s$-type or \texttt{lobe}-type orbital \\ + \texttt{\opt{pcolor} is used} + + \item \opt{pcolor} : color of the positive lobe (or color for $s$ and $lobe$-type orbital if \opt{color} is not given)\\ + \texttt{default = blue} + + \item \opt{ncolor} : color of the negative lobe (for $p$ and $d$-type orbital only)\\ + \texttt{default = black!30} +\end{description} + +\subsubsection*{\texttt{lobe}-type specific options} + +The following options will have an effect only for the \texttt{lobe} type : + +\begin{description} + \item \opt{rotate} : rotation of the atomic orbital\\ + \texttt{default = 0} + + \item \opt{nelec} : number of electron to draw inside the lobe\\ + \texttt{default = 0} +\end{description} + +\subsubsection*{examples} + +Example \ref{expl:all_OA} shows all atomic orbital types available. In order to decide the type of the atomic orbital you need, look at the axes definition below : + +\begin{center} +\begin{tikzpicture}[scale = 2] + \tikzstyle{axe} = [-stealth, thick, color = black!80] + \draw[very thick, draw = black!80, fill = white, rounded corners = 1pt, drop shadow] (-.3,-.3) rectangle (1.2,1.821) node (corner) {}; + \node[below left] at (corner) {paper sheet}; + \draw[axe] (0,0) -- (1,0) node[below] {$\vec{y}$}; + \draw[axe] (0,0) -- (0,1) node[left] {$\vec{z}$}; + \node[circle, fill = black!80, scale = .5] at (0,0) {}; + \node[circle, draw, color = black!80, thick, scale = 1] {}; + \node[below left] {$\vec{x}$}; + \node[left, xshift = -2mm] at (current bounding box.west) {Cartesian axes definition :}; +\end{tikzpicture} +\end{center} + +\begin{example}[htbp] +\begin{minipage}{.49\textwidth} +\begin{lstlisting} +\begin{tikzpicture} + \orbital[pos = {(2,5.5)}]{lobe} + \node[above] at (2.5,6) {simple lobe}; + + \orbital[pos = {(0,5.5)}]{s} + \node[above] at (0,6) {s}; + + \orbital[pos = {(0,3)}]{px} + \node[above] at (0,4) {p$_x$}; + \orbital[pos = {(2,3)}]{py} + \node[above] at (2,4) {p$_y$}; + \orbital[pos = {(4,3)}]{pz} + \node[above] at (4,4) {p$_z$}; + + \orbital[pos = {(0,0)}]{dxy} + \node[above] at (0,1) {d$_{xy}$}; + \orbital[pos = {(2,0)}]{dxz} + \node[above] at (2,1) {d$_{xz}$}; + \orbital[pos = {(4,0)}]{dyz} + \node[above] at (4,1) {d$_{yz}$}; + + \orbital[pos = {(0,-2)}]{dx2y2} + \node[below] at (0,-3) {d$_{x^2-y^2}$}; + \orbital[pos = {(2,-2)}]{dz2} + \node[below] at (2,-3) {d$_{z^2}$}; +\end{tikzpicture} +\end{lstlisting} +\end{minipage} +\begin{minipage}{.49\textwidth} +\centering +\begin{tikzpicture} + \orbital[pos = {(2,5.5)}]{lobe} + \node[above] at (2.5,6) {simple lobe}; + + \orbital[pos = {(0,5.5)}]{s} + \node[above] at (0,6) {s}; + + \orbital[pos = {(0,3)}]{px} + \node[above] at (0,4) {p$_x$}; + \orbital[pos = {(2,3)}]{py} + \node[above] at (2,4) {p$_y$}; + \orbital[pos = {(4,3)}]{pz} + \node[above] at (4,4) {p$_z$}; + + \orbital[pos = {(0,0)}]{dxy} + \node[above] at (0,1) {d$_{xy}$}; + \orbital[pos = {(2,0)}]{dxz} + \node[above] at (2,1) {d$_{xz}$}; + \orbital[pos = {(4,0)}]{dyz} + \node[above] at (4,1) {d$_{yz}$}; + + \orbital[pos = {(0,-2)}]{dx2y2} + \node[below] at (0,-3) {d$_{x^2-y^2}$}; + \orbital[pos = {(2,-2)}]{dz2} + \node[below] at (2,-3) {d$_{z^2}$}; +\end{tikzpicture} +\end{minipage} +\caption{All the atomic orbitals available from the command \cmd{orbital}.} +\label{expl:all_OA} +\end{example} + +\clearpage +\section{Atom and hybrid orbitals} + +The package \package provides the command \cmd{atom} in order to quickly draw an atom with several orbital lobes around it. The general syntax of the command is : + +\cmd{atom}\opt{options}\{\marg{lobes}\} + +The \marg{lobes} argument is a comma separated list of lobe definition with the syntax + +\texttt{color/rotation-angle/anchor/number of electrons} + +For each element of the list, the command \cmd{atom} draw a lobe at the given anchor, with the given color , rotation and number of electrons. + +The following options are available in order to customize the drawing : + +\begin{description} + \item \opt{pos} : position of the atom.\\ + \texttt{default = \{(0,0)\}} + + \item \opt{name} : name of the atom. Give also the name to the node where the atom is drawn.\\ + \texttt{default = X} + + \item \opt{color} : color of the atom.\\ + \texttt{default = green} + + \item \opt{opacity} : opacity of the lobe drawn around the atom.\\ + \texttt{default = 0.8} +\end{description} + +Example \ref{exple:atom} show several applications of the command \cmd{atom}. + +\begin{example}[htbp] +\begin{minipage}{.78\textwidth} +\begin{lstlisting} +\begin{tikzpicture} + \atom[color = orange, name = S]{orange/0/east/2} +\end{tikzpicture} +\end{lstlisting} + +\begin{lstlisting} +\begin{tikzpicture} + \atom[name = Cl, color = blue]{ + blue/90/north/2, + blue/0/east/1, + blue/270/south/2, + blue/180/west/2} + \atom[name = H, color = gray, pos = {(1.8,0)}]{gray/180/west/1} +\end{tikzpicture} +\end{lstlisting} + +\begin{lstlisting} +\begin{tikzpicture} + \atom[name = B, color = green!50!black]{ + red/90/north/2, + blue/0/east/1, + orange/270/south/0, + green/180/west/1} +\end{tikzpicture} +\end{lstlisting} +\end{minipage} +\begin{minipage}{.21\textwidth} +\begin{tikzpicture} + \atom[color = orange, name = S]{orange/0/east/2} + + \atom[name = Cl, color = blue, pos = {(0,-3)}]{ + blue/90/north/2, + blue/0/east/1, + blue/270/south/2, + blue/180/west/2} + \atom[name = H, color = gray, pos = {(1.8,-3)}]{gray/180/west/1} + + \atom[name = B, color = green!50!black, pos = {(0,-7)}]{ + red/90/north/2, + blue/0/east/1, + orange/270/south/0, + green/180/west/1} +\end{tikzpicture} +\end{minipage} +\caption{Utilization example of the \cmd{atom} command.} +\label{exple:atom} +\end{example} + +\clearpage +\section{More customization} + +\subsubsection*{Orbital borders and inner color} + +It is possible to change the inner color of orbital and the color of orbital borders. These two colors are defined as follow in \package package : + +\begin{lstlisting} +% inner color for orbital filling +\colorlet{innerColor}{black!10} +% color for orbital drawing +\colorlet{drawColor}{black!80} +\end{lstlisting} + +Thus if you change the definition of these colors you will change the desired color on the drawing of the atomic orbitals. + +\subsubsection*{Orbital customization} + +You can give a set of tikz options to the command \cmd{setOrbitalDrawing}. This command acts as a tikz style which is applied every time an atomic orbital is drawn. All options give in this command will overwrite default style of atomic orbital. For example, if you want to draw atomic orbital in red with very thick line thickness : + +\begin{lstlisting} +\setOrbitalDrawing{{very thick, color = red}} +\end{lstlisting} + +\subsubsection*{Change default value globally with pgfkeys} + +If you want to change the default value of the \opt{width} option of the \cmd{drawLevel} command or whatever other option for a whole tikzpicture, you can do this using the \lstinline!\pgfkeys! command. You simply have to give to this command one or several options you want to set globally. + +All options of a \package's command follow the tree : \texttt{/tikzorbital/command/option}. For example, if you want to change the \opt{width} option of the \cmd{drawLevel} command, you have to write : +% +\begin{lstlisting} +\pgfkeys{tikzorbital/drawLevel/width = 1} +% or +\pgfkeys{tikzorbital/drawLevel/.cd, width = 1} +\end{lstlisting} + +\section{Inner macro \cmd{@alobe}} + +In order to draw atomic orbital, \package use the inner macro \cmd{@alobe}. + +\cmd{@alobe}\{\marg{pos}\}\{\marg{rotation}\}\{\marg{scale}\}\{\marg{color}\}\{\marg{nelec}\}\{\marg{opacity}\} + +\cmd{@alobe} macro draw one lobe of $p$ or $d$ orbital and corresponds to the \texttt{lobe} type of \cmd{orbital} (see above). \cmd{@alobe} accepts six arguments : + +\begin{enumerate} + \item[\#1] the position + \item[\#2] angle of rotation + \item[\#3] scaling factor + \item[\#4] the color + \item[\#5] the number of electron, namely 0, 1 or 2 + \item[\#6] the opacity of the lobe +\end{enumerate} +% +no default are given. For example, the $d_{yz}$ atomic orbital is defined as follow + +\begin{lstlisting} +\@alobe{\orbital@pos}{45}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} +\@alobe{\orbital@pos}{135}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} +\@alobe{\orbital@pos}{225}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} +\@alobe{\orbital@pos}{315}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} +\end{lstlisting} + +\section{Source code} + +\lstinputlisting{../../../tex/latex/tikzorbital/tikzorbital.sty} + +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/tikzorbital/tikzorbital.sty b/Master/texmf-dist/tex/latex/tikzorbital/tikzorbital.sty new file mode 100644 index 00000000000..e9bffcbe108 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikzorbital/tikzorbital.sty @@ -0,0 +1,371 @@ +% ------------------- +% Package tikzorbital +% ------------------- +% +% This package provides several commands in order to draw atomic orbitals and +% molecular diagrams. +% +% Germain Vallverdu <germain.vallverdu@univ-pau.fr> +% 05 decembre 2012 +% http://gvallver.perso.univ-pau.fr/ +% +% Licence : LaTeX Project Public Licence +% http://www.latex-project.org/lppl.txt +% +% Feel free to contact me if you have any ideas, suggestions or bugs report ! +% +% ----------------------------------------------------------------------------- +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{tikzorbital}[2012/12/05 draw atomic orbitals and molecular diagrams with tikz] +% ----------------------------------------------------------------------------- + +\RequirePackage{tikz} +\usetikzlibrary{shapes} +\RequirePackage{ifthen} + +\pgfdeclarelayer{background} +\pgfdeclarelayer{main} +\pgfdeclarelayer{foreground} +\pgfsetlayers{background,main,foreground} + +% ----------------------------------------------------------------------------- +% keys in order to submit tikz command to macro +% ----------------------------------------------------------------------------- +\pgfkeys{/tikz/.cd, + execute style/.style = {#1}, + execute macro/.style = {execute style/.expand once=#1} +} + +% ----------------------------------------------------------------------------- +% commande \drawLevel[key = value]{name} +% ----------------------------------------------------------------------------- +% draw a level with a given name in order to draw molecular diagrams +% +% argument +% name : base name of level anchor. +% +% options +% elec : Number of electrons : up, down, updown or pair +% pos : left position of the level +% width : level widht +% style : level style (a tikzstyle) +% spinstyle : style of arrows which represents electrons (a tikzstyle) +% spinlength : length of spin arrows +% ----------------------------------------------------------------------------- + +\pgfkeys{/tikzorbital/drawLevel/.cd, +% number of electron in the level : up, down, updown or pair + elec/.store in = \drawLevel@elec, + elec/.default = no, +% position of the left anchor of the level + pos/.store in = \drawLevel@pos, + pos/.default = {(0,0)}, +% width of levels + width/.store in = \drawLevel@width, + width/.default = 2, +% style of levels + style/.store in = \drawLevel@style, + style/.default = {line width = 2pt, color = black!80, line cap = round}, +% style of arrows + spinstyle/.store in = \drawLevel@spinstyle, + spinstyle/.default = {very thick, color = red!80, -stealth}, +% length of spin arrows + spinlength/.store in = \drawLevel@spinlength, + spinlength/.default = 1, +% execute options + elec, pos, width, style, spinstyle, spinlength +} + +% the drawLevel command +\newcommand{\drawLevel}[2][]{% + \begingroup + \pgfkeys{/tikzorbital/drawLevel/.cd, #1} + \def\drawLevel@name{#2} + + \draw[execute macro = \drawLevel@style] + \drawLevel@pos + node (left \drawLevel@name) {} + -- ++ (\drawLevel@width, 0) + node (right \drawLevel@name) {} + node[pos=0.5] (middle \drawLevel@name) {} + node[pos=0.3] (pos1) {} + node[pos=0.7] (pos2) {}; + + \ifthenelse{\equal{\drawLevel@elec}{updown} \or \equal{\drawLevel@elec}{pair}}{ + \draw[execute macro = \drawLevel@spinstyle] + (pos1.center) ++ (0,-\drawLevel@spinlength/2) -- + ++ (0,\drawLevel@spinlength); + \draw[execute macro = \drawLevel@spinstyle] + (pos2.center) ++ (0, \drawLevel@spinlength/2) -- + ++ (0,-\drawLevel@spinlength); + }{ + \ifthenelse{\equal{\drawLevel@elec}{up}}{ + \draw[execute macro = \drawLevel@spinstyle] + (middle #2.center) ++ (0,-\drawLevel@spinlength/2) -- + ++ (0,\drawLevel@spinlength); + }{ + \ifthenelse{\equal{\drawLevel@elec}{down}}{ + \draw[execute macro = \drawLevel@spinstyle] + (middle #2.center) ++(0,\drawLevel@spinlength/2) -- + ++ (0,-\drawLevel@spinlength); + }{ + } + } + } + \endgroup +} + +% ----------------------------------------------------------------------------- +% some customization of orbital +% ----------------------------------------------------------------------------- + +% inner color for orbital filling +\colorlet{innerColor}{black!10} + +% color for orbital drawing +\colorlet{drawColor}{black!80} + +% more style for lobe orbital drawing +\newcommand{\setOrbitalDrawing}[1]{\def\orbitalDrawing{#1}} +\setOrbitalDrawing{thick} + +% ----------------------------------------------------------------------------- +% inner \@alobe command +% ----------------------------------------------------------------------------- +% Draw one lobe of a p or d atomic orbital, at a given position with a given scale, +% color, rotation and opacity. Draw zero, one or two balls which represent electrons. +% +% arguments +% #1 : position +% #2 : rotation +% #3 : scale +% #4 : color +% #5 : number of electron +% #6 : opacity +% ----------------------------------------------------------------------------- +\newcommand{\@alobe}[6]{ + \begin{scope}[rotate around = {#2:#1}] + % draw orbital lobe + \begin{pgfonlayer}{background} + \draw[draw = drawColor, outer color = #4, inner color = innerColor, + opacity = #6, execute macro = \orbitalDrawing] + #1 .. controls ++ (#3 * 1, #3 * 1) and ++ (#3 * 1, - #3 * 1) .. #1; + \end{pgfonlayer} + + %Coordinates of the electrons + \path #1 ++ (0.50 * #3, 0) node (e1) {}; + \path #1 ++ (0.25 * #3, 0) node (e2) {}; + \end{scope} + + % Draw the electrons + \ifnum#5>0 + \foreach \n in {1,...,#5} { + \shade[ball color = #4] (e\n) circle (1mm); + } + \fi +} + +% ----------------------------------------------------------------------------- +% commande \orbital[key = value]{type} +% ----------------------------------------------------------------------------- +% draw an atomic orbital of a given type. +% +% argument +% type : lobe, s, px, py, pz, dxz, dyz, dxy, dz2, dx2y2 +% +% options +% pos : left position of the level +% pcolor : color of the positive lobe +% ncolor : color of the negative lobe +% scale : scaling factor +% opacity : opacity of the orbital +% rotate : rotate of the AO (lobe type only) +% nelec : number of electron (lobe type only) +% ----------------------------------------------------------------------------- + +% define options +\pgfkeys{/tikzorbital/orbital/.cd, +% position of the orbital + pos/.store in = \orbital@pos, + pos/.default = {(0,0)}, +% color of the positive lobe + pcolor/.store in = \orbital@pcolor, + pcolor/.default = blue, +% color of the negative lobe + ncolor/.store in = \orbital@ncolor, + ncolor/.default = black!30, +% color for s type + color/.store in = \orbital@color, + color/.default = empty, +% scale factor + scale/.store in = \orbital@scale, + scale/.default = 1, +% opacity of the orbital + opacity/.store in = \orbital@opacity, + opacity/.default = 1., +% lobe type options +% rotation of the orbital + rotate/.store in = \orbital@rotate, + rotate/.default = 0, +% number of electrons + nelec/.store in = \orbital@nelec, + nelec/.default = 0, +% execute options + pos, pcolor, ncolor, scale, opacity, rotate, nelec, color +} + +% orbital command +\newcommand{\orbital}[2][]{ + \begingroup + \pgfkeys{/tikzorbital/orbital/.cd, #1} + + % orbital type + \def\orbital@type{#2} + + % general style + \tikzstyle{base} = [draw = drawColor, thick, inner color = innerColor, + circle, opacity = \orbital@opacity, + execute macro = \orbitalDrawing] + + % check if color was setted + \ifthenelse{\equal{\orbital@color}{empty}}{ + \pgfkeys{/tikzorbital/orbital/.cd, color = \orbital@pcolor} + }{} + + % draw the whished orbital + \ifthenelse{\equal{\orbital@type}{lobe}}{ + \@alobe{\orbital@pos}{\orbital@rotate}{\orbital@scale}{\orbital@color}{\orbital@nelec}{\orbital@opacity} + }{ + \ifthenelse{\equal{\orbital@type}{py}}{ + \@alobe{\orbital@pos}{0}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} + \@alobe{\orbital@pos}{180}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} + }{ + \ifthenelse{\equal{\orbital@type}{pz}}{ + \@alobe{\orbital@pos}{90}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} + \@alobe{\orbital@pos}{270}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} + }{ + \ifthenelse{\equal{\orbital@type}{px}}{ + \node[base, outer color = \orbital@ncolor, scale = \orbital@scale * 1.8, + xshift = 2pt, yshift = 2pt] at \orbital@pos {}; + \node[base, outer color = \orbital@pcolor, scale = \orbital@scale * 1.8] + at \orbital@pos {}; + }{ + \ifthenelse{\equal{\orbital@type}{dyz}}{ + \@alobe{\orbital@pos}{45}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} + \@alobe{\orbital@pos}{135}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} + \@alobe{\orbital@pos}{225}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} + \@alobe{\orbital@pos}{315}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} + }{ + \ifthenelse{\equal{\orbital@type}{dxz}}{ + \@alobe{\orbital@pos}{80}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} + \@alobe{\orbital@pos}{280}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} + \@alobe{\orbital@pos}{100}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} + \@alobe{\orbital@pos}{260}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} + }{ + \ifthenelse{\equal{\orbital@type}{dxy}}{ + \@alobe{\orbital@pos}{10}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} + \@alobe{\orbital@pos}{170}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} + \@alobe{\orbital@pos}{350}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} + \@alobe{\orbital@pos}{190}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} + }{ + \ifthenelse{\equal{\orbital@type}{dx2y2}}{ + \begin{pgfonlayer}{background} + \node[base, outer color = \orbital@pcolor, scale = \orbital@scale * 1.8, + xshift = 2pt, yshift = 2pt] at \orbital@pos {}; + \end{pgfonlayer} + \@alobe{\orbital@pos}{0}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} + \@alobe{\orbital@pos}{180}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} + \node[base, outer color = \orbital@pcolor, scale = \orbital@scale * 1.8] + at \orbital@pos {}; + }{ + \ifthenelse{\equal{\orbital@type}{dz2}}{ + \@alobe{\orbital@pos}{270}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} + \begin{pgfonlayer}{background} + \node[ellipse, minimum width = \orbital@scale * .8cm, + minimum height = \orbital@scale * .3cm, draw = drawColor, + inner color = innerColor, outer color = \orbital@ncolor, + execute macro = \orbitalDrawing] + at \orbital@pos {}; + \end{pgfonlayer} + \@alobe{\orbital@pos}{90}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} + }{ + \ifthenelse{\equal{\orbital@type}{s}}{ + \node[base, outer color = \orbital@color, scale = \orbital@scale * 1.8] + at \orbital@pos {}; + }{ + \node[red] at \orbital@pos {orbital type unknown}; + }}}}}}}}}} + \endgroup +} + +% +% other possibility for dxy and dxz atomic orbital +% ------------------------------------------------ +% +% dxz +% \begin{scope}[xshift = 2.2pt, yshift = 2pt] +% \@alobe{\orbital@pos}{90}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} +% \@alobe{\orbital@pos}{270}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} +% \end{scope} +% \@alobe{\orbital@pos}{90}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} +% \@alobe{\orbital@pos}{270}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} +% +% dxy +% \begin{scope}[xshift = 2.2pt, yshift = 2pt] +% \@alobe{\orbital@pos}{10}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} +% \@alobe{\orbital@pos}{170}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} +% \end{scope} +% \@alobe{\orbital@pos}{350}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} +% \@alobe{\orbital@pos}{190}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} +% +% ------------------------------------------------- + +% ----------------------------------------------------------------------------- +% commande \atom[options]{lobes} +% ----------------------------------------------------------------------------- +% quickly draw an atom with several orbital lobes around it +% +% argument +% lobes : A comma separated list lobe definition with +% color/rotation-angle/anchor/number of electrons +% +% options +% pos : position of the atom +% name : name of the atom, also used to label the node +% color : color of the atom +% opacity : opacity of the orbital +% ----------------------------------------------------------------------------- + +% define options +\pgfkeys{/tikzorbital/atom/.cd, +% position of the atom + pos/.store in = \atom@pos, + pos/.default = {(0,0)}, +% atom name + name/.store in = \atom@name, + name/.default = X, +% color of the atom + color/.store in = \atom@color, + color/.default = green, +% opacity of the orbitals + opacity/.store in = \atom@opacity, + opacity/.default = .8, +% execute options + pos, name, color, opacity +} + +% atom definition +\newcommand{\atom}[2][]{ + \begingroup + \pgfkeys{/tikzorbital/atom/.cd, #1} + \colorlet{atomColor}{\atom@color} + \node[shape = circle, thick, inner sep = 0pt, minimum size = 1.5em, + draw = atomColor!40, color = atomColor!70!gray, fill = atomColor!20] + at \atom@pos (\atom@name) {\atom@name}; + \foreach \acolor/\rot/\anchor/\Ne in {#2} { + \@alobe{(\atom@name.\anchor)}{\rot}{1.5}{\acolor}{\Ne}{\atom@opacity} + } + \endgroup +} + +%% end of file %% diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index b82334ad019..b7383769e27 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -415,7 +415,7 @@ my @TLP_working = qw( thinsp thmbox thmtools threeddice threeparttable threeparttablex thumb thumbpdf thumbs thumby thuthesis ticket tikz-cd tikz-3dplot tikz-dependency tikz-inet tikz-qtree tikz-timing - tikzpagenodes tikzpfeile tikzposter tikzscale + tikzorbital tikzpagenodes tikzpfeile tikzposter tikzscale timetable tipa tipa-de titlefoot titlepages titlepic titleref titlesec titling tkz-base tkz-berge tkz-doc tkz-euclide tkz-fct tkz-graph diff --git a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc index ea88da2e7f9..2ae31bc9efa 100644 --- a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc @@ -80,6 +80,7 @@ depend tikz-dependency depend tikz-inet depend tikz-qtree depend tikz-timing +depend tikzorbital depend tikzpagenodes depend tikzpfeile depend tikzposter diff --git a/Master/tlpkg/tlpsrc/tikzorbital.tlpsrc b/Master/tlpkg/tlpsrc/tikzorbital.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/tikzorbital.tlpsrc |