ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/mattDisertation/oopse.tex
(Generate patch)

Comparing trunk/mattDisertation/oopse.tex (file contents):
Revision 1083 by mmeineke, Fri Mar 5 00:07:19 2004 UTC vs.
Revision 1089 by mmeineke, Mon Mar 8 22:15:54 2004 UTC

# Line 18 | Line 18 | In this chapter, I present and detail the capabilities
18   \section{\label{oopseSec:foreword}Foreword}
19  
20   In this chapter, I present and detail the capabilities of the open
21 < source simulation package {\sc oopse}. It is important to note, that a
22 < simulation package of this size and scope would not have been possible
21 > source simulation program {\sc oopse}. It is important to note that a
22 > simulation program of this size and scope would not have been possible
23   without the collaborative efforts of my colleagues: Charles
24   F.~Vardeman II, Teng Lin, Christopher J.~Fennell and J.~Daniel
25   Gezelter. Although my contributions to {\sc oopse} are major,
26   consideration of my work apart from the others would not give a
27 < complete description to the package's capabilities. As such, all
27 > complete description to the program's capabilities. As such, all
28   contributions to {\sc oopse} to date are presented in this chapter.
29  
30   Charles Vardeman is responsible for the parallelization of the long
# Line 70 | Line 70 | researchers try to develop techniques or energetic mod
70  
71   Despite their utility, problems with these packages arise when
72   researchers try to develop techniques or energetic models that the
73 < code was not originally designed to simulate. Examples of uncommonly
74 < implemented techniques and energetics include; dipole-dipole
75 < interactions, rigid body dynamics, and metallic embedded
76 < potentials. When faced with these obstacles, a researcher must either
77 < develop their own code or license and extend one of the commercial
78 < packages. What we have elected to do, is develop a package of
79 < simulation code capable of implementing the types of models upon which
80 < our research is based.
73 > code was not originally designed to simulate. Examples of techniques
74 > and energetics not commonly implemented include; dipole-dipole
75 > interactions, rigid body dynamics, and metallic potentials. When faced
76 > with these obstacles, a researcher must either develop their own code
77 > or license and extend one of the commercial packages. What we have
78 > elected to do is develop a body of simulation code capable of
79 > implementing the types of models upon which our research is based.
80  
81   In developing {\sc oopse}, we have adhered to the precepts of Open
82   Source development, and are releasing our source code with a
# Line 173 | Line 172 | maintained for each rigid body. At a minimum, the rota
172   each rigid body. In order to move between the space fixed and body
173   fixed coordinate axes, parameters describing the orientation must be
174   maintained for each rigid body. At a minimum, the rotation matrix
175 < (\textbf{A}) can be described by the three Euler angles ($\phi,
176 < \theta,$ and $\psi$), where the elements of \textbf{A} are composed of
175 > ($\mathsf{A}$) can be described by the three Euler angles ($\phi,
176 > \theta,$ and $\psi$), where the elements of $\mathsf{A}$ are composed of
177   trigonometric operations involving $\phi, \theta,$ and
178   $\psi$.\cite{Goldstein01} In order to avoid numerical instabilities
179   inherent in using the Euler angles, the four parameter ``quaternion''
180 < scheme is often used. The elements of \textbf{A} can be expressed as
180 > scheme is often used. The elements of $\mathsf{A}$ can be expressed as
181   arithmetic operations involving the four quaternions ($q_0, q_1, q_2,$
182   and $q_3$).\cite{allen87:csl} Use of quaternions also leads to
183   performance enhancements, particularly for very small
# Line 194 | Line 193 | molecule{
193  
194   \begin{lstlisting}[float,caption={[Defining rigid bodies]A sample definition of a rigid body},label={sch:rigidBody}]
195   molecule{
196 <  name = "TIP3P_water";
196 >  name = "TIP3P";
197 >  nAtoms = 3;
198 >  atom[0]{
199 >    type = "O_TIP3P";
200 >    position( 0.0, 0.0, -0.06556 );
201 >  }
202 >  atom[1]{
203 >    type = "H_TIP3P";
204 >    position( 0.0, 0.75695, 0.52032 );
205 >  }
206 >  atom[2]{
207 >    type = "H_TIP3P";
208 >    position( 0.0, -0.75695, 0.52032 );
209 >  }
210 >
211    nRigidBodies = 1;
212 <  rigidBody[0]{
213 <    nAtoms = 3;
214 <    atom[0]{
202 <      type = "O_TIP3P";
203 <      position( 0.0, 0.0, -0.06556 );    
204 <    }                                    
205 <    atom[1]{
206 <      type = "H_TIP3P";
207 <      position( 0.0, 0.75695, 0.52032 );
208 <    }
209 <    atom[2]{
210 <      type = "H_TIP3P";
211 <      position( 0.0, -0.75695, 0.52032 );
212 <    }
213 <    position( 0.0, 0.0, 0.0 );
214 <    orientation( 0.0, 0.0, 1.0 );
212 >  rigidBody[0]{
213 >    nMembers = 3;
214 >    members(0, 1, 2);
215    }
216   }
217   \end{lstlisting}
# Line 299 | Line 299 | As an example, lipid head-groups in {\sc duff} are rep
299   include a reaction field to mimic larger range interactions.
300  
301   As an example, lipid head-groups in {\sc duff} are represented as
302 < point dipole interaction sites. By placing a dipole at the head group
303 < center of mass, our model mimics the charge separation found in common
304 < phospholipids such as phosphatidylcholine.\cite{Cevc87} Additionally,
305 < a large Lennard-Jones site is located at the pseudoatom's center of
306 < mass. The model is illustrated by the red atom in
307 < Fig.~\ref{oopseFig:lipidModel}. The water model we use to complement
308 < the dipoles of the lipids is our reparameterization of the soft sticky
309 < dipole (SSD) model of Ichiye
302 > point dipole interaction sites. By placing a dipole at the head
303 > group's center of mass, our model mimics the charge separation found
304 > in common phospholipid head groups such as
305 > phosphatidylcholine.\cite{Cevc87} Additionally, a large Lennard-Jones
306 > site is located at the pseudoatom's center of mass. The model is
307 > illustrated by the red atom in Fig.~\ref{oopseFig:lipidModel}. The
308 > water model we use to complement the dipoles of the lipids is our
309 > reparameterization of the soft sticky dipole (SSD) model of Ichiye
310   \emph{et al.}\cite{liu96:new_model}
311  
312   \begin{figure}
313   \centering
314 < \includegraphics[width=\linewidth]{lipidModel.eps}
314 > \includegraphics[width=\linewidth]{twoChainFig.eps}
315   \caption[A representation of a lipid model in {\sc duff}]{A representation of the lipid model. $\phi$ is the torsion angle, $\theta$ %
316 < is the bend angle, $\mu$ is the dipole moment of the head group, and n
317 < is the chain length.}
316 > is the bend angle, and $\mu$ is the dipole moment of the head group.}
317   \label{oopseFig:lipidModel}
318   \end{figure}
319  
# Line 338 | Line 337 | illustrated in Scheme \ref{sch:DUFF}.
337   integrating the equations of motion. A simulation using {\sc duff} is
338   illustrated in Scheme \ref{sch:DUFF}.
339  
340 < \begin{lstlisting}[float,caption={[Invocation of {\sc duff}]Sample \texttt{.bass} file showing a simulation utilizing {\sc duff}},label={sch:DUFF}]
340 > \begin{lstlisting}[float,caption={[Invocation of {\sc duff}]A portion of a \texttt{.bass} file showing a simulation utilizing {\sc duff}},label={sch:DUFF}]
341  
342   #include "water.mdl"
343   #include "lipid.mdl"
# Line 580 | Line 579 | reference~\cite{Gezelter04}.
579   density corrected SSD models can be found in
580   reference~\cite{Gezelter04}.
581  
582 < \begin{lstlisting}[float,caption={[A simulation of {\sc ssd} water]An example file showing a simulation including {\sc ssd} water.},label={sch:ssd}]
582 > \begin{lstlisting}[float,caption={[A simulation of {\sc ssd} water]A portion of a \texttt{.bass} file showing a simulation including {\sc ssd} water.},label={sch:ssd}]
583  
584   #include "water.mdl"
585  
# Line 644 | Line 643 | metals Cu, Ag, Au, Ni, Pd, Pt and alloys of these meta
643   surrounding atom $i$ for both the density $\rho$ and pairwise $\phi$
644   interactions. Foiles \emph{et al}.~fit {\sc eam} potentials for the fcc
645   metals Cu, Ag, Au, Ni, Pd, Pt and alloys of these metals.\cite{FBD86}
646 < These fits, are included in {\sc oopse}.
646 > These fits are included in {\sc oopse}.
647  
648   \subsection{\label{oopseSec:pbc}Periodic Boundary Conditions}
649  
# Line 664 | Line 663 | size of the simulation box. $\mathsf{H}$ is defined:
663   \begin{equation}
664   \mathsf{H} = ( \mathbf{h}_x, \mathbf{h}_y, \mathbf{h}_z )
665   \end{equation}
666 < Where $\mathbf{h}_j$ is the column vector of the $j$th axis of the
666 > Where $\mathbf{h}_{\alpha}$ is the column vector of the $\alpha$ axis of the
667   box.  During the course of the simulation both the size and shape of
668   the box can be changed to allow volume fluctuations when constraining
669   the pressure.
# Line 679 | Line 678 | first convert it to its corresponding vector in box sp
678   lengths in the $\mathbf{h}_x$, $\mathbf{h}_y$, and $\mathbf{h}_z$
679   directions. To find the minimum image of a vector $\mathbf{r}$, we
680   first convert it to its corresponding vector in box space, and then,
681 < cast each element to lie on the in the range $[-0.5,0.5]$:
681 > cast each element to lie in the range $[-0.5,0.5]$:
682   \begin{equation}
683   s_{i}^{\prime}=s_{i}-\roundme(s_{i})
684   \end{equation}
685   Where $s_i$ is the $i$th element of $\mathbf{s}$, and
686 < $\roundme(s_i)$is given by
686 > $\roundme(s_i)$ is given by
687   \begin{equation}
688   \roundme(x) =
689          \begin{cases}
# Line 811 | Line 810 | output files.
810   entities are written out using quanternions, to save space in the
811   output files.
812  
813 < \begin{lstlisting}[float,caption={[The format of the coordinate files]Shows the format of the coordinate files. The fist line is the number of atoms. The second line begins with the time stamp followed by the three $\mathsf{H}$ column vectors. It is important to note, that for extended system ensembles, additional information pertinent to the integrators may be stored on this line as well.. The next lines are the atomic coordinates for all atoms in the system. First is the name followed by position, velocity, quanternions, and lastly angular velocities.},label=sch:dumpFormat]
813 > \begin{lstlisting}[float,caption={[The format of the coordinate files]Shows the format of the coordinate files. The fist line is the number of atoms. The second line begins with the time stamp followed by the three $\mathsf{H}$ column vectors. It is important to note, that for extended system ensembles, additional information pertinent to the integrators may be stored on this line as well. The next lines are the atomic coordinates for all atoms in the system. First is the name followed by position, velocity, quanternions, and lastly angular velocities.},label=sch:dumpFormat]
814  
815   nAtoms
816   time; Hxx Hyx Hzx; Hxy Hyy Hzy; Hxz Hyz Hzz;
# Line 867 | Line 866 | statistics file is denoted with the \texttt{.stat} fil
866  
867   \section{\label{oopseSec:mechanics}Mechanics}
868  
869 < \subsection{\label{oopseSec:integrate}Integrating the Equations of Motion: the Symplectic Step Integrator}
869 > \subsection{\label{oopseSec:integrate}Integrating the Equations of Motion: the
870 > DLM method}
871  
872 < Integration of the equations of motion was carried out using the
873 < symplectic splitting method proposed by Dullweber \emph{et
874 < al.}.\cite{Dullweber1997} The reason for the selection of this
875 < integrator, is the poor energy conservation of rigid body systems
876 < using quaternion dynamics. While quaternions work well for
877 < orientational motion in alternate ensembles, the microcanonical
878 < ensemble has a constant energy requirement that is quite sensitive to
879 < errors in the equations of motion. The original implementation of {\sc
880 < oopse} utilized quaternions for rotational motion propagation;
881 < however, a detailed investigation showed that they resulted in a
882 < steady drift in the total energy, something that has been observed by
883 < others.\cite{Laird97}
872 > The default method for integrating the equations of motion in {\sc
873 > oopse} is a velocity-Verlet version of the symplectic splitting method
874 > proposed by Dullweber, Leimkuhler and McLachlan
875 > (DLM).\cite{Dullweber1997} When there are no directional atoms or
876 > rigid bodies present in the simulation, this integrator becomes the
877 > standard velocity-Verlet integrator which is known to sample the
878 > microcanonical (NVE) ensemble.\cite{Frenkel1996}
879  
880 + Previous integration methods for orientational motion have problems
881 + that are avoided in the DLM method.  Direct propagation of the Euler
882 + angles has a known $1/\sin\theta$ divergence in the equations of
883 + motion for $\phi$ and $\psi$,\cite{allen87:csl} leading to
884 + numerical instabilities any time one of the directional atoms or rigid
885 + bodies has an orientation near $\theta=0$ or $\theta=\pi$.  More
886 + modern quaternion-based integration methods have relatively poor
887 + energy conservation.  While quaternions work well for orientational
888 + motion in other ensembles, the microcanonical ensemble has a
889 + constant energy requirement that is quite sensitive to errors in the
890 + equations of motion.  An earlier implementation of {\sc oopse}
891 + utilized quaternions for propagation of rotational motion; however, a
892 + detailed investigation showed that they resulted in a steady drift in
893 + the total energy, something that has been observed by
894 + Laird {\it et al.}\cite{Laird97}      
895 +
896   The key difference in the integration method proposed by Dullweber
897 < \emph{et al}.~({\sc dlm}) is that the entire rotation matrix is propagated from
898 < one time step to the next. In the past, this would not have been a
899 < feasible option, since the rotation matrix for a single body is nine
900 < elements long as opposed to three or four elements for Euler angles
901 < and quaternions respectively. System memory has become much less of an
902 < issue in recent times, and the {\sc dlm} method has used memory in
903 < exchange for substantial benefits in energy conservation.
897 > \emph{et al.} is that the entire $3 \times 3$ rotation matrix is
898 > propagated from one time step to the next. In the past, this would not
899 > have been feasible, since the rotation matrix for a single body has
900 > nine elements compared with the more memory-efficient methods (using
901 > three Euler angles or 4 quaternions).  Computer memory has become much
902 > less costly in recent years, and this can be translated into
903 > substantial benefits in energy conservation.
904  
905 < The {\sc dlm} method allows for Verlet style integration of both
906 < linear and angular motion of rigid bodies. In the integration method,
907 < the orientational propagation involves a sequence of matrix
908 < evaluations to update the rotation matrix.\cite{Dullweber1997} These
909 < matrix rotations are more costly computationally than the simpler
910 < arithmetic quaternion propagation. With the same time step, a 1000 SSD
911 < particle simulation shows an average 7\% increase in computation time
912 < using the {\sc dlm} method in place of quaternions. This cost is more
913 < than justified when comparing the energy conservation of the two
914 < methods as illustrated in Fig.~\ref{timestep}.
905 > The basic equations of motion being integrated are derived from the
906 > Hamiltonian for conservative systems containing rigid bodies,
907 > \begin{equation}
908 > H = \sum_{i} \left( \frac{1}{2} m_i {\bf v}_i^T \cdot {\bf v}_i +
909 > \frac{1}{2} {\bf j}_i^T \cdot \overleftrightarrow{\mathsf{I}}_i^{-1} \cdot
910 > {\bf j}_i \right) +
911 > V\left(\left\{{\bf r}\right\}, \left\{\mathsf{A}\right\}\right)
912 > \end{equation}
913 > Where ${\bf r}_i$ and ${\bf v}_i$ are the cartesian position vector
914 > and velocity of the center of mass of particle $i$, and ${\bf j}_i$,
915 > $\overleftrightarrow{\mathsf{I}}_i$ are the body-fixed angular
916 > momentum and moment of inertia tensor respectively, and the
917 > superscript $T$ denotes the transpose of the vector.  $\mathsf{A}_i$
918 > is the $3 \times 3$ rotation matrix describing the instantaneous
919 > orientation of the particle.  $V$ is the potential energy function
920 > which may depend on both the positions $\left\{{\bf r}\right\}$ and
921 > orientations $\left\{\mathsf{A}\right\}$ of all particles.  The
922 > equations of motion for the particle centers of mass are derived from
923 > Hamilton's equations and are quite simple,
924 > \begin{eqnarray}
925 > \dot{{\bf r}} & = & {\bf v} \\
926 > \dot{{\bf v}} & = & \frac{{\bf f}}{m}
927 > \end{eqnarray}
928 > where ${\bf f}$ is the instantaneous force on the center of mass
929 > of the particle,
930 > \begin{equation}
931 > {\bf f} = - \frac{\partial}{\partial
932 > {\bf r}} V(\left\{{\bf r}(t)\right\}, \left\{\mathsf{A}(t)\right\}).
933 > \end{equation}
934 >
935 > The equations of motion for the orientational degrees of freedom are
936 > \begin{eqnarray}
937 > \dot{\mathsf{A}} & = & \mathsf{A} \cdot
938 > \mbox{ skew}\left(\overleftrightarrow{\mathsf{I}}^{-1} \cdot {\bf j}\right) \\
939 > \dot{{\bf j}} & = & {\bf j} \times \left( \overleftrightarrow{\mathsf{I}}^{-1}
940 > \cdot {\bf j} \right) - \mbox{ rot}\left(\mathsf{A}^{T} \cdot \frac{\partial
941 > V}{\partial \mathsf{A}} \right)
942 > \end{eqnarray}
943 > In these equations of motion, the $\mbox{skew}$ matrix of a vector
944 > ${\bf v} = \left( v_1, v_2, v_3 \right)$ is defined:
945 > \begin{equation}
946 > \mbox{skew}\left( {\bf v} \right) := \left(
947 > \begin{array}{ccc}
948 > 0 & v_3 & - v_2 \\
949 > -v_3 & 0 & v_1 \\
950 > v_2 & -v_1 & 0
951 > \end{array}
952 > \right)
953 > \end{equation}
954 > The $\mbox{rot}$ notation refers to the mapping of the $3 \times 3$
955 > rotation matrix to a vector of orientations by first computing the
956 > skew-symmetric part $\left(\mathsf{A} - \mathsf{A}^{T}\right)$ and
957 > then associating this with a length 3 vector by inverting the
958 > $\mbox{skew}$ function above:
959 > \begin{equation}
960 > \mbox{rot}\left(\mathsf{A}\right) := \mbox{ skew}^{-1}\left(\mathsf{A}
961 > - \mathsf{A}^{T} \right)
962 > \end{equation}
963 > Written this way, the $\mbox{rot}$ operation creates a set of
964 > conjugate angle coordinates to the body-fixed angular momenta
965 > represented by ${\bf j}$.  This equation of motion for angular momenta
966 > is equivalent to the more familiar body-fixed forms,
967 > \begin{eqnarray}
968 > \dot{j_{x}} & = & \tau^b_x(t)  +
969 > \left(\overleftrightarrow{\mathsf{I}}_{yy} - \overleftrightarrow{\mathsf{I}}_{zz} \right) j_y j_z \\
970 > \dot{j_{y}} & = & \tau^b_y(t) +
971 > \left(\overleftrightarrow{\mathsf{I}}_{zz} - \overleftrightarrow{\mathsf{I}}_{xx} \right) j_z j_x \\
972 > \dot{j_{z}} & = & \tau^b_z(t) +
973 > \left(\overleftrightarrow{\mathsf{I}}_{xx} - \overleftrightarrow{\mathsf{I}}_{yy} \right) j_x j_y
974 > \end{eqnarray}
975 > which utilize the body-fixed torques, ${\bf \tau}^b$. Torques are
976 > most easily derived in the space-fixed frame,
977 > \begin{equation}
978 > {\bf \tau}^b(t) = \mathsf{A}(t) \cdot {\bf \tau}^s(t)
979 > \end{equation}
980 > where the torques are either derived from the forces on the
981 > constituent atoms of the rigid body, or for directional atoms,
982 > directly from derivatives of the potential energy,
983 > \begin{equation}
984 > {\bf \tau}^s(t) = - \hat{\bf u}(t) \times \left( \frac{\partial}
985 > {\partial \hat{\bf u}} V\left(\left\{ {\bf r}(t) \right\}, \left\{
986 > \mathsf{A}(t) \right\}\right) \right).
987 > \end{equation}
988 > Here $\hat{\bf u}$ is a unit vector pointing along the principal axis
989 > of the particle in the space-fixed frame.
990 >
991 > The DLM method uses a Trotter factorization of the orientational
992 > propagator.  This has three effects:
993 > \begin{enumerate}
994 > \item the integrator is area-preserving in phase space (i.e. it is
995 > {\it symplectic}),
996 > \item the integrator is time-{\it reversible}, making it suitable for Hybrid
997 > Monte Carlo applications, and
998 > \item the error for a single time step is of order $\mathcal{O}\left(h^4\right)$
999 > for timesteps of length $h$.
1000 > \end{enumerate}
1001 >
1002 > The integration of the equations of motion is carried out in a
1003 > velocity-Verlet style 2-part algorithm, where $h= \delta t$:
1004 >
1005 > {\tt moveA:}
1006 > \begin{align*}
1007 > {\bf v}\left(t + h / 2\right)  &\leftarrow  {\bf v}(t)
1008 >        + \frac{h}{2} \left( {\bf f}(t) / m \right) \\
1009 > %
1010 > {\bf r}(t + h) &\leftarrow {\bf r}(t)
1011 >        + h  {\bf v}\left(t + h / 2 \right) \\
1012 > %
1013 > {\bf j}\left(t + h / 2 \right)  &\leftarrow {\bf j}(t)
1014 >        + \frac{h}{2} {\bf \tau}^b(t)  \\
1015 > %
1016 > \mathsf{A}(t + h) &\leftarrow \mathrm{rotate}\left( h {\bf j}
1017 >        (t + h / 2) \cdot \overleftrightarrow{\mathsf{I}}^{-1} \right)
1018 > \end{align*}
1019  
1020 + In this context, the $\mathrm{rotate}$ function is the reversible product
1021 + of the three body-fixed rotations,
1022 + \begin{equation}
1023 + \mathrm{rotate}({\bf a}) = \mathsf{G}_x(a_x / 2) \cdot
1024 + \mathsf{G}_y(a_y / 2) \cdot \mathsf{G}_z(a_z) \cdot \mathsf{G}_y(a_y /
1025 + 2) \cdot \mathsf{G}_x(a_x /2)
1026 + \end{equation}
1027 + where each rotational propagator, $\mathsf{G}_\alpha(\theta)$, rotates
1028 + both the rotation matrix ($\mathsf{A}$) and the body-fixed angular
1029 + momentum (${\bf j}$) by an angle $\theta$ around body-fixed axis
1030 + $\alpha$,
1031 + \begin{equation}
1032 + \mathsf{G}_\alpha( \theta ) = \left\{
1033 + \begin{array}{lcl}
1034 + \mathsf{A}(t) & \leftarrow & \mathsf{A}(0) \cdot \mathsf{R}_\alpha(\theta)^T \\
1035 + {\bf j}(t) & \leftarrow & \mathsf{R}_\alpha(\theta) \cdot {\bf j}(0)
1036 + \end{array}
1037 + \right.
1038 + \end{equation}
1039 + $\mathsf{R}_\alpha$ is a quadratic approximation to
1040 + the single-axis rotation matrix.  For example, in the small-angle
1041 + limit, the rotation matrix around the body-fixed x-axis can be
1042 + approximated as
1043 + \begin{equation}
1044 + \mathsf{R}_x(\theta) \approx \left(
1045 + \begin{array}{ccc}
1046 + 1 & 0 & 0 \\
1047 + 0 & \frac{1-\theta^2 / 4}{1 + \theta^2 / 4}  & -\frac{\theta}{1+
1048 + \theta^2 / 4} \\
1049 + 0 & \frac{\theta}{1+
1050 + \theta^2 / 4} & \frac{1-\theta^2 / 4}{1 + \theta^2 / 4}
1051 + \end{array}
1052 + \right).
1053 + \end{equation}
1054 + All other rotations follow in a straightforward manner.
1055 +
1056 + After the first part of the propagation, the forces and body-fixed
1057 + torques are calculated at the new positions and orientations
1058 +
1059 + {\tt doForces:}
1060 + \begin{align*}
1061 + {\bf f}(t + h) &\leftarrow  
1062 +        - \left(\frac{\partial V}{\partial {\bf r}}\right)_{{\bf r}(t + h)} \\
1063 + %
1064 + {\bf \tau}^{s}(t + h) &\leftarrow {\bf u}(t + h)
1065 +        \times \frac{\partial V}{\partial {\bf u}} \\
1066 + %
1067 + {\bf \tau}^{b}(t + h) &\leftarrow \mathsf{A}(t + h)
1068 +        \cdot {\bf \tau}^s(t + h)
1069 + \end{align*}
1070 +
1071 + {\sc oopse} automatically updates ${\bf u}$ when the rotation matrix
1072 + $\mathsf{A}$ is calculated in {\tt moveA}.  Once the forces and
1073 + torques have been obtained at the new time step, the velocities can be
1074 + advanced to the same time value.
1075 +
1076 + {\tt moveB:}
1077 + \begin{align*}
1078 + {\bf v}\left(t + h \right)  &\leftarrow  {\bf v}\left(t + h / 2 \right)
1079 +        + \frac{h}{2} \left( {\bf f}(t + h) / m \right) \\
1080 + %
1081 + {\bf j}\left(t + h \right)  &\leftarrow {\bf j}\left(t + h / 2 \right)
1082 +        + \frac{h}{2} {\bf \tau}^b(t + h)  
1083 + \end{align*}
1084 +
1085 + The matrix rotations used in the DLM method end up being more costly
1086 + computationally than the simpler arithmetic quaternion
1087 + propagation. With the same time step, a 1000-molecule water simulation
1088 + shows an average 7\% increase in computation time using the DLM method
1089 + in place of quaternions. This cost is more than justified when
1090 + comparing the energy conservation of the two methods as illustrated in
1091 + Fig.~\ref{timestep}.
1092 +
1093   \begin{figure}
1094   \centering
1095   \includegraphics[width=\linewidth]{timeStep.eps}
1096 < \caption[Energy conservation for quaternion versus {\sc dlm} dynamics]{Energy conservation using quaternion based integration versus
1097 < the {\sc dlm} method with
1098 < increasing time step. For each time step, the dotted line is total
1099 < energy using the {\sc dlm} integrator, and the solid line comes
1100 < from the quaternion integrator. The larger time step plots are shifted
1101 < up from the true energy baseline for clarity.}
1096 > \caption[Energy conservation for quaternion versus DLM dynamics]{Energy conservation using quaternion based integration versus
1097 > the method proposed by Dullweber \emph{et al.} with increasing time
1098 > step. For each time step, the dotted line is total energy using the
1099 > DLM integrator, and the solid line comes from the quaternion
1100 > integrator. The larger time step plots are shifted up from the true
1101 > energy baseline for clarity.}
1102   \label{timestep}
1103   \end{figure}
1104  
1105   In Fig.~\ref{timestep}, the resulting energy drift at various time
1106 < steps for both the {\sc dlm} and quaternion integration schemes
1107 < is compared. All of the 1000 SSD particle simulations started with the
1106 > steps for both the DLM and quaternion integration schemes is
1107 > compared. All of the 1000 molecule water simulations started with the
1108   same configuration, and the only difference was the method for
1109   handling rotational motion. At time steps of 0.1 and 0.5 fs, both
1110 < methods for propagating particle rotation conserve energy fairly well,
1110 > methods for propagating molecule rotation conserve energy fairly well,
1111   with the quaternion method showing a slight energy drift over time in
1112   the 0.5 fs time step simulation. At time steps of 1 and 2 fs, the
1113 < energy conservation benefits of the {\sc dlm} method are clearly
1113 > energy conservation benefits of the DLM method are clearly
1114   demonstrated. Thus, while maintaining the same degree of energy
1115   conservation, one can take considerably longer time steps, leading to
1116   an overall reduction in computation time.
1117  
1118 < Energy drift in these SSD particle simulations was unnoticeable for
1119 < time steps up to three femtoseconds. A slight energy drift on the
932 < order of 0.012 kcal/mol per nanosecond was observed at a time step of
933 < four femtoseconds, and as expected, this drift increases dramatically
934 < with increasing time step.
1118 > There is only one specific keyword relevant to the default integrator,
1119 > and that is the time step for integrating the equations of motion.
1120  
1121 + \begin{center}
1122 + \begin{tabular}{llll}
1123 + {\bf variable} & {\bf {\tt .bass} keyword} & {\bf units} & {\bf
1124 + default value} \\  
1125 + $h$ & {\tt dt = 2.0;} & fs & none
1126 + \end{tabular}
1127 + \end{center}
1128  
1129   \subsection{\label{sec:extended}Extended Systems for other Ensembles}
1130  
1131 + {\sc oopse} implements a number of extended system integrators for
1132 + sampling from other ensembles relevant to chemical physics.  The
1133 + integrator can selected with the {\tt ensemble} keyword in the
1134 + {\tt .bass} file:
1135  
1136 < {\sc oopse} implements a
1136 > \begin{center}
1137 > \begin{tabular}{lll}
1138 > {\bf Integrator} & {\bf Ensemble} & {\bf {\tt .bass} line} \\
1139 > NVE & microcanonical & {\tt ensemble = NVE; } \\
1140 > NVT & canonical & {\tt ensemble = NVT; } \\
1141 > NPTi & isobaric-isothermal & {\tt ensemble = NPTi;} \\
1142 >  &  (with isotropic volume changes) & \\
1143 > NPTf & isobaric-isothermal & {\tt ensemble = NPTf;} \\
1144 >  & (with changes to box shape) & \\
1145 > NPTxyz & approximate isobaric-isothermal & {\tt ensemble = NPTxyz;} \\
1146 > &  (with separate barostats on each box dimension) & \\
1147 > \end{tabular}
1148 > \end{center}
1149  
1150 + The relatively well-known Nos\'e-Hoover thermostat\cite{Hoover85} is
1151 + implemented in {\sc oopse}'s NVT integrator.  This method couples an
1152 + extra degree of freedom (the thermostat) to the kinetic energy of the
1153 + system, and has been shown to sample the canonical distribution in the
1154 + system degrees of freedom while conserving a quantity that is, to
1155 + within a constant, the Helmholtz free energy.\cite{melchionna93}
1156  
1157 < \subsection{\label{oopseSec:noseHooverThermo}Nose-Hoover Thermostatting}
1157 > NPT algorithms attempt to maintain constant pressure in the system by
1158 > coupling the volume of the system to a barostat.  {\sc oopse} contains
1159 > three different constant pressure algorithms.  The first two, NPTi and
1160 > NPTf have been shown to conserve a quantity that is, to within a
1161 > constant, the Gibbs free energy.\cite{melchionna93} The Melchionna
1162 > modification to the Hoover barostat is implemented in both NPTi and
1163 > NPTf.  NPTi allows only isotropic changes in the simulation box, while
1164 > box {\it shape} variations are allowed in NPTf.  The NPTxyz integrator
1165 > has {\it not} been shown to sample from the isobaric-isothermal
1166 > ensemble.  It is useful, however, in that it maintains orthogonality
1167 > for the axes of the simulation box while attempting to equalize
1168 > pressure along the three perpendicular directions in the box.
1169  
1170 < To mimic the effects of being in a constant temperature ({\sc nvt})
1171 < ensemble, {\sc oopse} uses the Nose-Hoover extended system
1172 < approach.\cite{Hoover85} In this method, the equations of motion for
1173 < the particle positions and velocities are
1170 > Each of the extended system integrators requires additional keywords
1171 > to set target values for the thermodynamic state variables that are
1172 > being held constant.  Keywords are also required to set the
1173 > characteristic decay times for the dynamics of the extended
1174 > variables.
1175 >
1176 > \begin{center}
1177 > \begin{tabular}{llll}
1178 > {\bf variable} & {\bf {\tt .bass} keyword} & {\bf units} & {\bf
1179 > default value} \\  
1180 > $T_{\mathrm{target}}$ & {\tt targetTemperature = 300;} &  K & none \\
1181 > $P_{\mathrm{target}}$ & {\tt targetPressure = 1;} & atm & none \\
1182 > $\tau_T$ & {\tt tauThermostat = 1e3;} & fs & none \\
1183 > $\tau_B$ & {\tt tauBarostat = 5e3;} & fs  & none \\
1184 >         & {\tt resetTime = 200;} & fs & none \\
1185 >         & {\tt useInitialExtendedSystemState = true;} & logical &
1186 > true
1187 > \end{tabular}
1188 > \end{center}
1189 >
1190 > Two additional keywords can be used to either clear the extended
1191 > system variables periodically ({\tt resetTime}), or to maintain the
1192 > state of the extended system variables between simulations ({\tt
1193 > useInitialExtendedSystemState}).  More details on these variables
1194 > and their use in the integrators follows below.
1195 >
1196 > \subsection{\label{oopseSec:noseHooverThermo}Nos\'{e}-Hoover Thermostatting}
1197 >
1198 > The Nos\'e-Hoover equations of motion are given by\cite{Hoover85}
1199   \begin{eqnarray}
1200   \dot{{\bf r}} & = & {\bf v} \\
1201 < \dot{{\bf v}} & = & \frac{{\bf f}}{m} - \chi {\bf v}
1201 > \dot{{\bf v}} & = & \frac{{\bf f}}{m} - \chi {\bf v} \\
1202 > \dot{\mathsf{A}} & = & \mathsf{A} \cdot
1203 > \mbox{ skew}\left(\overleftrightarrow{\mathsf{I}}^{-1} \cdot {\bf j}\right) \\
1204 > \dot{{\bf j}} & = & {\bf j} \times \left( \overleftrightarrow{\mathsf{I}}^{-1}
1205 > \cdot {\bf j} \right) - \mbox{ rot}\left(\mathsf{A}^{T} \cdot \frac{\partial
1206 > V}{\partial \mathsf{A}} \right) - \chi {\bf j}
1207   \label{eq:nosehoovereom}
1208   \end{eqnarray}
1209  
1210   $\chi$ is an ``extra'' variable included in the extended system, and
1211   it is propagated using the first order equation of motion
1212   \begin{equation}
1213 < \dot{\chi} = \frac{1}{\tau_{T}} \left( \frac{T}{T_{target}} - 1 \right)
1213 > \dot{\chi} = \frac{1}{\tau_{T}^2} \left( \frac{T}{T_{\mathrm{target}}} - 1 \right).
1214   \label{eq:nosehooverext}
1215   \end{equation}
961 where $T_{target}$ is the target temperature for the simulation, and
962 $\tau_{T}$ is a time constant for the thermostat.  
1216  
1217 < To select the Nose-Hoover {\sc nvt} ensemble, the {\tt ensemble = NVT;}
1218 < command would be used in the simulation's {\sc bass} file.  There is
1219 < some subtlety in choosing values for $\tau_{T}$, and it is usually set
1220 < to values of a few ps.  Within a {\sc bass} file, $\tau_{T}$ could be
1221 < set to 1 ps using the {\tt tauThermostat = 1000; } command.
1217 > The instantaneous temperature $T$ is proportional to the total kinetic
1218 > energy (both translational and orientational) and is given by
1219 > \begin{equation}
1220 > T = \frac{2 K}{f k_B}
1221 > \end{equation}
1222 > Here, $f$ is the total number of degrees of freedom in the system,
1223 > \begin{equation}
1224 > f = 3 N + 3 N_{\mathrm{orient}} - N_{\mathrm{constraints}}
1225 > \end{equation}
1226 > and $K$ is the total kinetic energy,
1227 > \begin{equation}
1228 > K = \sum_{i=1}^{N} \frac{1}{2} m_i {\bf v}_i^T \cdot {\bf v}_i +
1229 > \sum_{i=1}^{N_{\mathrm{orient}}}  \frac{1}{2} {\bf j}_i^T \cdot
1230 > \overleftrightarrow{\mathsf{I}}_i^{-1} \cdot {\bf j}_i
1231 > \end{equation}
1232 >
1233 > In eq.(\ref{eq:nosehooverext}), $\tau_T$ is the time constant for
1234 > relaxation of the temperature to the target value.  To set values for
1235 > $\tau_T$ or $T_{\mathrm{target}}$ in a simulation, one would use the
1236 > {\tt tauThermostat} and {\tt targetTemperature} keywords in the {\tt
1237 > .bass} file.  The units for {\tt tauThermostat} are fs, and the units
1238 > for the {\tt targetTemperature} are degrees K.   The integration of
1239 > the equations of motion is carried out in a velocity-Verlet style 2
1240 > part algorithm:
1241 >
1242 > {\tt moveA:}
1243 > \begin{align*}
1244 > T(t) &\leftarrow \left\{{\bf v}(t)\right\}, \left\{{\bf j}(t)\right\} \\
1245 > %
1246 > {\bf v}\left(t + h / 2\right)  &\leftarrow {\bf v}(t)
1247 >        + \frac{h}{2} \left( \frac{{\bf f}(t)}{m} - {\bf v}(t)
1248 >        \chi(t)\right) \\
1249 > %
1250 > {\bf r}(t + h) &\leftarrow {\bf r}(t)
1251 >        + h {\bf v}\left(t + h / 2 \right) \\
1252 > %
1253 > {\bf j}\left(t + h / 2 \right)  &\leftarrow {\bf j}(t)
1254 >        + \frac{h}{2} \left( {\bf \tau}^b(t) - {\bf j}(t)
1255 >        \chi(t) \right) \\
1256 > %
1257 > \mathsf{A}(t + h) &\leftarrow \mathrm{rotate}
1258 >        \left(h * {\bf j}(t + h / 2)
1259 >        \overleftrightarrow{\mathsf{I}}^{-1} \right) \\
1260 > %
1261 > \chi\left(t + h / 2 \right) &\leftarrow \chi(t)
1262 >        + \frac{h}{2 \tau_T^2} \left( \frac{T(t)}
1263 >        {T_{\mathrm{target}}} - 1 \right)
1264 > \end{align*}
1265  
1266 + Here $\mathrm{rotate}(h * {\bf j}
1267 + \overleftrightarrow{\mathsf{I}}^{-1})$ is the same symplectic Trotter
1268 + factorization of the three rotation operations that was discussed in
1269 + the section on the DLM integrator.  Note that this operation modifies
1270 + both the rotation matrix $\mathsf{A}$ and the angular momentum ${\bf
1271 + j}$.  {\tt moveA} propagates velocities by a half time step, and
1272 + positional degrees of freedom by a full time step.  The new positions
1273 + (and orientations) are then used to calculate a new set of forces and
1274 + torques in exactly the same way they are calculated in the {\tt
1275 + doForces} portion of the DLM integrator.
1276 +
1277 + Once the forces and torques have been obtained at the new time step,
1278 + the temperature, velocities, and the extended system variable can be
1279 + advanced to the same time value.
1280 +
1281 + {\tt moveB:}
1282 + \begin{align*}
1283 + T(t + h) &\leftarrow \left\{{\bf v}(t + h)\right\},
1284 +        \left\{{\bf j}(t + h)\right\} \\
1285 + %
1286 + \chi\left(t + h \right) &\leftarrow \chi\left(t + h /
1287 +        2 \right) + \frac{h}{2 \tau_T^2} \left( \frac{T(t+h)}
1288 +        {T_{\mathrm{target}}} - 1 \right) \\
1289 + %
1290 + {\bf v}\left(t + h \right)  &\leftarrow {\bf v}\left(t
1291 +        + h / 2 \right) + \frac{h}{2} \left(
1292 +        \frac{{\bf f}(t + h)}{m} - {\bf v}(t + h)
1293 +        \chi(t h)\right) \\
1294 + %
1295 + {\bf j}\left(t + h \right) &\leftarrow {\bf j}\left(t
1296 +        + h / 2 \right) + \frac{h}{2}
1297 +        \left( {\bf \tau}^b(t + h) - {\bf j}(t + h)
1298 +        \chi(t + h) \right)
1299 + \end{align*}
1300 +
1301 + Since ${\bf v}(t + h)$ and ${\bf j}(t + h)$ are required to caclculate
1302 + $T(t + h)$ as well as $\chi(t + h)$, they indirectly depend on their
1303 + own values at time $t + h$.  {\tt moveB} is therefore done in an
1304 + iterative fashion until $\chi(t + h)$ becomes self-consistent.  The
1305 + relative tolerance for the self-consistency check defaults to a value
1306 + of $\mbox{10}^{-6}$, but {\sc oopse} will terminate the iteration
1307 + after 4 loops even if the consistency check has not been satisfied.
1308 +
1309 + The Nos\'e-Hoover algorithm is known to conserve a Hamiltonian for the
1310 + extended system that is, to within a constant, identical to the
1311 + Helmholtz free energy,\cite{melchionna93}
1312 + \begin{equation}
1313 + H_{\mathrm{NVT}} = V + K + f k_B T_{\mathrm{target}} \left(
1314 + \frac{\tau_{T}^2 \chi^2(t)}{2} + \int_{0}^{t} \chi(t^\prime) dt^\prime
1315 + \right)
1316 + \end{equation}
1317 + Poor choices of $h$ or $\tau_T$ can result in non-conservation
1318 + of $H_{\mathrm{NVT}}$, so the conserved quantity is maintained in the
1319 + last column of the {\tt .stat} file to allow checks on the quality of
1320 + the integration.
1321 +
1322 + Bond constraints are applied at the end of both the {\tt moveA} and
1323 + {\tt moveB} portions of the algorithm.  Details on the constraint
1324 + algorithms are given in section \ref{oopseSec:rattle}.
1325 +
1326 + \subsection{\label{sec:NPTi}Constant-pressure integration with
1327 + isotropic box deformations (NPTi)}
1328 +
1329 + To carry out isobaric-isothermal ensemble calculations {\sc oopse}
1330 + implements the Melchionna modifications to the Nos\'e-Hoover-Andersen
1331 + equations of motion,\cite{melchionna93}
1332 +
1333 + \begin{eqnarray}
1334 + \dot{{\bf r}} & = & {\bf v} + \eta \left( {\bf r} - {\bf R}_0 \right) \\
1335 + \dot{{\bf v}} & = & \frac{{\bf f}}{m} - (\eta + \chi) {\bf v} \\
1336 + \dot{\mathsf{A}} & = & \mathsf{A} \cdot
1337 + \mbox{ skew}\left(\overleftrightarrow{I}^{-1} \cdot {\bf j}\right) \\
1338 + \dot{{\bf j}} & = & {\bf j} \times \left( \overleftrightarrow{I}^{-1}
1339 + \cdot {\bf j} \right) - \mbox{ rot}\left(\mathsf{A}^{T} \cdot \frac{\partial
1340 + V}{\partial \mathsf{A}} \right) - \chi {\bf j} \\
1341 + \dot{\chi} & = & \frac{1}{\tau_{T}^2} \left(
1342 + \frac{T}{T_{\mathrm{target}}} - 1 \right) \\
1343 + \dot{\eta} & = & \frac{1}{\tau_{B}^2 f k_B T_{\mathrm{target}}} V \left( P -
1344 + P_{\mathrm{target}} \right) \\
1345 + \dot{\mathcal{V}} & = & 3 \mathcal{V} \eta
1346 + \label{eq:melchionna1}
1347 + \end{eqnarray}
1348 +
1349 + $\chi$ and $\eta$ are the ``extra'' degrees of freedom in the extended
1350 + system.  $\chi$ is a thermostat, and it has the same function as it
1351 + does in the Nos\'e-Hoover NVT integrator.  $\eta$ is a barostat which
1352 + controls changes to the volume of the simulation box.  ${\bf R}_0$ is
1353 + the location of the center of mass for the entire system, and
1354 + $\mathcal{V}$ is the volume of the simulation box.  At any time, the
1355 + volume can be calculated from the determinant of the matrix which
1356 + describes the box shape:
1357 + \begin{equation}
1358 + \mathcal{V} = \det(\mathsf{H})
1359 + \end{equation}
1360 +
1361 + The NPTi integrator requires an instantaneous pressure. This quantity
1362 + is calculated via the pressure tensor,
1363 + \begin{equation}
1364 + \overleftrightarrow{\mathsf{P}}(t) = \frac{1}{\mathcal{V}(t)} \left(
1365 + \sum_{i=1}^{N} m_i {\bf v}_i(t) \otimes {\bf v}_i(t) \right) +
1366 + \overleftrightarrow{\mathsf{W}}(t)
1367 + \end{equation}
1368 + The kinetic contribution to the pressure tensor utilizes the {\it
1369 + outer} product of the velocities denoted by the $\otimes$ symbol.  The
1370 + stress tensor is calculated from another outer product of the
1371 + inter-atomic separation vectors (${\bf r}_{ij} = {\bf r}_j - {\bf
1372 + r}_i$) with the forces between the same two atoms,
1373 + \begin{equation}
1374 + \overleftrightarrow{\mathsf{W}}(t) = \sum_{i} \sum_{j>i} {\bf r}_{ij}(t)
1375 + \otimes {\bf f}_{ij}(t)
1376 + \end{equation}
1377 + The instantaneous pressure is then simply obtained from the trace of
1378 + the Pressure tensor,
1379 + \begin{equation}
1380 + P(t) = \frac{1}{3} \mathrm{Tr} \left( \overleftrightarrow{\mathsf{P}}(t)
1381 + \right)
1382 + \end{equation}
1383 +
1384 + In eq.(\ref{eq:melchionna1}), $\tau_B$ is the time constant for
1385 + relaxation of the pressure to the target value.  To set values for
1386 + $\tau_B$ or $P_{\mathrm{target}}$ in a simulation, one would use the
1387 + {\tt tauBarostat} and {\tt targetPressure} keywords in the {\tt .bass}
1388 + file.  The units for {\tt tauBarostat} are fs, and the units for the
1389 + {\tt targetPressure} are atmospheres.  Like in the NVT integrator, the
1390 + integration of the equations of motion is carried out in a
1391 + velocity-Verlet style 2 part algorithm:
1392 +
1393 + {\tt moveA:}
1394 + \begin{align*}
1395 + T(t) &\leftarrow \left\{{\bf v}(t)\right\}, \left\{{\bf j}(t)\right\} \\
1396 + %
1397 + P(t) &\leftarrow \left\{{\bf r}(t)\right\}, \left\{{\bf v}(t)\right\} \\
1398 + %
1399 + {\bf v}\left(t + h / 2\right)  &\leftarrow {\bf v}(t)
1400 +        + \frac{h}{2} \left( \frac{{\bf f}(t)}{m} - {\bf v}(t)
1401 +        \left(\chi(t) + \eta(t) \right) \right) \\
1402 + %
1403 + {\bf j}\left(t + h / 2 \right)  &\leftarrow {\bf j}(t)
1404 +        + \frac{h}{2} \left( {\bf \tau}^b(t) - {\bf j}(t)
1405 +        \chi(t) \right) \\
1406 + %
1407 + \mathsf{A}(t + h) &\leftarrow \mathrm{rotate}\left(h *
1408 +        {\bf j}(t + h / 2) \overleftrightarrow{\mathsf{I}}^{-1}
1409 +        \right) \\
1410 + %
1411 + \chi\left(t + h / 2 \right) &\leftarrow \chi(t) +
1412 +        \frac{h}{2 \tau_T^2} \left( \frac{T(t)}{T_{\mathrm{target}}} - 1
1413 +        \right) \\
1414 + %
1415 + \eta(t + h / 2) &\leftarrow \eta(t) + \frac{h
1416 +        \mathcal{V}(t)}{2 N k_B T(t) \tau_B^2} \left( P(t)
1417 +        - P_{\mathrm{target}} \right) \\
1418 + %
1419 + {\bf r}(t + h) &\leftarrow {\bf r}(t) + h
1420 +        \left\{ {\bf v}\left(t + h / 2 \right)
1421 +        + \eta(t + h / 2)\left[ {\bf r}(t + h)
1422 +        - {\bf R}_0 \right] \right\} \\
1423 + %
1424 + \mathsf{H}(t + h) &\leftarrow e^{-h \eta(t + h / 2)}
1425 +        \mathsf{H}(t)
1426 + \end{align*}
1427 +
1428 + Most of these equations are identical to their counterparts in the NVT
1429 + integrator, but the propagation of positions to time $t + h$
1430 + depends on the positions at the same time.  {\sc oopse} carries out
1431 + this step iteratively (with a limit of 5 passes through the iterative
1432 + loop).  Also, the simulation box $\mathsf{H}$ is scaled uniformly for
1433 + one full time step by an exponential factor that depends on the value
1434 + of $\eta$ at time $t +
1435 + h / 2$.  Reshaping the box uniformly also scales the volume of
1436 + the box by
1437 + \begin{equation}
1438 + \mathcal{V}(t + h) \leftarrow e^{ - 3 h \eta(t + h /2)}
1439 + \mathcal{V}(t)
1440 + \end{equation}
1441 +
1442 + The {\tt doForces} step for the NPTi integrator is exactly the same as
1443 + in both the DLM and NVT integrators.  Once the forces and torques have
1444 + been obtained at the new time step, the velocities can be advanced to
1445 + the same time value.
1446 +
1447 + {\tt moveB:}
1448 + \begin{align*}
1449 + T(t + h) &\leftarrow \left\{{\bf v}(t + h)\right\},
1450 +        \left\{{\bf j}(t + h)\right\} \\
1451 + %
1452 + P(t + h) &\leftarrow  \left\{{\bf r}(t + h)\right\},
1453 +        \left\{{\bf v}(t + h)\right\} \\
1454 + %
1455 + \chi\left(t + h \right) &\leftarrow \chi\left(t + h /
1456 +        2 \right) + \frac{h}{2 \tau_T^2} \left( \frac{T(t+h)}
1457 +        {T_{\mathrm{target}}} - 1 \right) \\
1458 + %
1459 + \eta(t + h) &\leftarrow \eta(t + h / 2) +
1460 +        \frac{h \mathcal{V}(t + h)}{2 N k_B T(t + h)
1461 +        \tau_B^2} \left( P(t + h) - P_{\mathrm{target}} \right) \\
1462 + %
1463 + {\bf v}\left(t + h \right)  &\leftarrow {\bf v}\left(t
1464 +        + h / 2 \right) + \frac{h}{2} \left(
1465 +        \frac{{\bf f}(t + h)}{m} - {\bf v}(t + h)
1466 +        (\chi(t + h) + \eta(t + h)) \right) \\
1467 + %
1468 + {\bf j}\left(t + h \right)  &\leftarrow {\bf j}\left(t
1469 +        + h / 2 \right) + \frac{h}{2} \left( {\bf
1470 +        \tau}^b(t + h) - {\bf j}(t + h)
1471 +        \chi(t + h) \right)
1472 + \end{align*}
1473 +
1474 + Once again, since ${\bf v}(t + h)$ and ${\bf j}(t + h)$ are required
1475 + to caclculate $T(t + h)$, $P(t + h)$, $\chi(t + h)$, and $\eta(t +
1476 + h)$, they indirectly depend on their own values at time $t + h$.  {\tt
1477 + moveB} is therefore done in an iterative fashion until $\chi(t + h)$
1478 + and $\eta(t + h)$ become self-consistent.  The relative tolerance for
1479 + the self-consistency check defaults to a value of $\mbox{10}^{-6}$,
1480 + but {\sc oopse} will terminate the iteration after 4 loops even if the
1481 + consistency check has not been satisfied.
1482 +
1483 + The Melchionna modification of the Nos\'e-Hoover-Andersen algorithm is
1484 + known to conserve a Hamiltonian for the extended system that is, to
1485 + within a constant, identical to the Gibbs free energy,
1486 + \begin{equation}
1487 + H_{\mathrm{NPTi}} = V + K + f k_B T_{\mathrm{target}} \left(
1488 + \frac{\tau_{T}^2 \chi^2(t)}{2} + \int_{0}^{t} \chi(t^\prime) dt^\prime
1489 + \right) + P_{\mathrm{target}} \mathcal{V}(t).
1490 + \end{equation}
1491 + Poor choices of $\delta t$, $\tau_T$, or $\tau_B$ can result in
1492 + non-conservation of $H_{\mathrm{NPTi}}$, so the conserved quantity is
1493 + maintained in the last column of the {\tt .stat} file to allow checks
1494 + on the quality of the integration.  It is also known that this
1495 + algorithm samples the equilibrium distribution for the enthalpy
1496 + (including contributions for the thermostat and barostat),
1497 + \begin{equation}
1498 + H_{\mathrm{NPTi}} = V + K + \frac{f k_B T_{\mathrm{target}}}{2} \left(
1499 + \chi^2 \tau_T^2 + \eta^2 \tau_B^2 \right) +  P_{\mathrm{target}}
1500 + \mathcal{V}(t).
1501 + \end{equation}
1502 +
1503 + Bond constraints are applied at the end of both the {\tt moveA} and
1504 + {\tt moveB} portions of the algorithm.  Details on the constraint
1505 + algorithms are given in section \ref{oopseSec:rattle}.
1506 +
1507 + \subsection{\label{sec:NPTf}Constant-pressure integration with a
1508 + flexible box (NPTf)}
1509 +
1510 + There is a relatively simple generalization of the
1511 + Nos\'e-Hoover-Andersen method to include changes in the simulation box
1512 + {\it shape} as well as in the volume of the box.  This method utilizes
1513 + the full $3 \times 3$ pressure tensor and introduces a tensor of
1514 + extended variables ($\overleftrightarrow{\eta}$) to control changes to
1515 + the box shape.  The equations of motion for this method are
1516 + \begin{eqnarray}
1517 + \dot{{\bf r}} & = & {\bf v} + \overleftrightarrow{\eta} \cdot \left( {\bf r} - {\bf R}_0 \right) \\
1518 + \dot{{\bf v}} & = & \frac{{\bf f}}{m} - (\overleftrightarrow{\eta} +
1519 + \chi \cdot \mathsf{1}) {\bf v} \\
1520 + \dot{\mathsf{A}} & = & \mathsf{A} \cdot
1521 + \mbox{ skew}\left(\overleftrightarrow{I}^{-1} \cdot {\bf j}\right) \\
1522 + \dot{{\bf j}} & = & {\bf j} \times \left( \overleftrightarrow{I}^{-1}
1523 + \cdot {\bf j} \right) - \mbox{ rot}\left(\mathsf{A}^{T} \cdot \frac{\partial
1524 + V}{\partial \mathsf{A}} \right) - \chi {\bf j} \\
1525 + \dot{\chi} & = & \frac{1}{\tau_{T}^2} \left(
1526 + \frac{T}{T_{\mathrm{target}}} - 1 \right) \\
1527 + \dot{\overleftrightarrow{\eta}} & = & \frac{1}{\tau_{B}^2 f k_B
1528 + T_{\mathrm{target}}} V \left( \overleftrightarrow{\mathsf{P}} - P_{\mathrm{target}}\mathsf{1} \right) \\
1529 + \dot{\mathsf{H}} & = &  \overleftrightarrow{\eta} \cdot \mathsf{H}
1530 + \label{eq:melchionna2}
1531 + \end{eqnarray}
1532 +
1533 + Here, $\mathsf{1}$ is the unit matrix and $\overleftrightarrow{\mathsf{P}}$
1534 + is the pressure tensor.  Again, the volume, $\mathcal{V} = \det
1535 + \mathsf{H}$.
1536 +
1537 + The propagation of the equations of motion is nearly identical to the
1538 + NPTi integration:
1539 +
1540 + {\tt moveA:}
1541 + \begin{align*}
1542 + T(t) &\leftarrow \left\{{\bf v}(t)\right\}, \left\{{\bf j}(t)\right\} \\
1543 + %
1544 + \overleftrightarrow{\mathsf{P}}(t) &\leftarrow \left\{{\bf r}(t)\right\},
1545 +        \left\{{\bf v}(t)\right\} \\
1546 + %
1547 + {\bf v}\left(t + h / 2\right)  &\leftarrow {\bf v}(t)
1548 +        + \frac{h}{2} \left( \frac{{\bf f}(t)}{m} -
1549 +        \left(\chi(t)\mathsf{1} + \overleftrightarrow{\eta}(t) \right) \cdot
1550 +        {\bf v}(t) \right) \\
1551 + %
1552 + {\bf j}\left(t + h / 2 \right)  &\leftarrow {\bf j}(t)
1553 +        + \frac{h}{2} \left( {\bf \tau}^b(t) - {\bf j}(t)
1554 +        \chi(t) \right) \\
1555 + %
1556 + \mathsf{A}(t + h) &\leftarrow \mathrm{rotate}\left(h *
1557 +        {\bf j}(t + h / 2) \overleftrightarrow{\mathsf{I}}^{-1}
1558 +        \right) \\
1559 + %
1560 + \chi\left(t + h / 2 \right) &\leftarrow \chi(t) +
1561 +        \frac{h}{2 \tau_T^2} \left( \frac{T(t)}{T_{\mathrm{target}}}
1562 +        - 1 \right) \\
1563 + %
1564 + \overleftrightarrow{\eta}(t + h / 2) &\leftarrow
1565 +        \overleftrightarrow{\eta}(t) + \frac{h \mathcal{V}(t)}{2 N k_B
1566 +        T(t) \tau_B^2} \left( \overleftrightarrow{\mathsf{P}}(t)
1567 +        - P_{\mathrm{target}}\mathsf{1} \right) \\
1568 + %
1569 + {\bf r}(t + h) &\leftarrow {\bf r}(t) + h \left\{ {\bf v}
1570 +        \left(t + h / 2 \right) + \overleftrightarrow{\eta}(t +
1571 +        h / 2) \cdot \left[ {\bf r}(t + h)
1572 +        - {\bf R}_0 \right] \right\} \\
1573 + %
1574 + \mathsf{H}(t + h) &\leftarrow \mathsf{H}(t) \cdot e^{-h
1575 +        \overleftrightarrow{\eta}(t + h / 2)}
1576 + \end{align*}
1577 + {\sc oopse} uses a power series expansion truncated at second order
1578 + for the exponential operation which scales the simulation box.
1579 +
1580 + The {\tt moveB} portion of the algorithm is largely unchanged from the
1581 + NPTi integrator:
1582 +
1583 + {\tt moveB:}
1584 + \begin{align*}
1585 + T(t + h) &\leftarrow \left\{{\bf v}(t + h)\right\},
1586 +        \left\{{\bf j}(t + h)\right\} \\
1587 + %
1588 + \overleftrightarrow{\mathsf{P}}(t + h) &\leftarrow \left\{{\bf r}
1589 +        (t + h)\right\}, \left\{{\bf v}(t
1590 +        + h)\right\}, \left\{{\bf f}(t + h)\right\} \\
1591 + %
1592 + \chi\left(t + h \right) &\leftarrow \chi\left(t + h /
1593 +        2 \right) + \frac{h}{2 \tau_T^2} \left( \frac{T(t+
1594 +        h)}{T_{\mathrm{target}}} - 1 \right) \\
1595 + %
1596 + \overleftrightarrow{\eta}(t + h) &\leftarrow
1597 +        \overleftrightarrow{\eta}(t + h / 2) +
1598 +        \frac{h \mathcal{V}(t + h)}{2 N k_B T(t + h)
1599 +        \tau_B^2} \left( \overleftrightarrow{P}(t + h)
1600 +        - P_{\mathrm{target}}\mathsf{1} \right) \\
1601 + %
1602 + {\bf v}\left(t + h \right)  &\leftarrow {\bf v}\left(t
1603 +        + h / 2 \right) + \frac{h}{2} \left(
1604 +        \frac{{\bf f}(t + h)}{m} -
1605 +        (\chi(t + h)\mathsf{1} + \overleftrightarrow{\eta}(t
1606 +        + h)) \right) \cdot {\bf v}(t + h) \\
1607 + %
1608 + {\bf j}\left(t + h \right)  &\leftarrow {\bf j}\left(t
1609 +        + h / 2 \right) + \frac{h}{2} \left( {\bf \tau}^b(t
1610 +        + h) - {\bf j}(t + h) \chi(t + h) \right)
1611 + \end{align*}
1612 +
1613 + The iterative schemes for both {\tt moveA} and {\tt moveB} are
1614 + identical to those described for the NPTi integrator.
1615 +
1616 + The NPTf integrator is known to conserve the following Hamiltonian:
1617 + \begin{equation}
1618 + H_{\mathrm{NPTf}} = V + K + f k_B T_{\mathrm{target}} \left(
1619 + \frac{\tau_{T}^2 \chi^2(t)}{2} + \int_{0}^{t} \chi(t^\prime) dt^\prime
1620 + \right) + P_{\mathrm{target}} \mathcal{V}(t) + \frac{f k_B
1621 + T_{\mathrm{target}}}{2}
1622 + \mathrm{Tr}\left[\overleftrightarrow{\eta}(t)\right]^2 \tau_B^2.
1623 + \end{equation}
1624 +
1625 + This integrator must be used with care, particularly in liquid
1626 + simulations.  Liquids have very small restoring forces in the
1627 + off-diagonal directions, and the simulation box can very quickly form
1628 + elongated and sheared geometries which become smaller than the
1629 + electrostatic or Lennard-Jones cutoff radii.  The NPTf integrator
1630 + finds most use in simulating crystals or liquid crystals which assume
1631 + non-orthorhombic geometries.
1632 +
1633 + \subsection{\label{nptxyz}Constant pressure in 3 axes (NPTxyz)}
1634 +
1635 + There is one additional extended system integrator which is somewhat
1636 + simpler than the NPTf method described above.  In this case, the three
1637 + axes have independent barostats which each attempt to preserve the
1638 + target pressure along the box walls perpendicular to that particular
1639 + axis.  The lengths of the box axes are allowed to fluctuate
1640 + independently, but the angle between the box axes does not change.
1641 + The equations of motion are identical to those described above, but
1642 + only the {\it diagonal} elements of $\overleftrightarrow{\eta}$ are
1643 + computed.  The off-diagonal elements are set to zero (even when the
1644 + pressure tensor has non-zero off-diagonal elements).
1645 +
1646 + It should be noted that the NPTxyz integrator is {\it not} known to
1647 + preserve any Hamiltonian of interest to the chemical physics
1648 + community.  The integrator is extremely useful, however, in generating
1649 + initial conditions for other integration methods.  It {\it is} suitable
1650 + for use with liquid simulations, or in cases where there is
1651 + orientational anisotropy in the system (i.e. in lipid bilayer
1652 + simulations).
1653 +
1654   \subsection{\label{oopseSec:rattle}The {\sc rattle} Method for Bond
1655          Constraints}
1656  
# Line 1222 | Line 1906 | coefficient can be approximated by
1906   If the time-dependent friction decays rapidly, the static friction
1907   coefficient can be approximated by
1908   \begin{equation}
1909 < \xi^{static}(z)=\int_{0}^{\infty}\langle\delta F(z,t)\delta F(z,0)\rangle dt
1909 > \xi_{\text{static}}(z)=\int_{0}^{\infty}\langle\delta F(z,t)\delta F(z,0)\rangle dt
1910   \end{equation}
1911 < Therefore, the diffusion constant can then be estimated by
1911 > Allowing diffusion constant to then be calculated through the
1912 > Einstein relation:\cite{Marrink94}
1913   \begin{equation}
1914 < D(z)=\frac{k_{B}T}{\xi^{static}(z)}=\frac{(k_{B}T)^{2}}{\int_{0}^{\infty
1914 > D(z)=\frac{k_{B}T}{\xi_{\text{static}}(z)}=\frac{(k_{B}T)^{2}}{\int_{0}^{\infty
1915   }\langle\delta F(z,t)\delta F(z,0)\rangle dt}%
1916   \end{equation}
1917  
# Line 1236 | Line 1921 | avoid this problem, a new method was used in {\sc oops
1921   auto-correlation calculation.\cite{Marrink94} However, simply resetting the
1922   coordinate will move the center of the mass of the whole system. To
1923   avoid this problem, a new method was used in {\sc oopse}. Instead of
1924 < resetting the coordinate, we reset the forces of z-constraint
1924 > resetting the coordinate, we reset the forces of z-constrained
1925   molecules as well as subtract the total constraint forces from the
1926 < rest of the system after force calculation at each time step.
1927 < \begin{align}
1928 < F_{\alpha i}&=0\\
1929 < V_{\alpha i}&=V_{\alpha i}-\frac{\sum\limits_{i}M_{_{\alpha i}}V_{\alpha i}}{\sum\limits_{i}M_{_{\alpha i}}}\\
1930 < F_{\alpha i}&=F_{\alpha i}-\frac{M_{_{\alpha i}}}{\sum\limits_{\alpha}\sum\limits_{i}M_{_{\alpha i}}}\sum\limits_{\beta}F_{\beta}\\
1931 < V_{\alpha i}&=V_{\alpha i}-\frac{\sum\limits_{\alpha}\sum\limits_{i}M_{_{\alpha i}}V_{\alpha i}}{\sum\limits_{\alpha}\sum\limits_{i}M_{_{\alpha i}}}
1932 < \end{align}
1926 > rest of the system after the force calculation at each time step.
1927 >
1928 > After the force calculation, define $G_\alpha$ as
1929 > \begin{equation}
1930 > G_{\alpha} = \sum_i F_{\alpha i}
1931 > \label{oopseEq:zc1}
1932 > \end{equation}
1933 > Where $F_{\alpha i}$ is the force in the z direction of atom $i$ in
1934 > z-constrained molecule $\alpha$. The forces of the z constrained
1935 > molecule are then set to:
1936 > \begin{equation}
1937 > F_{\alpha i} = F_{\alpha i} -
1938 >        \frac{m_{\alpha i} G_{\alpha}}{\sum_i m_{\alpha i}}
1939 > \end{equation}
1940 > Here, $m_{\alpha i}$ is the mass of atom $i$ in the z-constrained
1941 > molecule. Having rescaled the forces, the velocities must also be
1942 > rescaled to subtract out any center of mass velocity in the z
1943 > direction.
1944 > \begin{equation}
1945 > v_{\alpha i} = v_{\alpha i} -
1946 >        \frac{\sum_i m_{\alpha i} v_{\alpha i}}{\sum_i m_{\alpha i}}
1947 > \end{equation}
1948 > Where $v_{\alpha i}$ is the velocity of atom $i$ in the z direction.
1949 > Lastly, all of the accumulated z constrained forces must be subtracted
1950 > from the system to keep the system center of mass from drifting.
1951 > \begin{equation}
1952 > F_{\beta i} = F_{\beta i} - \frac{m_{\beta i} \sum_{\alpha} G_{\alpha}}
1953 >        {\sum_{\beta}\sum_i m_{\beta i}}
1954 > \end{equation}
1955 > Where $\beta$ are all of the unconstrained molecules in the
1956 > system. Similarly, the velocities of the unconstrained molecules must
1957 > also be scaled.
1958 > \begin{equation}
1959 > v_{\beta i} = v_{\beta i} + \sum_{\alpha}
1960 >        \frac{\sum_i m_{\alpha i} v_{\alpha i}}{\sum_i m_{\alpha i}}
1961 > \end{equation}
1962  
1963   At the very beginning of the simulation, the molecules may not be at their
1964   constrained positions. To move a z-constrained molecule to its specified
# Line 1272 | Line 1986 | can be found in Table~\ref{oopseTb:gofrs}
1986   can be found in Table~\ref{oopseTb:gofrs}
1987  
1988   \begin{table}
1989 < \caption[The list of pair correlations in \texttt{staticProps}]{The different pair correlations in \texttt{staticProps} along with whether atom A or B must be directional.}
1989 > \caption[The list of pair correlations in \texttt{staticProps}]{THE DIFFERENT PAIR CORRELATIONS IN \texttt{staticProps}}
1990   \label{oopseTb:gofrs}
1991   \begin{center}
1992   \begin{tabular}{|l|c|c|}
# Line 1285 | Line 1999 | $\langle \cos \omega \rangle_{\text{AB}}(r)$ & Eq.~\re
1999   $\langle \cos \omega \rangle_{\text{AB}}(r)$ & Eq.~\ref{eq:cosOmegaOfR} &%
2000          both \\ \hline
2001   \end{tabular}
2002 + \begin{minipage}{\linewidth}
2003 + \centering
2004 + \vspace{2mm}
2005 + The third column specifies which atom, if any, need be a directional entity.
2006 + \end{minipage}
2007   \end{center}
2008   \end{table}
2009  
# Line 1453 | Line 2172 | duration of the simulation. Computational cost scales
2172   Algorithmically simplest of the three methods is atomic decomposition
2173   where N particles in a simulation are split among P processors for the
2174   duration of the simulation. Computational cost scales as an optimal
2175 < $O(N/P)$ for atomic decomposition. Unfortunately all processors must
2176 < communicate positions and forces with all other processors at every
2177 < force evaluation, leading communication costs to scale as an
2178 < unfavorable $O(N)$, \emph{independent of the number of processors}. This
2179 < communication bottleneck led to the development of spatial and force
2180 < decomposition methods in which communication among processors scales
2181 < much more favorably. Spatial or domain decomposition divides the
2182 < physical spatial domain into 3D boxes in which each processor is
2183 < responsible for calculation of forces and positions of particles
2184 < located in its box. Particles are reassigned to different processors
2185 < as they move through simulation space. To calculate forces on a given
2186 < particle, a processor must know the positions of particles within some
2187 < cutoff radius located on nearby processors instead of the positions of
2188 < particles on all processors. Both communication between processors and
2189 < computation scale as $O(N/P)$ in the spatial method. However, spatial
2175 > $\mathcal{O}(N/P)$ for atomic decomposition. Unfortunately all
2176 > processors must communicate positions and forces with all other
2177 > processors at every force evaluation, leading communication costs to
2178 > scale as an unfavorable $\mathcal{O}(N)$, \emph{independent of the
2179 > number of processors}. This communication bottleneck led to the
2180 > development of spatial and force decomposition methods in which
2181 > communication among processors scales much more favorably. Spatial or
2182 > domain decomposition divides the physical spatial domain into 3D boxes
2183 > in which each processor is responsible for calculation of forces and
2184 > positions of particles located in its box. Particles are reassigned to
2185 > different processors as they move through simulation space. To
2186 > calculate forces on a given particle, a processor must know the
2187 > positions of particles within some cutoff radius located on nearby
2188 > processors instead of the positions of particles on all
2189 > processors. Both communication between processors and computation
2190 > scale as $\mathcal{O}(N/P)$ in the spatial method. However, spatial
2191   decomposition adds algorithmic complexity to the simulation code and
2192   is not very efficient for small N since the overall communication
2193 < scales as the surface to volume ratio $(N/P)^{2/3}$ in three
2194 < dimensions.
2193 > scales as the surface to volume ratio $\mathcal{O}(N/P)^{2/3}$ in
2194 > three dimensions.
2195  
2196   The parallelization method used in {\sc oopse} is the force
2197   decomposition method.  Force decomposition assigns particles to
# Line 1480 | Line 2200 | assignment. Force decomposition is less complex to imp
2200   and column processor groups. Forces are calculated on particles in a
2201   given row by particles located in that processors column
2202   assignment. Force decomposition is less complex to implement than the
2203 < spatial method but still scales computationally as $O(N/P)$ and scales
2204 < as $O(N/\sqrt{P})$ in communication cost. Plimpton has also found that
2205 < force decompositions scale more favorably than spatial decompositions
2206 < for systems up to 10,000 atoms and favorably compete with spatial
2207 < methods up to 100,000 atoms.\cite{plimpton95}
2203 > spatial method but still scales computationally as $\mathcal{O}(N/P)$
2204 > and scales as $\mathcal{O}(N/\sqrt{P})$ in communication
2205 > cost. Plimpton has also found that force decompositions scale more
2206 > favorably than spatial decompositions for systems up to 10,000 atoms
2207 > and favorably compete with spatial methods up to 100,000
2208 > atoms.\cite{plimpton95}
2209  
2210   \subsection{\label{oopseSec:memAlloc}Memory Issues in Trajectory Analysis}
2211  
# Line 1542 | Line 2263 | program. Allowing researchers to not only benefit from
2263   These features are all brought together in a single open-source
2264   program. Allowing researchers to not only benefit from
2265   {\sc oopse}, but also contribute to {\sc oopse}'s development as
2266 < well.Documentation and source code for {\sc oopse} can be downloaded
1546 < from \texttt{http://www.openscience.org/oopse/}.
2266 > well.
2267  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines