diff options
author | Karl Berry <karl@freefriends.org> | 2012-07-26 22:41:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-07-26 22:41:27 +0000 |
commit | 189cdee7beb21ea6634aa3e2844ca3d27bb2e3e1 (patch) | |
tree | d20d9545fe52c30ac779e9ee20c0d0e4e7ac49cb /Master/texmf-dist/tex/latex/modiagram | |
parent | 8a2c1623b5a599a79f075c27ca4b5a70dc79cfc6 (diff) |
modiagram (26jul12)
git-svn-id: svn://tug.org/texlive/trunk@27173 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/modiagram')
-rw-r--r-- | Master/texmf-dist/tex/latex/modiagram/modiagram.sty | 127 |
1 files changed, 66 insertions, 61 deletions
diff --git a/Master/texmf-dist/tex/latex/modiagram/modiagram.sty b/Master/texmf-dist/tex/latex/modiagram/modiagram.sty index 7a0834ff9d9..e3b73c16095 100644 --- a/Master/texmf-dist/tex/latex/modiagram/modiagram.sty +++ b/Master/texmf-dist/tex/latex/modiagram/modiagram.sty @@ -1,37 +1,40 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% --------------------------------------------------------------------------- % -% - MOdiagram - modiagram.sty - % -% - easy creation of molecular orbital diagrams - % -% --------------------------------------------------------------------------- % -% - Clemens Niederberger - % -% - 2012/01/23 - % -% --------------------------------------------------------------------------- % -% - http://www.mychemistry.eu/ - % -% - contact@mychemistry.eu - % -% --------------------------------------------------------------------------- % -% - If you have any ideas, questions, suggestions or bugs to report, please - % -% - feel free to contact me. - % -% --------------------------------------------------------------------------- % -% - Copyright 2011-2012 Clemens Niederberger - % -% - - % -% - This work may be distributed and/or modified under the - % -% - conditions of the LaTeX Project Public License, either version 1.3 - % -% - of this license or (at your option) any later version. - % -% - The latest version of this license is in - % -% - http://www.latex-project.org/lppl.txt - % -% - and version 1.3 or later is part of all distributions of LaTeX - % -% - version 2005/12/01 or later. - % -% - - % -% - This work has the LPPL maintenance status `maintained'. - % -% - - % -% - The Current Maintainer of this work is Clemens Niederberger. - % -% - - % -% - This work consists of the files modiagram.sty, modiagram_doc_de.tex, - % -% - modiagram_doc_de.tex, README - % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% -------------------------------------------------------------------------- +% the MODIAGRAM package +% +% easy creation of molecular orbital diagrams +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% Web: https://www.bitbucket.org/cgnieder/modiagram +% E-Mail: contact@mychemistry.eu +% -------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% -------------------------------------------------------------------------- +% Copyright 2011--2012 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% +% This work consists of the files modiagram.sty, modiagram_en.tex, +% README and the derived file modiagram_en.pdf. +% -------------------------------------------------------------------------- \RequirePackage{ expl3 , xparse , l3keys2e , tikz , textgreek } \usetikzlibrary{calc,arrows} -\ProvidesExplPackage {modiagram} {2012/01/23} {0.2a} {easy creation of molecular orbital diagrams} +\ProvidesExplPackage + {modiagram} + {2012/07/25} + {0.2b} + {easy creation of molecular orbital diagrams} % --------------------------------------------------------------------------- % % error messages @@ -148,21 +151,26 @@ % split energy levels for creating the MO; we need to detect wether the left % or the right AO is the lower or higher one, respectively -\cs_if_free:NT \dim_compare:cNcTF { \cs_generate_variant:Nn \dim_compare:nNnTF { cNcTF } } +\cs_generate_variant:Nn \dim_compare:nNnTF { cNc } \cs_new_nopar:Npn \MOdiagram_split_energy:NNN #1#2#3 { - \dim_compare:cNcTF { l_MOdiagram_atom_left_#1_dim } < { l_MOdiagram_atom_right_#1_dim } + \dim_compare:cNcTF + { l_MOdiagram_atom_left_#1_dim } < { l_MOdiagram_atom_right_#1_dim } { - \dim_set_eq:Nc \l_MOdiagram_energy_gain_dim { l_MOdiagram_atom_left_#1_dim } + \dim_set_eq:Nc \l_MOdiagram_energy_gain_dim + { l_MOdiagram_atom_left_#1_dim } \dim_sub:Nn \l_MOdiagram_energy_gain_dim { #2 } - \dim_set_eq:Nc \l_MOdiagram_energy_loss_dim { l_MOdiagram_atom_right_#1_dim } + \dim_set_eq:Nc \l_MOdiagram_energy_loss_dim + { l_MOdiagram_atom_right_#1_dim } \dim_add:Nn \l_MOdiagram_energy_loss_dim { #3 } } { - \dim_set_eq:Nc \l_MOdiagram_energy_gain_dim { l_MOdiagram_atom_right_#1_dim } + \dim_set_eq:Nc \l_MOdiagram_energy_gain_dim + { l_MOdiagram_atom_right_#1_dim } \dim_sub:Nn \l_MOdiagram_energy_gain_dim { #2 } - \dim_set_eq:Nc \l_MOdiagram_energy_loss_dim { l_MOdiagram_atom_left_#1_dim } + \dim_set_eq:Nc \l_MOdiagram_energy_loss_dim + { l_MOdiagram_atom_left_#1_dim } \dim_add:Nn \l_MOdiagram_energy_loss_dim { #3 } } } @@ -171,11 +179,11 @@ % position the spin-up/spin-down el: \cs_new_nopar:Npn \MOdiagram_AO_place_electron:nn #1#2 { - \fp_set:Nn \l_tmpa_tl { #2 } - \fp_compare:nNnT { \l_tmpa_tl } < { 0 } + \fp_set:Nn \l_tmpa_fp { #2 } + \fp_compare:nNnT { \l_tmpa_fp } < { 0 } { \msg_error:nn { MOdiagram } { electron-placement } } - \fp_abs:N \l_tmpa_tl - \fp_compare:nNnT { \l_tmpa_tl } > { 1 } + \fp_abs:N \l_tmpa_fp + \fp_compare:nNnT { \l_tmpa_fp } > { 1 } { \msg_error:nn { MOdiagram } { electron-placement } } \bool_if:nTF { #1 } { \tl_set:Nn \l_MOdiagram_AO_down_electron_tl { #2 } } @@ -185,23 +193,19 @@ \cs_new_nopar:Npn \MOdiagram_AO_place_electrons:n #1 { - \fp_set:Nn \l_tmpa_tl { 1 } - \fp_sub:Nn \l_tmpa_tl { #1 } - \fp_mul:Nn \l_tmpa_tl { .5 } - \MOdiagram_AO_place_electron:nx { 0 } { \fp_to_tl:N \l_tmpa_tl } - \fp_set:Nn \l_tmpa_tl { 1 } - \fp_add:Nn \l_tmpa_tl { #1 } - \fp_mul:Nn \l_tmpa_tl { .5 } - \MOdiagram_AO_place_electron:nx { 1 } { \fp_to_tl:N \l_tmpa_tl } + \fp_set:Nn \l_tmpa_fp { .5 * ( 1 - #1 ) } + \MOdiagram_AO_place_electron:nx { 0 } { \fp_to_tl:N \l_tmpa_fp } + \fp_set:Nn \l_tmpa_fp { .5 * ( 1 + #1 ) } + \MOdiagram_AO_place_electron:nx { 1 } { \fp_to_tl:N \l_tmpa_fp } } % place the right atom \cs_new_nopar:Npn \MOdiagram_molecule_position:n #1 { - \fp_set_from_dim:Nn \l_tmpa_tl { #1 } - \fp_mul:Nn \l_tmpa_tl { .5 } + \fp_set_from_dim:Nn \l_tmpa_fp { #1 } + \fp_mul:Nn \l_tmpa_fp { .5 } \dim_set:Nn \l_MOdiagram_molecule_position_dim - { \fp_to_dim:N \l_tmpa_tl + \l_MOdiagram_left_atom_position_dim } + { \fp_to_dim:N \l_tmpa_fp + \l_MOdiagram_left_atom_position_dim } } \cs_generate_variant:Nn \MOdiagram_molecule_position:n { f } @@ -265,7 +269,8 @@ labels .bool_set:N = \l_MOdiagram_AO_labels_bool , names .bool_set:N = \l_MOdiagram_names_bool , names-style .tl_set:N = \l_MOdiagram_names_style_tl , - names-style-add .code:n = { \tl_put_right:Nn \l_MOdiagram_names_style_tl { , #1 } } , + names-style-add .code:n = + { \tl_put_right:Nn \l_MOdiagram_names_style_tl { , #1 } } , labels-fs .tl_set:N = \l_MOdiagram_orbital_label_fontsize_tl , labels-style .tl_set:N = \l_MOdiagram_orbital_label_style_tl } @@ -580,18 +585,18 @@ % place the x, y, and z orbitals \cs_new_nopar:Npn \MOdiagram_p_orbitals_shift:nnn #1#2#3 { - \fp_set_from_dim:Nn \l_tmpa_tl { \l_MOdiagram_AO_width_dim } + \fp_set_from_dim:Nn \l_tmpa_fp { \l_MOdiagram_AO_width_dim } { - \fp_mul:Nn \l_tmpa_tl { #1 } - \dim_gset:Nn \l_MOdiagram_atom_px_shift_dim { \fp_to_dim:N \l_tmpa_tl } + \fp_mul:Nn \l_tmpa_fp { #1 } + \dim_gset:Nn \l_MOdiagram_atom_px_shift_dim { \fp_to_dim:N \l_tmpa_fp } } { - \fp_mul:Nn \l_tmpa_tl { #2 } - \dim_gset:Nn \l_MOdiagram_atom_py_shift_dim { \fp_to_dim:N \l_tmpa_tl } + \fp_mul:Nn \l_tmpa_fp { #2 } + \dim_gset:Nn \l_MOdiagram_atom_py_shift_dim { \fp_to_dim:N \l_tmpa_fp } } { - \fp_mul:Nn \l_tmpa_tl { #3 } - \dim_gset:Nn \l_MOdiagram_atom_pz_shift_dim { \fp_to_dim:N \l_tmpa_tl } + \fp_mul:Nn \l_tmpa_fp { #3 } + \dim_gset:Nn \l_MOdiagram_atom_pz_shift_dim { \fp_to_dim:N \l_tmpa_fp } } } |