Commit a7dacf5c authored by Alexander Schoch's avatar Alexander Schoch
Browse files

add newest version of modiagram package

parent a0a34aff
No preview for this file type
% --------------------------------------------------------------------------
% 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--2019 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,chemgreek}
\usetikzlibrary{calc,arrows}
\ProvidesExplPackage
{modiagram}
{2019/10/31}
{0.3}
{easy creation of molecular orbital diagrams}
% --------------------------------------------------------------------------- %
% error messages
\msg_new:nnn {modiagram} {missing-atom}
{
You~ need~ to~ specify~ the~ left~ and~ right~ atom~ first~ before~
you~ can~ use~ \token_to_str:N \molecule \c_space_tl \msg_line_context: .
}
\msg_new:nnn {modiagram} {missing-AO}
{
You~ need~ to~ specify~ both~ #2~ AOs~ first~ before~ you~ can~ use~
#1~ \msg_line_context: .
}
\msg_new:nnn {modiagram} {electron-placement}
{
The~ value~ for~ the~ electron~ placement~ must~ be~ between~ 0~
and~ 1~ \msg_line_context: .
}
\msg_new:nnn {modiagram} {deprecated}
{ The~ #1~ `#2'~ is~ deprecated.~ Use~ `#3'~ instead. }
% --------------------------------------------------------------------------- %
% temporary variables
\tl_new:N \l__modiagram_tmpa_tl
\tl_new:N \l__modiagram_tmpb_tl
\dim_new:N \l__modiagram_tmpa_dim
\fp_new:N \l__modiagram_tmpa_fp
% --------------------------------------------------------------------------- %
% variants of expl3 kernel commands:
\cs_generate_variant:Nn \str_case:nnF {V}
\cs_generate_variant:Nn \dim_compare:nNnTF {vNv}
% --------------------------------------------------------------------------- %
% main environment
\cs_new_protected:Npn \modiagram_start_environment:n #1
{
\cs_set_eq:NN \atom \__modiagram_atom:
\cs_set_eq:NN \molecule \__modiagram_molecule:
\cs_set_eq:NN \AO \__modiagram_arbitrary_AO:
\cs_set_eq:NN \EnergyAxis \__modiagram_EnergyAxis:
\dim_gzero:N \g__modiagram_min_energy_dim
\dim_gzero:N \g__modiagram_max_energy_dim
\int_gzero:N \g__modiagram_AO_name_int
\keys_set:nn {modiagram/diagram} {#1}
\__modiagram_set_labels:
\__modiagram_tikzpicture:n { }
\char_set_catcode_letter:N \:
\char_set_catcode_other:N \;
}
\cs_new_protected:Npn \modiagram_end_environment:
{
\bool_if:NT \l__modiagram_names_bool
{
\__modiagram_node:f { \tl_use:N \l__modiagram_names_style_tl }
at
(
\l__modiagram_left_atom_position_dim ,
\g__modiagram_min_energy_dim - 1cm
)
{ \tl_use:N \l__modiagram_atom_left_name_tl } ;
\__modiagram_node:f { \tl_use:N \l__modiagram_names_style_tl }
at
(
\l__modiagram_molecule_position_dim ,
\g__modiagram_min_energy_dim - 1cm
)
{ \tl_use:N \l__modiagram_molecule_name_tl } ;
\__modiagram_node:f { \tl_use:N \l__modiagram_names_style_tl }
at
(
\l__modiagram_left_atom_position_dim
+ \l__modiagram_inter_atom_distance_dim ,
\g__modiagram_min_energy_dim - 1cm
)
{ \tl_use:N \l__modiagram_atom_right_name_tl } ;
}
\endtikzpicture
}
\NewDocumentEnvironment {modiagram} {O{}}
{ \modiagram_start_environment:n {#1} }
{ \modiagram_end_environment: }
\NewDocumentEnvironment {MOdiagram} {O{}}
{
\msg_warning:nnnnn {modiagram} {deprecated}
{environment}
{MOdiagram}
{modiagram}
\modiagram_start_environment:n {#1}
}
{ \modiagram_end_environment: }
\bool_new:N \l__modiagram_AO_square_bool
\bool_new:N \l__modiagram_AO_round_bool
\bool_new:N \l__modiagram_AO_circle_bool
\bool_new:N \l__modiagram_AO_fancy_bool
\bool_new:N \l__modiagram_AO_labels_bool
\bool_new:N \l__modiagram_names_bool
\tl_new:N \l__modiagram_names_style_tl
\tl_set:Nn \l__modiagram_names_style_tl {anchor=base}
\tl_new:N \l__modiagram_lines_tl
\tl_set:Nn \l__modiagram_lines_tl {dotted}
\tl_new:N \l__modiagram_orbital_label_fontsize_tl
\tl_new:N \l__modiagram_orbital_label_style_tl
\dim_new:N \l__modiagram_AO_width_dim
\dim_set:Nn \l__modiagram_AO_width_dim {10pt}
\tl_new:N \l__modiagram_AO_up_electron_tl
\tl_set:Nn \l__modiagram_AO_up_electron_tl {.4}
\tl_new:N \l__modiagram_AO_down_electron_tl
\tl_set:Nn \l__modiagram_AO_down_electron_tl {.6}
\dim_new:N \l__modiagram_left_atom_position_dim
\dim_set:Nn \l__modiagram_left_atom_position_dim {1cm}
\dim_new:N \l__modiagram_inter_atom_distance_dim
\dim_set:Nn \l__modiagram_inter_atom_distance_dim {4cm}
\dim_new:N \l__modiagram_molecule_position_dim
\dim_new:N \g__modiagram_min_energy_dim
\dim_new:N \g__modiagram_max_energy_dim
\dim_new:N \l__modiagram_energy_gain_dim
\dim_new:N \l__modiagram_energy_loss_dim
% detect lowest and highest orbital so we can draw the appropriate energy axis:
\cs_new_protected:Npn \__modiagram_energy_range:N #1
{
\dim_set:Nn \l__modiagram_tmpa_dim {#1}
\dim_compare:nT { \l__modiagram_tmpa_dim < \g__modiagram_min_energy_dim }
{ \dim_gset_eq:NN \g__modiagram_min_energy_dim \l__modiagram_tmpa_dim }
\dim_compare:nT { \l__modiagram_tmpa_dim > \g__modiagram_max_energy_dim }
{ \dim_gset_eq:NN \g__modiagram_max_energy_dim \l__modiagram_tmpa_dim }
}
% 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_new_protected:Npn \__modiagram_split_energy:nNN #1#2#3
{
\dim_compare:vNvTF
{ 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_sub:Nn \l__modiagram_energy_gain_dim {#2}
\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_sub:Nn \l__modiagram_energy_gain_dim {#2}
\dim_set_eq:Nc \l__modiagram_energy_loss_dim
{ l__modiagram_atom_left_#1_dim }
\dim_add:Nn \l__modiagram_energy_loss_dim {#3}
}
}
% position the spin-up/spin-down el:
\cs_new_protected:Npn \__modiagram_AO_place_electron:nn #1#2
{
\fp_compare:nNnT {#2} < {0}
{ \msg_error:nn {modiagram} {electron-placement} }
\fp_compare:nNnT { abs(#2) } > {1}
{ \msg_error:nn {modiagram} {electron-placement} }
\bool_if:nTF {#1}
{ \tl_set:Nn \l__modiagram_AO_down_electron_tl {#2} }
{ \tl_set:Nn \l__modiagram_AO_up_electron_tl {#2} }
}
\cs_generate_variant:Nn \__modiagram_AO_place_electron:nn {nx}
\cs_new_protected:Npn \__modiagram_AO_place_electrons:n #1
{
\fp_set:Nn \l__modiagram_tmpa_fp { .5 * ( 1 - #1 ) }
\__modiagram_AO_place_electron:nx {0} { \fp_to_tl:N \l__modiagram_tmpa_fp }
\fp_set:Nn \l__modiagram_tmpa_fp { .5 * ( 1 + #1 ) }
\__modiagram_AO_place_electron:nx {1} { \fp_to_tl:N \l__modiagram_tmpa_fp }
}
% place the right atom
\cs_new_protected:Npn \__modiagram_molecule_position:n #1
{
\fp_set:Nn \l__modiagram_tmpa_fp { .5 * \dim_to_fp:n {#1} }
\dim_set:Nn \l__modiagram_molecule_position_dim
{ \fp_to_dim:N \l__modiagram_tmpa_fp + \l__modiagram_left_atom_position_dim }
}
\cs_generate_variant:Nn \__modiagram_molecule_position:n {f}
\__modiagram_molecule_position:f
{ \dim_use:N \l__modiagram_inter_atom_distance_dim }
% set up keys for the environment
\keys_define:nn {modiagram/diagram}
{
style .choice: ,
style / plain .code:n =
{
\bool_set_false:N \l__modiagram_AO_square_bool
\bool_set_false:N \l__modiagram_AO_round_bool
\bool_set_false:N \l__modiagram_AO_circle_bool
\bool_set_false:N \l__modiagram_AO_fancy_bool
\tl_set:Nn \l__modiagram_lines_tl { dotted }
} ,
style / square .code:n =
{
\bool_set_true:N \l__modiagram_AO_square_bool
\bool_set_false:N \l__modiagram_AO_round_bool
\bool_set_false:N \l__modiagram_AO_circle_bool
\bool_set_false:N \l__modiagram_AO_fancy_bool
\tl_set:Nn \l__modiagram_lines_tl { gray }
} ,
style / circle .code:n =
{
\bool_set_false:N \l__modiagram_AO_square_bool
\bool_set_false:N \l__modiagram_AO_round_bool
\bool_set_true:N \l__modiagram_AO_circle_bool
\bool_set_false:N \l__modiagram_AO_fancy_bool
\tl_set:Nn \l__modiagram_lines_tl { gray }
} ,
style / round .code:n =
{
\bool_set_true:N \l__modiagram_AO_square_bool
\bool_set_true:N \l__modiagram_AO_round_bool
\bool_set_false:N \l__modiagram_AO_circle_bool
\bool_set_false:N \l__modiagram_AO_fancy_bool
\tl_set:Nn \l__modiagram_lines_tl { gray }
} ,
style / fancy .code:n =
{
\bool_set_true:N \l__modiagram_AO_square_bool
\bool_set_true:N \l__modiagram_AO_round_bool
\bool_set_false:N \l__modiagram_AO_circle_bool
\bool_set_true:N \l__modiagram_AO_fancy_bool
\tl_set:Nn \l__modiagram_lines_tl { densely~dashed }
} ,
lines .tl_set:N = \l__modiagram_lines_tl ,
distance .code:n =
{
\dim_set:Nn \l__modiagram_inter_atom_distance_dim {#1}
\__modiagram_molecule_position:n {#1}
} ,
AO-width .tl_set:N = \l__modiagram_AO_width_dim ,
up-el-pos .code:n = \__modiagram_AO_place_electron:nn {0} {#1} ,
down-el-pos .code:n = \__modiagram_AO_place_electron:nn {1} {#1} ,
el-sep .code:n = \__modiagram_AO_place_electrons:n {#1} ,
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 } } ,
labels-fs .tl_set:N = \l__modiagram_orbital_label_fontsize_tl ,
labels-style .tl_set:N = \l__modiagram_orbital_label_style_tl
}
\ProcessKeysOptions { modiagram / diagram }
% --------------------------------------------------------------------------- %
% setup command
\NewDocumentCommand \setmodiagram {+m}
{ \keys_set:nn {modiagram/diagram} {#1} }
\NewDocumentCommand \MOsetup {+m}
{
\msg_warning:nnnnn {modiagram} {deprecated}
{command}
{\MOsetup}
{\setmodiagram}
\keys_set:nn {modiagram/diagram} {#1}
}
% --------------------------------------------------------------------------- %
% draw AOs
\tl_new:N \l__modiagram_atom_left_name_tl
\tl_new:N \l__modiagram_atom_right_name_tl
\bool_new:N \l__modiagram_left_atom_placed_bool
\bool_set_false:N \l__modiagram_left_atom_placed_bool
\bool_new:N \l__modiagram_right_atom_placed_bool
\bool_set_false:N \l__modiagram_right_atom_placed_bool
\NewDocumentCommand \__modiagram_atom: {omm}
{
\__modiagram_atom_disable:
\keys_set:nn {modiagram/atom} { position = #2 }
\keys_set:nn {modiagram/atom} {#3}
\bool_if:NTF \l__modiagram_atom_left_bool
{ \bool_set_true:N \l__modiagram_left_atom_placed_bool }
{ \bool_set_true:N \l__modiagram_right_atom_placed_bool }
\IfNoValueF {#1}
{
\bool_if:NTF \l__modiagram_atom_left_bool
{ \tl_set:Nn \l__modiagram_atom_left_name_tl {#1} }
{ \tl_set:Nn \l__modiagram_atom_right_name_tl {#1} }
}
\__modiagram_one_s:
\__modiagram_two_s:
\__modiagram_two_p:
% \__modiagram_three_s:
% \__modiagram_three_p:
% \__modiagram_four_s:
}
\bool_new:N \l__modiagram_atom_left_bool
% is \atom placed left or right?
\keys_define:nn {modiagram/atom}
{
position .choice: ,
position / left .code:n =
{ \bool_set_true:N \l__modiagram_atom_left_bool } ,
position / right .code:n =
{ \bool_set_false:N \l__modiagram_atom_left_bool }
}
\dim_new:N \l__modiagram_atom_xshift_dim
% these are going to be our `arguments' for the \atom command:
\keys_define:nn {modiagram/atom}
{
1s .code:n = { \__modiagram_one_s_set:n {#1} } ,
1s .default:n = { 0 ; pair } ,
2s .code:n = { \__modiagram_two_s_set:n {#1} } ,
2s .default:n = { 2 ; pair } ,
2p .code:n = { \__modiagram_two_p_set:n {#1} } ,
2p .default:n = { 5 ; pair , pair , pair } ,
color .code:n = { \__modiagram_electron_color_set:n {#1} } ,
label .code:n = { \__modiagram_orbital_label_set:n {#1} } ,
up-el-pos .code:n = { \__modiagram_electron_up_set:n {#1} } ,
down-el-pos .code:n = { \__modiagram_electron_down_set:n {#1} }
}
% --------------------------------------------------------------------------- %
% 1s orbital
\dim_new:N \l__modiagram_atom_one_s_dim
\dim_new:N \l__modiagram_atom_left_one_s_dim
\dim_new:N \l__modiagram_atom_right_one_s_dim
\tl_new:N \l__modiagram_AO_one_s_electron_tl
\bool_new:N \l__modiagram_atom_one_s_bool
\bool_new:N \l__modiagram_one_s_left_bool
\bool_set_false:N \l__modiagram_one_s_left_bool
\bool_new:N \l__modiagram_one_s_right_bool
\bool_set_false:N \l__modiagram_one_s_right_bool
% read 1s argument
\cs_new_protected:Npn \__modiagram_one_s_set:n #1
{
\bool_set_true:N \l__modiagram_atom_one_s_bool
\tl_if_in:onTF {#1} {;}
{ \__modiagram_one_s_set_aux:n #1 \q_stop }
{
\tl_clear:N \l__modiagram_AO_one_s_electron_tl
\tl_if_blank:nTF {#1}
{ \dim_set:Nn \l__modiagram_atom_one_s_dim {0cm} }
{ \dim_set:Nn \l__modiagram_atom_one_s_dim {#1cm} }
}
}
\cs_new_protected:Npn \__modiagram_one_s_set_aux:n #1;#2 \q_stop
{
\tl_if_blank:nTF {#1}
{ \dim_set:Nn \l__modiagram_atom_one_s_dim {0cm} }
{ \dim_set:Nn \l__modiagram_atom_one_s_dim {#1cm} }
\tl_set:Nn \l__modiagram_AO_one_s_electron_tl {#2}
}
% display 1s orbital
\cs_new_protected:Npn \__modiagram_one_s:
{
\bool_if:NT \l__modiagram_atom_one_s_bool
{
\bool_if:NTF \l__modiagram_atom_left_bool
{
\dim_set_eq:NN
\l__modiagram_atom_xshift_dim
\l__modiagram_left_atom_position_dim
\dim_set_eq:NN
\l__modiagram_atom_left_one_s_dim
\l__modiagram_atom_one_s_dim
\bool_set_true:N \l__modiagram_one_s_left_bool
}
{
\dim_set:Nn \l__modiagram_atom_xshift_dim
{
\l__modiagram_left_atom_position_dim
+ \l__modiagram_inter_atom_distance_dim
}
\dim_set_eq:NN
\l__modiagram_atom_right_one_s_dim
\l__modiagram_atom_one_s_dim
\bool_set_true:N \l__modiagram_one_s_right_bool
}
\__modiagram_energy_range:N \l__modiagram_atom_one_s_dim
\__modiagram_node:n { inner~sep=0 , outer~sep=0 }
(1s
\bool_if:NTF \l__modiagram_atom_left_bool
{left}
{right}
)
at ( \l__modiagram_atom_xshift_dim , \l__modiagram_atom_one_s_dim )
{
\bool_if:NTF \l__modiagram_atom_left_bool
{
\__modiagram_get_electron_color:n {1sleft}
\__modiagram_get_electron_up:n {1sleft}
\__modiagram_get_electron_down:n {1sleft}
}
{
\__modiagram_get_electron_color:n {1sright}
\__modiagram_get_electron_up:n {1sright}
\__modiagram_get_electron_down:n {1sright}
}
\__modiagram_AO:ff
{ \tl_use:N \l__modiagram_AO_one_s_electron_tl }
{ \tl_use:N \l__modiagram_electron_current_color_tl }
} ;
\bool_if:NTF \l__modiagram_atom_left_bool
{ \__modiagram_get_orbital_label:n {1sleft} }
{ \__modiagram_get_orbital_label:n {1sright} }
}
}
% --------------------------------------------------------------------------- %
% 2s orbital
\dim_new:N \l__modiagram_atom_two_s_dim
\dim_new:N \l__modiagram_atom_left_two_s_dim
\dim_new:N \l__modiagram_atom_right_two_s_dim
\tl_new:N \l__modiagram_AO_two_s_electron_tl
\bool_new:N \l__modiagram_atom_two_s_bool
\bool_new:N \l__modiagram_two_s_left_bool
\bool_set_false:N \l__modiagram_two_s_left_bool
\bool_new:N \l__modiagram_two_s_right_bool
\bool_set_false:N \l__modiagram_two_s_right_bool
% read 2s argument
\cs_new_protected:Npn \__modiagram_two_s_set:n #1
{
\bool_set_true:N \l__modiagram_atom_two_s_bool
\tl_if_in:onTF {#1} {;}
{ \__modiagram_two_s_set_aux:n #1 \q_stop }
{
\tl_clear:N \l__modiagram_AO_two_s_electron_tl
\tl_if_blank:nTF {#1}
{ \dim_set:Nn \l__modiagram_atom_two_s_dim {2cm} }
{ \dim_set:Nn \l__modiagram_atom_two_s_dim {#1cm} }
}
}
\cs_new_protected:Npn \__modiagram_two_s_set_aux:n #1;#2 \q_stop
{
\tl_if_blank:nTF {#1}
{ \dim_set:Nn \l__modiagram_atom_two_s_dim {2cm} }
{ \dim_set:Nn \l__modiagram_atom_two_s_dim {#1cm} }
\tl_set:Nn \l__modiagram_AO_two_s_electron_tl {#2}
}
% display 2s orbital
\cs_new_protected:Npn \__modiagram_two_s:
{
\dim_show:N \l__modiagram_atom_two_s_dim
\bool_if:NT \l__modiagram_atom_two_s_bool
{
\bool_if:NTF \l__modiagram_atom_left_bool
{
\dim_set_eq:NN
\l__modiagram_atom_xshift_dim
\l__modiagram_left_atom_position_dim
\dim_set_eq:NN
\l__modiagram_atom_left_two_s_dim
\l__modiagram_atom_two_s_dim
\bool_set_true:N \l__modiagram_two_s_left_bool
}
{
\dim_set:Nn \l__modiagram_atom_xshift_dim
{
\l__modiagram_left_atom_position_dim
+ \l__modiagram_inter_atom_distance_dim
}
\dim_set_eq:NN
\l__modiagram_atom_right_two_s_dim
\l__modiagram_atom_two_s_dim
\bool_set_true:N \l__modiagram_two_s_right_bool
}
\__modiagram_energy_range:N \l__modiagram_atom_two_s_dim
\__modiagram_node:n { inner~sep=0 , outer~sep=0 }
(2s
\bool_if:NTF \l__modiagram_atom_left_bool
{left}
{right}
)
at ( \l__modiagram_atom_xshift_dim , \l__modiagram_atom_two_s_dim )
{
\bool_if:NTF \l__modiagram_atom_left_bool
{
\__modiagram_get_electron_color:n {2sleft}
\__modiagram_get_electron_up:n {2sleft}
\__modiagram_get_electron_down:n {2sleft}
}
{
\__modiagram_get_electron_color:n {2sright}
\__modiagram_get_electron_up:n {2sright}
\__modiagram_get_electron_down:n {2sright}
}
\__modiagram_AO:ff
{ \tl_use:N \l__modiagram_AO_two_s_electron_tl }
{ \tl_use:N \l__modiagram_electron_current_color_tl }
} ;
\bool_if:NTF \l__modiagram_atom_left_bool
{ \__modiagram_get_orbital_label:n {2sleft} }
{ \__modiagram_get_orbital_label:n {2sright} }
}
}
% --------------------------------------------------------------------------- %
% 2p orbital
\dim_new:N \l__modiagram_atom_two_p_dim
\dim_new:N \l__modiagram_atom_left_two_p_dim
\dim_new:N \l__modiagram_atom_right_two_p_dim
\dim_new:N \l__modiagram_atom_px_shift_dim
\dim_new:N \l__modiagram_atom_py_shift_dim
\dim_new:N \l__modiagram_atom_pz_shift_dim
\tl_new:N \l__modiagram_AO_two_px_electron_tl
\tl_new:N \l__modiagram_AO_two_py_electron_tl
\tl_new:N \l__modiagram_AO_two_pz_electron_tl
\bool_new:N \l__modiagram_atom_two_p_bool
\bool_new:N \l__modiagram_two_p_left_bool
\bool_set_false:N \l__modiagram_two_p_left_bool
\bool_new:N \l__modiagram_two_p_right_bool
\bool_set_false:N \l__modiagram_two_p_right_bool
% read 2p argument
\cs_new_protected:Npn \__modiagram_two_p_set:n #1
{
\bool_set_true:N \l__modiagram_atom_two_p_bool
\tl_if_in:onTF {#1} {;}
{ \__modiagram_two_p_set_aux_i:n #1 \q_stop }
{
\tl_clear:N \l__modiagram_AO_two_px_electron_tl
\tl_clear:N \l__modiagram_AO_two_py_electron_tl
\tl_clear:N \l__modiagram_AO_two_pz_electron_tl
\tl_if_blank:nTF {#1}
{ \dim_set:Nn \l__modiagram_atom_two_p_dim { 5 cm } }
{ \dim_set:Nn \l__modiagram_atom_two_p_dim { #1 cm } }
}
}
\cs_new_protected:Npn \__modiagram_two_p_set_aux_i:n #1;#2 \q_stop
{
\tl_if_blank:nTF {#1}
{ \dim_set:Nn \l__modiagram_atom_two_p_dim { 5 cm } }
{ \dim_set:Nn \l__modiagram_atom_two_p_dim { #1 cm } }
\__modiagram_two_p_set_aux_ii:n {#2}
}
\NewDocumentCommand \__modiagram_two_p_set_aux_ii:n
{ > { \SplitArgument {2} {,} } m }
{ \__modiagram_two_p_set_aux_iii:nnn #1 }
\cs_set_nopar:Npn \__modiagram_two_p_set_aux_iii:nnn #1#2#3
{
\tl_if_blank:nF {#1} { \tl_set:Nn \l__modiagram_AO_two_px_electron_tl {#1} }
\tl_if_blank:nF {#2} { \tl_set:Nn \l__modiagram_AO_two_py_electron_tl {#2} }
\tl_if_blank:nF {#3} { \tl_set:Nn \l__modiagram_AO_two_pz_electron_tl {#3} }
}
% place the x, y, and z orbitals