ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/oopsePaper/oopsePaper.tex
Revision: 1179
Committed: Fri May 14 15:50:27 2004 UTC (20 years, 2 months ago) by mmeineke
Content type: application/x-tex
File size: 91779 byte(s)
Log Message:
more revisions

File Contents

# User Rev Content
1 mmeineke 1121 \documentclass[11pt]{article}
2     \usepackage{amsmath}
3     \usepackage{amssymb}
4     \usepackage{endfloat}
5     \usepackage{listings}
6 mmeineke 1134 \usepackage{palatino}
7 mmeineke 1121 \usepackage{graphicx}
8     \usepackage[ref]{overcite}
9     \usepackage{setspace}
10     \usepackage{tabularx}
11     \pagestyle{plain}
12     \pagenumbering{arabic}
13     \oddsidemargin 0.0cm \evensidemargin 0.0cm
14     \topmargin -21pt \headsep 10pt
15     \textheight 9.0in \textwidth 6.5in
16     \brokenpenalty=10000
17     \renewcommand{\baselinestretch}{1.2}
18     \renewcommand\citemid{\ } % no comma in optional reference note
19    
20     \begin{document}
21 mmeineke 1123 \lstset{language=C,frame=TB,basicstyle=\small,basicstyle=\ttfamily, %
22     xleftmargin=0.5in, xrightmargin=0.5in,captionpos=b, %
23     abovecaptionskip=0.5cm, belowcaptionskip=0.5cm}
24 mmeineke 1121 \renewcommand{\lstlistingname}{Scheme}
25     \title{{\sc oopse}: An Open Source Object-Oriented Parallel Simulation
26     Engine for Molecular Dynamics}
27    
28 mmeineke 1155 \author{Matthew A. Meineke, Charles F. Vardeman II, Teng Lin,\\
29     Christopher J. Fennell and J. Daniel Gezelter\\
30 mmeineke 1121 Department of Chemistry and Biochemistry\\
31     University of Notre Dame\\
32     Notre Dame, Indiana 46556}
33    
34     \date{\today}
35     \maketitle
36    
37     \begin{abstract}
38     We detail the capabilities of a new open-source parallel simulation
39 mmeineke 1155 progrm for MD ({\sc oopse}) that can work with atom types that are missing from other popular packages. In
40     particular, {\sc oopse} is capable of performing efficient orientational
41     dynamics on dipolar or rigid body systems, and it can handle simulations of metallic
42 mmeineke 1121 systems using the embedded atom method ({\sc eam}).
43     \end{abstract}
44    
45     \section{\label{sec:intro}Introduction}
46    
47     When choosing to simulate a chemical system with molecular dynamics,
48     there are a variety of options available. For simple systems, one
49     might consider writing one's own programming code. However, as systems
50     grow larger and more complex, building and maintaining code for the
51     simulations becomes a time consuming task. In such cases it is usually
52     more convenient for a researcher to turn to pre-existing simulation
53     packages. These packages, such as {\sc amber}\cite{pearlman:1995} and
54     {\sc charmm}\cite{Brooks83}, provide powerful tools for researchers to
55     conduct simulations of their systems without spending their time
56     developing a code base to conduct their research. This then frees them
57     to perhaps explore experimental analogues to their models.
58    
59     Despite their utility, problems with these packages arise when
60     researchers try to develop techniques or energetic models that the
61     code was not originally designed to simulate. Examples of techniques
62     and energetics not commonly implemented include; dipole-dipole
63     interactions, rigid body dynamics, and metallic potentials. When faced
64     with these obstacles, a researcher must either develop their own code
65     or license and extend one of the commercial packages. What we have
66     elected to do is develop a body of simulation code capable of
67     implementing the types of models upon which our research is based.
68    
69     In developing {\sc oopse}, we have adhered to the precepts of Open
70     Source development, and are releasing our source code with a
71     permissive license. It is our intent that by doing so, other
72     researchers might benefit from our work, and add their own
73     contributions to the package. The license under which {\sc oopse} is
74     distributed allows any researcher to download and modify the source
75     code for their own use. In this way further development of {\sc oopse}
76     is not limited to only the models of interest to ourselves, but also
77     those of the community of scientists who contribute back to the
78     project.
79    
80 mmeineke 1134 We have structured this paper to first discuss the empirical energy
81 mmeineke 1121 functions that {\sc oopse } implements in
82     Sec.~\ref{oopseSec:empiricalEnergy}. Following that is a discussion of
83     the various input and output files associated with the package
84     (Sec.~\ref{oopseSec:IOfiles}). Sec.~\ref{oopseSec:mechanics}
85     elucidates the various Molecular Dynamics algorithms {\sc oopse}
86     implements in the integration of the Newtonian equations of
87 mmeineke 1134 motion. Program design
88 mmeineke 1121 considerations are presented in Sec.~\ref{oopseSec:design}. And
89     lastly, Sec.~\ref{oopseSec:conclusion} concludes the chapter.
90    
91 mmeineke 1155 \section{\label{oopseSec:IOfiles}Concepts \& Files}
92 mmeineke 1121
93 mmeineke 1155 \subsection{{\sc bass} and Model Files}
94    
95     Every {\sc oopse} simulation begins with a Bizarre Atom Simulation
96     Syntax ({\sc bass}) file. {\sc bass} is a script syntax that is parsed
97     by {\sc oopse} at runtime. The {\sc bass} file allows for the user to
98     completely describe the system they wish to simulate, as well as tailor
99     {\sc oopse}'s behavior during the simulation. {\sc bass} files are
100     denoted with the extension
101     \texttt{.bass}, an example file is shown in
102     Scheme~\ref{sch:bassExample}.
103    
104     \begin{lstlisting}[float,caption={[An example of a complete {\sc bass} file] An example showing a complete {\sc bass} file.},label={sch:bassExample}]
105    
106     molecule{
107     name = "Ar";
108     nAtoms = 1;
109     atom[0]{
110     type="Ar";
111     position( 0.0, 0.0, 0.0 );
112     }
113     }
114    
115     nComponents = 1;
116     component{
117     type = "Ar";
118     nMol = 108;
119     }
120    
121     initialConfig = "./argon.init";
122    
123     forceField = "LJ";
124     ensemble = "NVE"; // specify the simulation ensemble
125     dt = 1.0; // the time step for integration
126     runTime = 1e3; // the total simulation run time
127     sampleTime = 100; // trajectory file frequency
128     statusTime = 50; // statistics file frequency
129    
130     \end{lstlisting}
131    
132     Within the \texttt{.bass} file it is necessary to provide a complete
133     description of the molecule before it is actually placed in the
134     simulation. The {\sc bass} syntax was originally developed with this
135     goal in mind, and allows for the specification of all the atoms in a
136     molecular prototype, as well as any bonds, bends, or torsions. These
137     descriptions can become lengthy for complex molecules, and it would be
138     inconvenient to duplicate the simulation at the beginning of each {\sc
139     bass} script. Addressing this issue {\sc bass} allows for the
140     inclusion of model files at the top of a \texttt{.bass} file. These
141     model files, denoted with the \texttt{.mdl} extension, allow the user
142     to describe a molecular prototype once, then simply include it into
143     each simulation containing that molecule. Returning to the example in
144     Scheme~\ref{sch:bassExample}, the \texttt{.mdl} file's contents would
145     be Scheme~\ref{sch:mdlExample}, and the new \texttt{.bass} file would
146     become Scheme~\ref{sch:bassExPrime}.
147    
148     \begin{lstlisting}[float,caption={An example \texttt{.mdl} file.},label={sch:mdlExample}]
149    
150     molecule{
151     name = "Ar";
152     nAtoms = 1;
153     atom[0]{
154     type="Ar";
155     position( 0.0, 0.0, 0.0 );
156     }
157     }
158    
159     \end{lstlisting}
160    
161     \begin{lstlisting}[float,caption={Revised {\sc bass} example.},label={sch:bassExPrime}]
162    
163     #include "argon.mdl"
164    
165     nComponents = 1;
166     component{
167     type = "Ar";
168     nMol = 108;
169     }
170    
171     initialConfig = "./argon.init";
172    
173     forceField = "LJ";
174     ensemble = "NVE";
175     dt = 1.0;
176     runTime = 1e3;
177     sampleTime = 100;
178     statusTime = 50;
179    
180     \end{lstlisting}
181    
182 mmeineke 1121 \subsection{\label{oopseSec:atomsMolecules}Atoms, Molecules and Rigid Bodies}
183    
184     The basic unit of an {\sc oopse} simulation is the atom. The
185     parameters describing the atom are generalized to make the atom as
186     flexible a representation as possible. They may represent specific
187     atoms of an element, or be used for collections of atoms such as
188     methyl and carbonyl groups. The atoms are also capable of having
189     directional components associated with them (\emph{e.g.}~permanent
190     dipoles). Charges, permanent dipoles, and Lennard-Jones parameters for
191     a given atom type are set in the force field parameter files.
192    
193     Atoms can be collected into secondary structures such as rigid bodies
194     or molecules. The molecule is a way for {\sc oopse} to keep track of
195     the atoms in a simulation in logical manner. Molecular units store the
196     identities of all the atoms and rigid bodies associated with
197     themselves, and are responsible for the evaluation of their own
198     internal interactions (\emph{i.e.}~bonds, bends, and torsions). Scheme
199 mmeineke 1168 \ref{sch:mdlExample} shows how one creates a molecule in a ``model'' or
200 mmeineke 1121 \texttt{.mdl} file. The position of the atoms given in the
201     declaration are relative to the origin of the molecule, and is used
202     when creating a system containing the molecule.
203    
204     As stated previously, one of the features that sets {\sc oopse} apart
205     from most of the current molecular simulation packages is the ability
206     to handle rigid body dynamics. Rigid bodies are non-spherical
207     particles or collections of particles that have a constant internal
208     potential and move collectively.\cite{Goldstein01} They are not
209     included in most simulation packages because of the algorithmic
210     complexity involved in propagating orientational degrees of
211     freedom. Until recently, integrators which propagate orientational
212 mmeineke 1168 motion have had energy conservation problems when compared to those available for translational
213 mmeineke 1121 motion.
214    
215     Moving a rigid body involves determination of both the force and
216     torque applied by the surroundings, which directly affect the
217     translational and rotational motion in turn. In order to accumulate
218     the total force on a rigid body, the external forces and torques must
219     first be calculated for all the internal particles. The total force on
220     the rigid body is simply the sum of these external forces.
221     Accumulation of the total torque on the rigid body is more complex
222     than the force because the torque is applied to the center of mass of
223     the rigid body. The torque on rigid body $i$ is
224     \begin{equation}
225     \boldsymbol{\tau}_i=
226     \sum_{a}\biggl[(\mathbf{r}_{ia}-\mathbf{r}_i)\times \mathbf{f}_{ia}
227     + \boldsymbol{\tau}_{ia}\biggr],
228     \label{eq:torqueAccumulate}
229     \end{equation}
230     where $\boldsymbol{\tau}_i$ and $\mathbf{r}_i$ are the torque on and
231     position of the center of mass respectively, while $\mathbf{f}_{ia}$,
232     $\mathbf{r}_{ia}$, and $\boldsymbol{\tau}_{ia}$ are the force on,
233     position of, and torque on the component particles of the rigid body.
234    
235     The summation of the total torque is done in the body fixed axis of
236     each rigid body. In order to move between the space fixed and body
237     fixed coordinate axes, parameters describing the orientation must be
238     maintained for each rigid body. At a minimum, the rotation matrix
239     ($\mathsf{A}$) can be described by the three Euler angles ($\phi,
240     \theta,$ and $\psi$), where the elements of $\mathsf{A}$ are composed of
241     trigonometric operations involving $\phi, \theta,$ and
242     $\psi$.\cite{Goldstein01} In order to avoid numerical instabilities
243     inherent in using the Euler angles, the four parameter ``quaternion''
244     scheme is often used. The elements of $\mathsf{A}$ can be expressed as
245     arithmetic operations involving the four quaternions ($q_0, q_1, q_2,$
246     and $q_3$).\cite{allen87:csl} Use of quaternions also leads to
247     performance enhancements, particularly for very small
248     systems.\cite{Evans77}
249    
250     {\sc oopse} utilizes a relatively new scheme that propagates the
251     entire nine parameter rotation matrix. Further discussion
252     on this choice can be found in Sec.~\ref{oopseSec:integrate}. An example
253     definition of a rigid body can be seen in Scheme
254 mmeineke 1168 \ref{sch:rigidBody}.
255 mmeineke 1121
256 mmeineke 1168 \begin{lstlisting}[float,caption={[Defining rigid bodies]A sample definition of a molecule containing a rigid body},label={sch:rigidBody}]
257 mmeineke 1121 molecule{
258     name = "TIP3P";
259     nAtoms = 3;
260     atom[0]{
261     type = "O_TIP3P";
262     position( 0.0, 0.0, -0.06556 );
263     }
264     atom[1]{
265     type = "H_TIP3P";
266     position( 0.0, 0.75695, 0.52032 );
267     }
268     atom[2]{
269     type = "H_TIP3P";
270     position( 0.0, -0.75695, 0.52032 );
271     }
272    
273     nRigidBodies = 1;
274     rigidBody[0]{
275     nMembers = 3;
276     members(0, 1, 2);
277     }
278     }
279     \end{lstlisting}
280    
281 mmeineke 1155 \subsection{\label{sec:miscConcepts}Putting a Script Together}
282    
283     The actual creation of a {\sc bass} script requires several key components. The first part of the script needs to be the declaration of all of the molecule prototypes used in the simulation. This is typically done through the inclusion of {\tt .mdl} files. Only the molecules actually present in the simulation need to be declared, however {\sc bass} allows for the declaration of more molecules than are needed. This gives the user the ability to build up a library of commonly used molecules into a single {\tt .mdl} file.
284    
285 mmeineke 1168 Once all prototypes are declared, the ordering of the rest of the script is less stringent. Typically, the next to follow the molecular prototypes are the component statements. These statements specify which molecules are present within the simulation. The number of components must first be declared before the first component block statement (an example is seen in Sch.~\ref{sch:bassExPrime}). The component blocks tell {\sc oopse} the number of molecules that will be in the simulation, and the order in which the components blocks are declared sets the ordering of the real atoms within the simulation as well as in the output files.
286 mmeineke 1155
287 mmeineke 1168 The remainder of the script then sets the various simulation parameters for the system of interest. The required set of parameters that must be present in all simulations is given in Table~\ref{table:reqParams}. The {\tt ensemble} statement is responsible for selecting the integration method used for the calculation of the equations of motion. An in depth discussion of the various methods available in {\sc oopse} can be found in Sec.~\ref{oopseSec:mechanics}. The {\tt forceField} statement is important for the selection of which forces will be used in the course of the simulation. {\sc oopse} supports several force fields, as outlined in Sec.~\ref{oopseSec:empericalEnergy}. The force fields are interchangeable between simulations, with the only requirement being that all atoms needed by the simulation are defined within the selected force field. The time step between force evaluations is set with the {\tt dt} parameter, and {\tt runTime} will set the time length of the simulation. Note, that {\tt runTime} is an absolute time, meaning if the simulation is started at t = 10.0~ns with a {\tt runTime} of 25.0~ns, the simulation will only run for an additional 15.0~ns. The final required parameter, is the {\tt initialConfig} statement. This will set the initial coordinates for the system, as well as the initial time if the {\tt useInitalTime = true;} flag is given. The format of the file specified in {\tt initialConfig}, is given in Sec.~\ref{oopseSec:coordFiles}. Additional parameters are summarized in Table~\ref{table:genParams}.
288    
289     \begin{table}
290     \caption{The Global Keywords: Required Parameters}
291     \label{table:reqParams}
292     \begin{center}
293     % Note when adding or removing columns, the \hsize numbers must add up to the total number
294     % of columns.
295     \begin{tabularx}{\linewidth}%
296     {>{\setlength{\hsize}{1.00\hsize}}X%
297     >{\setlength{\hsize}{0.4\hsize}}X%
298     >{\setlength{\hsize}{1.2\hsize}}X%
299     >{\setlength{\hsize}{1.4\hsize}}X}
300    
301     {\bf keyword} & {\bf units} & {\bf use} & {\bf remarks} \\ \hline
302    
303     {\tt forceField} & string & Sets the force field. & Possible force fields are "DUFF", "LJ", and "EAM". \\
304     {\tt ensemble} & string & Sets the ensemble. & Possible ensembles are "NVE", "NVT", "NPTi", "NPTf", and "NPTxyz".\\
305     {\tt dt} & fs & Sets the time step. & Selection of {\tt dt} should be small enough to sample the fastest motion of the simulation. \\
306     {\tt nComponents} & integer & Sets the number of components. & Needs to appear before the first {\tt Component} block. \\
307     {\tt initialConfig} & string & Sets the file containing the initial configuration. & Can point to any file containing the configuration in the correct order. \\
308     {\tt runTime} & fs & Sets the time at which the simulation should end. & This is an absolute time, and will end the simulation when the current time meets or exceeds the {\tt runTime}. \\
309    
310    
311     \end{tabularx}
312     \end{center}
313     \end{table}
314    
315     \begin{table}
316     \caption{The Global Keywords: General Parameters}
317     \label{table:genParams}
318     \begin{center}
319     % Note when adding or removing columns, the \hsize numbers must add up to the total number
320     % of columns.
321     \begin{tabularx}{\linewidth}%
322     {>{\setlength{\hsize}{1.00\hsize}}X%
323     >{\setlength{\hsize}{0.4\hsize}}X%
324     >{\setlength{\hsize}{1.2\hsize}}X%
325     >{\setlength{\hsize}{1.4\hsize}}X}
326    
327     {\bf keyword} & {\bf units} & {\bf use} & {\bf remarks} \\ \hline
328    
329     {\tt finalConfig} & string & Option to set the name of the final output file. & Useful when stringing simulations together. Defaults to the {\tt .bass} file with an {\tt .eor} extension. \\
330     {\tt useInitialTime} & logical & Sets whether the initial time is taken from the {\tt .init} file. & Useful when recovering a simulation from a crashed processor. Default is false. \\
331     {\tt sampleTime} & fs & Sets the frequency at which the {\tt .dump} file is written. & Default sets the frequency to the {\tt runTime}. \\
332     {\tt statusTime} & fs & Sets the frequency at which the {\tt .stat} file is written. & Defaults sets the frequency to the {\tt sampleTime}. \\
333     {\tt LJrcut} & $\mbox{\AA}$ & Manually sets the Lennard-Jones cutoff. & Defaults to $2.5\sigma_L$, where $\sigma_L$ is the largest LJ $\sigma$ in the simulation. \\
334     {\tt electrostaticCutoffRadius}& & & \\
335     & $\mbox{\AA}$ & Manually sets the cutoff used by the electrostatic potentials. & Defaults to $15\mbox{\AA}$ \\
336     {\tt electrostaticSkinThickness} & & & \\
337     & $\mbox{\AA}$ & Manually sets the skin thickness for the electrostatic switching function. & Defaults to 5~\% of the {\tt electrostaticSkinThickness}. \\
338     {\tt useReactionField} & logical & Turns the reaction field correction on/off. & Default is "false". \\
339     {\tt dielectric} & unitless & Sets the dielectric constant for reaction field. & If {\tt useReactionField} is true, then {\tt dielectric} must be set. \\
340     {\tt usePeriodicBoundaryConditions} & & & \\
341     & logical & Turns periodic boundary conditions on/off. & Default is "true". \\
342     {\tt seed } & integer & Sets the seed value for the random number generator. & The seed needs to be at least 9 digits long. The default is to take the seed from the CPU clock.
343    
344     \end{tabularx}
345     \end{center}
346     \end{table}
347    
348    
349    
350 mmeineke 1155 \subsection{\label{oopseSec:coordFiles}Coordinate Files}
351    
352     The standard format for storage of a systems coordinates is a modified
353     xyz-file syntax, the exact details of which can be seen in
354     Scheme~\ref{sch:dumpFormat}. As all bonding and molecular information
355     is stored in the \texttt{.bass} and \texttt{.mdl} files, the
356     coordinate files are simply the complete set of coordinates for each
357     atom at a given simulation time. One important note, although the
358     simulation propagates the complete rotation matrix, directional
359     entities are written out using quanternions, to save space in the
360     output files.
361    
362     \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, body fixed angular momentum.},label=sch:dumpFormat]
363    
364     nAtoms
365     time; Hxx Hyx Hzx; Hxy Hyy Hzy; Hxz Hyz Hzz;
366     Name1 x y z vx vy vz q0 q1 q2 q3 jx jy jz
367     Name2 x y z vx vy vz q0 q1 q2 q3 jx jy jz
368     etc...
369    
370     \end{lstlisting}
371    
372    
373     There are three major files used by {\sc oopse} written in the
374     coordinate format, they are as follows: the initialization file
375     (\texttt{.init}), the simulation trajectory file (\texttt{.dump}), and
376     the final coordinates of the simulation (\texttt{.eor}). The initialization file is
377     necessary for {\sc oopse} to start the simulation with the proper
378     coordinates, and is generated before the simulation run. The
379     trajectory file is created at the beginning of the simulation, and is
380     used to store snapshots of the simulation at regular intervals. The
381     first frame is a duplication of the
382     \texttt{.init} file, and each subsequent frame is appended to the file
383     at an interval specified in the \texttt{.bass} file with the
384     \texttt{sampleTime} flag. The final coordinate file is the end of run file. The
385     \texttt{.eor} file stores the final configuration of the system for a
386     given simulation. The file is updated at the same time as the
387     \texttt{.dump} file, however, it only contains the most recent
388     frame. In this way, an \texttt{.eor} file may be used as the
389     initialization file to a second simulation in order to continue a
390     simulation or recover one from a processor that has crashed during the
391     course of the run.
392    
393     \subsection{\label{oopseSec:initCoords}Generation of Initial Coordinates}
394    
395     As was stated in Sec.~\ref{oopseSec:coordFiles}, an initialization
396     file is needed to provide the starting coordinates for a
397     simulation. Several helper programs are provided with {\sc oopse} to illustrate possible build routes. However, as each simulation is different, system creation is left to the end user. The {\tt .init} file must list the atoms in the correct order or {\sc oopse} will give an atom mismatch error.
398    
399     The correct ordering of the atoms relies on the ordering of atoms and molecules within the model and {\sc bass} scripts. {\sc oopse} expects the order to comply with the following guidelines:
400     \begin{enumerate}
401     \item All of the molecules of the first declared component are given before proceeding to the molecules of the second component, and so on for all declared components.
402     \item The ordering of the atoms for each molecule follows the order declared in the molecule's declaration within the model file.
403     \end{enumerate}
404     An example is given in Scheme~\ref{sch:initEx1} resulting in the {\tt .init} file shown in Scheme~\ref{sch:initEx2}.
405    
406     \begin{lstlisting}[float,caption={This scheme illustrates the declaration of the $\text{I}_2$ molecule and the HCl molecule. The two molecules are then included into a simulation.}, label=sch:initEx1]
407    
408     molecule{
409     name = "I2";
410     nAtoms = 2;
411     atom[0]{
412     type = "I";
413     }
414     atom[1]{
415     type = "I";
416     }
417     nBonds = 1;
418     bond[0]{
419     members( 0, 1);
420     }
421     }
422    
423     molecule{
424     name = "HCl"
425     nAtoms = 2;
426     atom[0]{
427     type = "H";
428     }
429     atom[1]{
430     type = "Cl";
431     }
432     nBonds = 1;
433     bond[0]{
434     members( 0, 1);
435     }
436     }
437    
438     nComponents = 2;
439     component{
440     type = "HCl";
441     nMol = 4;
442     }
443     component{
444     type = "I2";
445     nMol = 1;
446     }
447    
448     initialConfig = "mixture.init";
449    
450     \end{lstlisting}
451    
452     \begin{lstlisting}[float,caption={This is the contents of the {\tt mixture.init} file matching the declarations in Scheme~\ref{sch:initEx1}. Note that even though $\text{I}_2$ is declared before HCl, the {\tt .init} file follows the order in which the components were included.},label=sch:initEx2]
453    
454     10
455     0.0; 10.0 0.0 0.0; 0.0 10.0 0.0; 0.0 0.0 10.0;
456     H ...
457     Cl ...
458     H ...
459     Cl ...
460     H ...
461     Cl ...
462     H ...
463     Cl ...
464     I ...
465     I ...
466    
467     \end{lstlisting}
468    
469    
470     \subsection{The Statistics File}
471    
472     The last output file generated by {\sc oopse} is the statistics
473     file. This file records such statistical quantities as the
474     instantaneous temperature, volume, pressure, etc. It is written out
475     with the frequency specified in the \texttt{.bass} file with the
476     \texttt{statusTime} keyword. The file allows the user to observe the
477     system variables as a function of simulation time while the simulation
478     is in progress. One useful function the statistics file serves is to
479     monitor the conserved quantity of a given simulation ensemble, this
480     allows the user to observe the stability of the integrator. The
481     statistics file is denoted with the \texttt{.stat} file extension.
482    
483    
484     \section{\label{oopseSec:empiricalEnergy}The Empirical Energy Functions}
485    
486     \
487 mmeineke 1121 \subsection{\label{sec:LJPot}The Lennard Jones Force Field}
488    
489     The most basic force field implemented in {\sc oopse} is the
490     Lennard-Jones force field, which mimics the van der Waals interaction at
491     long distances, and uses an empirical repulsion at short
492     distances. The Lennard-Jones potential is given by:
493     \begin{equation}
494     V_{\text{LJ}}(r_{ij}) =
495     4\epsilon_{ij} \biggl[
496     \biggl(\frac{\sigma_{ij}}{r_{ij}}\biggr)^{12}
497     - \biggl(\frac{\sigma_{ij}}{r_{ij}}\biggr)^{6}
498     \biggr],
499     \label{eq:lennardJonesPot}
500     \end{equation}
501     where $r_{ij}$ is the distance between particles $i$ and $j$,
502     $\sigma_{ij}$ scales the length of the interaction, and
503     $\epsilon_{ij}$ scales the well depth of the potential. Scheme
504     \ref{sch:LJFF} gives an example \texttt{.bass} file that
505     sets up a system of 108 Ar particles to be simulated using the
506     Lennard-Jones force field.
507    
508     \begin{lstlisting}[float,caption={[Invocation of the Lennard-Jones force field] A sample system using the Lennard-Jones force field.},label={sch:LJFF}]
509    
510     #include "argon.mdl"
511    
512     nComponents = 1;
513     component{
514     type = "Ar";
515     nMol = 108;
516     }
517    
518     initialConfig = "./argon.init";
519    
520     forceField = "LJ";
521     \end{lstlisting}
522    
523     Because this potential is calculated between all pairs, the force
524     evaluation can become computationally expensive for large systems. To
525     keep the pair evaluations to a manageable number, {\sc oopse} employs
526     a cut-off radius.\cite{allen87:csl} The cutoff radius can either be
527     specified in the \texttt{.bass} file, or left as its default value of
528     $2.5\sigma_{ii}$, where $\sigma_{ii}$ is the largest Lennard-Jones
529     length parameter present in the simulation. Truncating the calculation
530     at $r_{\text{cut}}$ introduces a discontinuity into the potential
531     energy and the force. To offset this discontinuity in the potential,
532     the energy value at $r_{\text{cut}}$ is subtracted from the
533     potential. This causes the potential to go to zero smoothly at the
534     cut-off radius, and preserves conservation of energy in integrating
535     the equations of motion. There still remains a discontinuity in the derivative (the forces), however, this does not significantly affect the dynamics.
536    
537     Interactions between dissimilar particles requires the generation of
538     cross term parameters for $\sigma$ and $\epsilon$. These are
539     calculated through the Lorentz-Berthelot mixing
540     rules:\cite{allen87:csl}
541     \begin{equation}
542     \sigma_{ij} = \frac{1}{2}[\sigma_{ii} + \sigma_{jj}],
543     \label{eq:sigmaMix}
544     \end{equation}
545     and
546     \begin{equation}
547     \epsilon_{ij} = \sqrt{\epsilon_{ii} \epsilon_{jj}}.
548     \label{eq:epsilonMix}
549     \end{equation}
550    
551     \subsection{\label{oopseSec:DUFF}Dipolar Unified-Atom Force Field}
552    
553     The dipolar unified-atom force field ({\sc duff}) was developed to
554     simulate lipid bilayers. The simulations require a model capable of
555     forming bilayers, while still being sufficiently computationally
556     efficient to allow large systems ($\sim$100's of phospholipids,
557     $\sim$1000's of waters) to be simulated for long times
558     ($\sim$10's of nanoseconds).
559    
560     With this goal in mind, {\sc duff} has no point
561     charges. Charge-neutral distributions were replaced with dipoles,
562     while most atoms and groups of atoms were reduced to Lennard-Jones
563     interaction sites. This simplification cuts the length scale of long
564 mmeineke 1168 range interactions from $\frac{1}{r}$ to $\frac{1}{r^3}$, removing the need for the computationally expensive Ewald sum. Instead, we Verlet neighbor-lists and cutoff radii are used for the dipolar interactions, or a reaction field is added to mimic longer range interactions.
565 mmeineke 1121
566     As an example, lipid head-groups in {\sc duff} are represented as
567     point dipole interaction sites. By placing a dipole at the head
568     group's center of mass, our model mimics the charge separation found
569     in common phospholipid head groups such as
570     phosphatidylcholine.\cite{Cevc87} Additionally, a large Lennard-Jones
571     site is located at the pseudoatom's center of mass. The model is
572     illustrated by the red atom in Fig.~\ref{oopseFig:lipidModel}. The
573     water model we use to complement the dipoles of the lipids is our
574 mmeineke 1168 reparameterization\cite{fennell04} of the soft sticky dipole (SSD) model of Ichiye
575 mmeineke 1121 \emph{et al.}\cite{liu96:new_model}
576    
577     \begin{figure}
578     \centering
579     \includegraphics[width=\linewidth]{twoChainFig.pdf}
580     \caption[A representation of a lipid model in {\sc duff}]{A representation of the lipid model. $\phi$ is the torsion angle, $\theta$ %
581     is the bend angle, and $\mu$ is the dipole moment of the head group.}
582     \label{oopseFig:lipidModel}
583     \end{figure}
584    
585     We have used a set of scalable parameters to model the alkyl groups
586     with Lennard-Jones sites. For this, we have borrowed parameters from
587     the TraPPE force field of Siepmann
588     \emph{et al}.\cite{Siepmann1998} TraPPE is a unified-atom
589     representation of n-alkanes, which is parametrized against phase
590     equilibria using Gibbs ensemble Monte Carlo simulation
591     techniques.\cite{Siepmann1998} One of the advantages of TraPPE is that
592     it generalizes the types of atoms in an alkyl chain to keep the number
593     of pseudoatoms to a minimum; the parameters for a unified atom such as
594     $\text{CH}_2$ do not change depending on what species are bonded to
595     it.
596    
597 mmeineke 1168 TraPPE and {\sc duff} also constrain all bonds to be of fixed length. Typically,
598 mmeineke 1121 bond vibrations are the fastest motions in a molecular dynamic
599     simulation. Small time steps between force evaluations must be used to
600     ensure adequate energy conservation in the bond degrees of freedom. By
601     constraining the bond lengths, larger time steps may be used when
602     integrating the equations of motion. A simulation using {\sc duff} is
603     illustrated in Scheme \ref{sch:DUFF}.
604    
605     \begin{lstlisting}[float,caption={[Invocation of {\sc duff}]A portion of a \texttt{.bass} file showing a simulation utilizing {\sc duff}},label={sch:DUFF}]
606    
607     #include "water.mdl"
608     #include "lipid.mdl"
609    
610     nComponents = 2;
611     component{
612     type = "simpleLipid_16";
613     nMol = 60;
614     }
615    
616     component{
617     type = "SSD_water";
618     nMol = 1936;
619     }
620    
621     initialConfig = "bilayer.init";
622    
623     forceField = "DUFF";
624    
625     \end{lstlisting}
626    
627 mmeineke 1168 \subsubsection{\label{oopseSec:energyFunctions}{\sc duff} Energy Functions}
628 mmeineke 1121
629     The total potential energy function in {\sc duff} is
630     \begin{equation}
631     V = \sum^{N}_{I=1} V^{I}_{\text{Internal}}
632     + \sum^{N-1}_{I=1} \sum_{J>I} V^{IJ}_{\text{Cross}},
633     \label{eq:totalPotential}
634     \end{equation}
635     where $V^{I}_{\text{Internal}}$ is the internal potential of molecule $I$:
636     \begin{equation}
637     V^{I}_{\text{Internal}} =
638     \sum_{\theta_{ijk} \in I} V_{\text{bend}}(\theta_{ijk})
639     + \sum_{\phi_{ijkl} \in I} V_{\text{torsion}}(\phi_{ijkl})
640     + \sum_{i \in I} \sum_{(j>i+4) \in I}
641     \biggl[ V_{\text{LJ}}(r_{ij}) + V_{\text{dipole}}
642     (\mathbf{r}_{ij},\boldsymbol{\Omega}_{i},\boldsymbol{\Omega}_{j})
643     \biggr].
644     \label{eq:internalPotential}
645     \end{equation}
646     Here $V_{\text{bend}}$ is the bend potential for all 1, 3 bonded pairs
647     within the molecule $I$, and $V_{\text{torsion}}$ is the torsion potential
648     for all 1, 4 bonded pairs. The pairwise portions of the internal
649     potential are excluded for atom pairs that are involved in the same bond, bend, or torsion. All other atom pairs within the molecule are subject to the LJ pair potential.
650    
651    
652     The bend potential of a molecule is represented by the following function:
653     \begin{equation}
654     V_{\text{bend}}(\theta_{ijk}) = k_{\theta}( \theta_{ijk} - \theta_0 )^2, \label{eq:bendPot}
655     \end{equation}
656     where $\theta_{ijk}$ is the angle defined by atoms $i$, $j$, and $k$
657     (see Fig.~\ref{oopseFig:lipidModel}), $\theta_0$ is the equilibrium
658     bond angle, and $k_{\theta}$ is the force constant which determines the
659     strength of the harmonic bend. The parameters for $k_{\theta}$ and
660     $\theta_0$ are borrowed from those in TraPPE.\cite{Siepmann1998}
661    
662     The torsion potential and parameters are also borrowed from TraPPE. It is
663     of the form:
664     \begin{equation}
665     V_{\text{torsion}}(\phi) = c_1[1 + \cos \phi]
666     + c_2[1 + \cos(2\phi)]
667     + c_3[1 + \cos(3\phi)],
668     \label{eq:origTorsionPot}
669     \end{equation}
670     where:
671     \begin{equation}
672     \cos\phi = (\hat{\mathbf{r}}_{ij} \times \hat{\mathbf{r}}_{jk}) \cdot
673     (\hat{\mathbf{r}}_{jk} \times \hat{\mathbf{r}}_{kl}).
674     \label{eq:torsPhi}
675     \end{equation}
676     Here, $\hat{\mathbf{r}}_{\alpha\beta}$ are the set of unit bond
677     vectors between atoms $i$, $j$, $k$, and $l$. For computational
678     efficiency, the torsion potential has been recast after the method of
679     {\sc charmm},\cite{Brooks83} in which the angle series is converted to
680     a power series of the form:
681     \begin{equation}
682     V_{\text{torsion}}(\phi) =
683     k_3 \cos^3 \phi + k_2 \cos^2 \phi + k_1 \cos \phi + k_0,
684     \label{eq:torsionPot}
685     \end{equation}
686     where:
687     \begin{align*}
688     k_0 &= c_1 + c_3, \\
689     k_1 &= c_1 - 3c_3, \\
690     k_2 &= 2 c_2, \\
691     k_3 &= 4c_3.
692     \end{align*}
693     By recasting the potential as a power series, repeated trigonometric
694     evaluations are avoided during the calculation of the potential energy.
695    
696    
697     The cross potential between molecules $I$ and $J$, $V^{IJ}_{\text{Cross}}$, is
698     as follows:
699     \begin{equation}
700     V^{IJ}_{\text{Cross}} =
701     \sum_{i \in I} \sum_{j \in J}
702     \biggl[ V_{\text{LJ}}(r_{ij}) + V_{\text{dipole}}
703     (\mathbf{r}_{ij},\boldsymbol{\Omega}_{i},\boldsymbol{\Omega}_{j})
704     + V_{\text{sticky}}
705     (\mathbf{r}_{ij},\boldsymbol{\Omega}_{i},\boldsymbol{\Omega}_{j})
706     \biggr],
707     \label{eq:crossPotentail}
708     \end{equation}
709     where $V_{\text{LJ}}$ is the Lennard Jones potential,
710     $V_{\text{dipole}}$ is the dipole dipole potential, and
711     $V_{\text{sticky}}$ is the sticky potential defined by the SSD model
712     (Sec.~\ref{oopseSec:SSD}). Note that not all atom types include all
713     interactions.
714    
715     The dipole-dipole potential has the following form:
716     \begin{equation}
717     V_{\text{dipole}}(\mathbf{r}_{ij},\boldsymbol{\Omega}_{i},
718     \boldsymbol{\Omega}_{j}) = \frac{|\mu_i||\mu_j|}{4\pi\epsilon_{0}r_{ij}^{3}} \biggl[
719     \boldsymbol{\hat{u}}_{i} \cdot \boldsymbol{\hat{u}}_{j}
720     -
721     3(\boldsymbol{\hat{u}}_i \cdot \hat{\mathbf{r}}_{ij}) %
722     (\boldsymbol{\hat{u}}_j \cdot \hat{\mathbf{r}}_{ij}) \biggr].
723     \label{eq:dipolePot}
724     \end{equation}
725     Here $\mathbf{r}_{ij}$ is the vector starting at atom $i$ pointing
726     towards $j$, and $\boldsymbol{\Omega}_i$ and $\boldsymbol{\Omega}_j$
727     are the orientational degrees of freedom for atoms $i$ and $j$
728     respectively. $|\mu_i|$ is the magnitude of the dipole moment of atom
729     $i$, $\boldsymbol{\hat{u}}_i$ is the standard unit orientation vector
730     of $\boldsymbol{\Omega}_i$, and $\boldsymbol{\hat{r}}_{ij}$ is the
731     unit vector pointing along $\mathbf{r}_{ij}$
732     ($\boldsymbol{\hat{r}}_{ij}=\mathbf{r}_{ij}/|\mathbf{r}_{ij}|$).
733    
734     To improve computational efficiency of the dipole-dipole interactions,
735     {\sc oopse} employs an electrostatic cutoff radius. This parameter can
736     be set in the \texttt{.bass} file, and controls the length scale over
737     which dipole interactions are felt. To compensate for the
738     discontinuity in the potential and the forces at the cutoff radius, we
739     have implemented a switching function to smoothly scale the
740     dipole-dipole interaction at the cutoff.
741     \begin{equation}
742     S(r_{ij}) =
743     \begin{cases}
744     1 & \text{if $r_{ij} \le r_t$},\\
745     \frac{(r_{\text{cut}} + 2r_{ij} - 3r_t)(r_{\text{cut}} - r_{ij})^2}
746     {(r_{\text{cut}} - r_t)^2}
747     & \text{if $r_t < r_{ij} \le r_{\text{cut}}$}, \\
748     0 & \text{if $r_{ij} > r_{\text{cut}}$.}
749     \end{cases}
750     \label{eq:dipoleSwitching}
751     \end{equation}
752     Here $S(r_{ij})$ scales the potential at a given $r_{ij}$, and $r_t$
753     is the taper radius some given thickness less than the electrostatic
754     cutoff. The switching thickness can be set in the \texttt{.bass} file.
755    
756 mmeineke 1168 \subsubsection{\label{oopseSec:SSD}The {\sc duff} Water Models: SSD/E and SSD/RF}
757 mmeineke 1121
758     In the interest of computational efficiency, the default solvent used
759     by {\sc oopse} is the extended Soft Sticky Dipole (SSD/E) water
760     model.\cite{fennell04} The original SSD was developed by Ichiye
761     \emph{et al.}\cite{liu96:new_model} as a modified form of the hard-sphere
762     water model proposed by Bratko, Blum, and
763     Luzar.\cite{Bratko85,Bratko95} It consists of a single point dipole
764     with a Lennard-Jones core and a sticky potential that directs the
765     particles to assume the proper hydrogen bond orientation in the first
766     solvation shell. Thus, the interaction between two SSD water molecules
767     \emph{i} and \emph{j} is given by the potential
768     \begin{equation}
769     V_{ij} =
770     V_{ij}^{LJ} (r_{ij})\ + V_{ij}^{dp}
771     (\mathbf{r}_{ij},\boldsymbol{\Omega}_i,\boldsymbol{\Omega}_j)\ +
772     V_{ij}^{sp}
773     (\mathbf{r}_{ij},\boldsymbol{\Omega}_i,\boldsymbol{\Omega}_j),
774     \label{eq:ssdPot}
775     \end{equation}
776     where the $\mathbf{r}_{ij}$ is the position vector between molecules
777     \emph{i} and \emph{j} with magnitude equal to the distance $r_{ij}$, and
778     $\boldsymbol{\Omega}_i$ and $\boldsymbol{\Omega}_j$ represent the
779     orientations of the respective molecules. The Lennard-Jones and dipole
780     parts of the potential are given by equations \ref{eq:lennardJonesPot}
781     and \ref{eq:dipolePot} respectively. The sticky part is described by
782     the following,
783     \begin{equation}
784     u_{ij}^{sp}(\mathbf{r}_{ij},\boldsymbol{\Omega}_i,\boldsymbol{\Omega}_j)=
785     \frac{\nu_0}{2}[s(r_{ij})w(\mathbf{r}_{ij},
786     \boldsymbol{\Omega}_i,\boldsymbol{\Omega}_j) +
787     s^\prime(r_{ij})w^\prime(\mathbf{r}_{ij},
788     \boldsymbol{\Omega}_i,\boldsymbol{\Omega}_j)]\ ,
789     \label{eq:stickyPot}
790     \end{equation}
791     where $\nu_0$ is a strength parameter for the sticky potential, and
792     $s$ and $s^\prime$ are cubic switching functions which turn off the
793     sticky interaction beyond the first solvation shell. The $w$ function
794     can be thought of as an attractive potential with tetrahedral
795     geometry:
796     \begin{equation}
797     w({\bf r}_{ij},{\bf \Omega}_i,{\bf \Omega}_j)=
798     \sin\theta_{ij}\sin2\theta_{ij}\cos2\phi_{ij},
799     \label{eq:stickyW}
800     \end{equation}
801     while the $w^\prime$ function counters the normal aligned and
802     anti-aligned structures favored by point dipoles:
803     \begin{equation}
804     w^\prime({\bf r}_{ij},{\bf \Omega}_i,{\bf \Omega}_j)=
805     (\cos\theta_{ij}-0.6)^2(\cos\theta_{ij}+0.8)^2-w^0,
806     \label{eq:stickyWprime}
807     \end{equation}
808     It should be noted that $w$ is proportional to the sum of the $Y_3^2$
809     and $Y_3^{-2}$ spherical harmonics (a linear combination which
810     enhances the tetrahedral geometry for hydrogen bonded structures),
811     while $w^\prime$ is a purely empirical function. A more detailed
812     description of the functional parts and variables in this potential
813     can be found in the original SSD
814     articles.\cite{liu96:new_model,liu96:monte_carlo,chandra99:ssd_md,Ichiye03}
815    
816     Since SSD/E is a single-point {\it dipolar} model, the force
817     calculations are simplified significantly relative to the standard
818     {\it charged} multi-point models. In the original Monte Carlo
819     simulations using this model, Ichiye {\it et al.} reported that using
820     SSD decreased computer time by a factor of 6-7 compared to other
821     models.\cite{liu96:new_model} What is most impressive is that these savings
822     did not come at the expense of accurate depiction of the liquid state
823     properties. Indeed, SSD/E maintains reasonable agreement with the Head-Gordon
824     diffraction data for the structural features of liquid
825     water.\cite{hura00,liu96:new_model} Additionally, the dynamical properties
826     exhibited by SSD/E agree with experiment better than those of more
827     computationally expensive models (like TIP3P and
828     SPC/E).\cite{chandra99:ssd_md} The combination of speed and accurate depiction
829     of solvent properties makes SSD/E a very attractive model for the
830     simulation of large scale biochemical simulations.
831    
832     Recent constant pressure simulations revealed issues in the original
833     SSD model that led to lower than expected densities at all target
834     pressures.\cite{Ichiye03,fennell04} The default model in {\sc oopse}
835     is therefore SSD/E, a density corrected derivative of SSD that
836     exhibits improved liquid structure and transport behavior. If the use
837     of a reaction field long-range interaction correction is desired, it
838     is recommended that the parameters be modified to those of the SSD/RF
839     model (an SSD variant parameterized for reaction field). Solvent parameters can be easily modified in an accompanying
840     \texttt{.bass} file as illustrated in the scheme below. A table of the
841     parameter values and the drawbacks and benefits of the different
842     density corrected SSD models can be found in
843     reference~\cite{fennell04}.
844    
845     \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}]
846    
847     #include "water.mdl"
848    
849     nComponents = 1;
850     component{
851     type = "SSD_water";
852     nMol = 864;
853     }
854    
855     initialConfig = "liquidWater.init";
856    
857     forceField = "DUFF";
858    
859     /*
860     * The following two flags set the cutoff
861     * radius for the electrostatic forces
862     * as well as the skin thickness of the switching
863     * function.
864     */
865    
866     electrostaticCutoffRadius = 9.2;
867     electrostaticSkinThickness = 1.38;
868    
869     \end{lstlisting}
870    
871    
872     \subsection{\label{oopseSec:eam}Embedded Atom Method}
873    
874 mmeineke 1168 {\sc oopse} implements a potential that
875     describes bonding transition metal
876     systems\cite{Finnis84,Ercolessi88,Chen90,Qi99,Ercolessi02} and has attractive interaction which models ``Embedding''
877 mmeineke 1121 a positively charged metal ion in the electron density due to the
878     free valance ``sea'' of electrons created by the surrounding atoms in
879     the system. A mostly-repulsive pairwise part of the potential
880     describes the interaction of the positively charged metal core ions
881     with one another. A particular potential description called the
882     Embedded Atom Method\cite{Daw84,FBD86,johnson89,Lu97}({\sc eam}) that has
883     particularly wide adoption has been selected for inclusion in {\sc oopse}. A
884     good review of {\sc eam} and other metallic potential formulations was written
885     by Voter.\cite{voter}
886    
887     The {\sc eam} potential has the form:
888     \begin{eqnarray}
889     V & = & \sum_{i} F_{i}\left[\rho_{i}\right] + \sum_{i} \sum_{j \neq i}
890     \phi_{ij}({\bf r}_{ij}), \\
891     \rho_{i} & = & \sum_{j \neq i} f_{j}({\bf r}_{ij}),
892     \end{eqnarray}
893     where $F_{i} $ is the embedding function that equates the energy
894     required to embed a positively-charged core ion $i$ into a linear
895     superposition of spherically averaged atomic electron densities given
896     by $\rho_{i}$. $\phi_{ij}$ is a primarily repulsive pairwise
897     interaction between atoms $i$ and $j$. In the original formulation of
898     {\sc eam}\cite{Daw84}, $\phi_{ij}$ was an entirely repulsive term,
899     however in later refinements to {\sc eam} have shown that non-uniqueness
900     between $F$ and $\phi$ allow for more general forms for
901     $\phi$.\cite{Daw89} There is a cutoff distance, $r_{cut}$, which
902     limits the summations in the {\sc eam} equation to the few dozen atoms
903     surrounding atom $i$ for both the density $\rho$ and pairwise $\phi$
904     interactions. Foiles \emph{et al}.~fit {\sc eam} potentials for the fcc
905     metals Cu, Ag, Au, Ni, Pd, Pt and alloys of these metals.\cite{FBD86}
906     These fits are included in {\sc oopse}.
907    
908     \subsection{\label{oopseSec:pbc}Periodic Boundary Conditions}
909    
910     \newcommand{\roundme}{\operatorname{round}}
911    
912     \textit{Periodic boundary conditions} are widely used to simulate bulk properties with a relatively small number of particles. The
913     simulation box is replicated throughout space to form an infinite
914     lattice. During the simulation, when a particle moves in the primary
915     cell, its image in other cells move in exactly the same direction with
916     exactly the same orientation. Thus, as a particle leaves the primary
917     cell, one of its images will enter through the opposite face. If the
918     simulation box is large enough to avoid ``feeling'' the symmetries of
919     the periodic lattice, surface effects can be ignored. The available
920     periodic cells in OOPSE are cubic, orthorhombic and parallelepiped. We
921     use a $3 \times 3$ matrix, $\mathsf{H}$, to describe the shape and
922     size of the simulation box. $\mathsf{H}$ is defined:
923     \begin{equation}
924     \mathsf{H} = ( \mathbf{h}_x, \mathbf{h}_y, \mathbf{h}_z ),
925     \end{equation}
926     where $\mathbf{h}_{\alpha}$ is the column vector of the $\alpha$ axis of the
927     box. During the course of the simulation both the size and shape of
928     the box can be changed to allow volume fluctuations when constraining
929     the pressure.
930    
931     A real space vector, $\mathbf{r}$ can be transformed in to a box space
932     vector, $\mathbf{s}$, and back through the following transformations:
933     \begin{align}
934     \mathbf{s} &= \mathsf{H}^{-1} \mathbf{r}, \\
935     \mathbf{r} &= \mathsf{H} \mathbf{s}.
936     \end{align}
937     The vector $\mathbf{s}$ is now a vector expressed as the number of box
938     lengths in the $\mathbf{h}_x$, $\mathbf{h}_y$, and $\mathbf{h}_z$
939     directions. To find the minimum image of a vector $\mathbf{r}$, we
940     first convert it to its corresponding vector in box space, and then,
941     cast each element to lie in the range $[-0.5,0.5]$:
942     \begin{equation}
943     s_{i}^{\prime}=s_{i}-\roundme(s_{i}),
944     \end{equation}
945     where $s_i$ is the $i$th element of $\mathbf{s}$, and
946     $\roundme(s_i)$ is given by
947     \begin{equation}
948     \roundme(x) =
949     \begin{cases}
950     \lfloor x+0.5 \rfloor & \text{if $x \ge 0$,} \\
951     \lceil x-0.5 \rceil & \text{if $x < 0$.}
952     \end{cases}
953     \end{equation}
954     Here $\lfloor x \rfloor$ is the floor operator, and gives the largest
955     integer value that is not greater than $x$, and $\lceil x \rceil$ is
956     the ceiling operator, and gives the smallest integer that is not less
957     than $x$. For example, $\roundme(3.6)=4$, $\roundme(3.1)=3$,
958     $\roundme(-3.6)=-4$, $\roundme(-3.1)=-3$.
959    
960     Finally, we obtain the minimum image coordinates $\mathbf{r}^{\prime}$ by
961     transforming back to real space,
962     \begin{equation}
963     \mathbf{r}^{\prime}=\mathsf{H}^{-1}\mathbf{s}^{\prime}.%
964     \end{equation}
965     In this way, particles are allowed to diffuse freely in $\mathbf{r}$,
966     but their minimum images, $\mathbf{r}^{\prime}$ are used to compute
967     the inter-atomic forces.
968    
969    
970    
971     \section{\label{oopseSec:mechanics}Mechanics}
972    
973     \subsection{\label{oopseSec:integrate}Integrating the Equations of Motion: the
974     DLM method}
975    
976     The default method for integrating the equations of motion in {\sc
977     oopse} is a velocity-Verlet version of the symplectic splitting method
978     proposed by Dullweber, Leimkuhler and McLachlan
979     (DLM).\cite{Dullweber1997} When there are no directional atoms or
980     rigid bodies present in the simulation, this integrator becomes the
981     standard velocity-Verlet integrator which is known to sample the
982     microcanonical (NVE) ensemble.\cite{Frenkel1996}
983    
984     Previous integration methods for orientational motion have problems
985     that are avoided in the DLM method. Direct propagation of the Euler
986     angles has a known $1/\sin\theta$ divergence in the equations of
987     motion for $\phi$ and $\psi$,\cite{allen87:csl} leading to
988     numerical instabilities any time one of the directional atoms or rigid
989     bodies has an orientation near $\theta=0$ or $\theta=\pi$. More
990     modern quaternion-based integration methods have relatively poor
991     energy conservation. While quaternions work well for orientational
992     motion in other ensembles, the microcanonical ensemble has a
993     constant energy requirement that is quite sensitive to errors in the
994     equations of motion. An earlier implementation of {\sc oopse}
995     utilized quaternions for propagation of rotational motion; however, a
996     detailed investigation showed that they resulted in a steady drift in
997     the total energy, something that has been observed by
998     Laird {\it et al.}\cite{Laird97}
999    
1000     The key difference in the integration method proposed by Dullweber
1001     \emph{et al.} is that the entire $3 \times 3$ rotation matrix is
1002     propagated from one time step to the next. In the past, this would not
1003     have been feasible, since the rotation matrix for a single body has
1004     nine elements compared with the more memory-efficient methods (using
1005     three Euler angles or 4 quaternions). Computer memory has become much
1006     less costly in recent years, and this can be translated into
1007     substantial benefits in energy conservation.
1008    
1009     The basic equations of motion being integrated are derived from the
1010     Hamiltonian for conservative systems containing rigid bodies,
1011     \begin{equation}
1012     H = \sum_{i} \left( \frac{1}{2} m_i {\bf v}_i^T \cdot {\bf v}_i +
1013     \frac{1}{2} {\bf j}_i^T \cdot \overleftrightarrow{\mathsf{I}}_i^{-1} \cdot
1014     {\bf j}_i \right) +
1015     V\left(\left\{{\bf r}\right\}, \left\{\mathsf{A}\right\}\right),
1016     \end{equation}
1017     where ${\bf r}_i$ and ${\bf v}_i$ are the cartesian position vector
1018     and velocity of the center of mass of particle $i$, and ${\bf j}_i$,
1019     $\overleftrightarrow{\mathsf{I}}_i$ are the body-fixed angular
1020     momentum and moment of inertia tensor respectively, and the
1021     superscript $T$ denotes the transpose of the vector. $\mathsf{A}_i$
1022     is the $3 \times 3$ rotation matrix describing the instantaneous
1023     orientation of the particle. $V$ is the potential energy function
1024     which may depend on both the positions $\left\{{\bf r}\right\}$ and
1025     orientations $\left\{\mathsf{A}\right\}$ of all particles. The
1026     equations of motion for the particle centers of mass are derived from
1027     Hamilton's equations and are quite simple,
1028     \begin{eqnarray}
1029     \dot{{\bf r}} & = & {\bf v}, \\
1030     \dot{{\bf v}} & = & \frac{{\bf f}}{m},
1031     \end{eqnarray}
1032     where ${\bf f}$ is the instantaneous force on the center of mass
1033     of the particle,
1034     \begin{equation}
1035     {\bf f} = - \frac{\partial}{\partial
1036     {\bf r}} V(\left\{{\bf r}(t)\right\}, \left\{\mathsf{A}(t)\right\}).
1037     \end{equation}
1038    
1039     The equations of motion for the orientational degrees of freedom are
1040     \begin{eqnarray}
1041     \dot{\mathsf{A}} & = & \mathsf{A} \cdot
1042     \mbox{ skew}\left(\overleftrightarrow{\mathsf{I}}^{-1} \cdot {\bf j}\right),\\
1043     \dot{{\bf j}} & = & {\bf j} \times \left( \overleftrightarrow{\mathsf{I}}^{-1}
1044     \cdot {\bf j} \right) - \mbox{ rot}\left(\mathsf{A}^{T} \cdot \frac{\partial
1045     V}{\partial \mathsf{A}} \right).
1046     \end{eqnarray}
1047     In these equations of motion, the $\mbox{skew}$ matrix of a vector
1048     ${\bf v} = \left( v_1, v_2, v_3 \right)$ is defined:
1049     \begin{equation}
1050     \mbox{skew}\left( {\bf v} \right) := \left(
1051     \begin{array}{ccc}
1052     0 & v_3 & - v_2 \\
1053     -v_3 & 0 & v_1 \\
1054     v_2 & -v_1 & 0
1055     \end{array}
1056     \right).
1057     \end{equation}
1058     The $\mbox{rot}$ notation refers to the mapping of the $3 \times 3$
1059     rotation matrix to a vector of orientations by first computing the
1060     skew-symmetric part $\left(\mathsf{A} - \mathsf{A}^{T}\right)$ and
1061     then associating this with a length 3 vector by inverting the
1062     $\mbox{skew}$ function above:
1063     \begin{equation}
1064     \mbox{rot}\left(\mathsf{A}\right) := \mbox{ skew}^{-1}\left(\mathsf{A}
1065     - \mathsf{A}^{T} \right).
1066     \end{equation}
1067     Written this way, the $\mbox{rot}$ operation creates a set of
1068     conjugate angle coordinates to the body-fixed angular momenta
1069     represented by ${\bf j}$. This equation of motion for angular momenta
1070     is equivalent to the more familiar body-fixed forms,
1071     \begin{eqnarray}
1072     \dot{j_{x}} & = & \tau^b_x(t) +
1073     \left(\overleftrightarrow{\mathsf{I}}_{yy} - \overleftrightarrow{\mathsf{I}}_{zz} \right) j_y j_z, \\
1074     \dot{j_{y}} & = & \tau^b_y(t) +
1075     \left(\overleftrightarrow{\mathsf{I}}_{zz} - \overleftrightarrow{\mathsf{I}}_{xx} \right) j_z j_x,\\
1076     \dot{j_{z}} & = & \tau^b_z(t) +
1077     \left(\overleftrightarrow{\mathsf{I}}_{xx} - \overleftrightarrow{\mathsf{I}}_{yy} \right) j_x j_y,
1078     \end{eqnarray}
1079     which utilize the body-fixed torques, ${\bf \tau}^b$. Torques are
1080     most easily derived in the space-fixed frame,
1081     \begin{equation}
1082     {\bf \tau}^b(t) = \mathsf{A}(t) \cdot {\bf \tau}^s(t),
1083     \end{equation}
1084     where the torques are either derived from the forces on the
1085     constituent atoms of the rigid body, or for directional atoms,
1086     directly from derivatives of the potential energy,
1087     \begin{equation}
1088     {\bf \tau}^s(t) = - \hat{\bf u}(t) \times \left( \frac{\partial}
1089     {\partial \hat{\bf u}} V\left(\left\{ {\bf r}(t) \right\}, \left\{
1090     \mathsf{A}(t) \right\}\right) \right).
1091     \end{equation}
1092     Here $\hat{\bf u}$ is a unit vector pointing along the principal axis
1093     of the particle in the space-fixed frame.
1094    
1095     The DLM method uses a Trotter factorization of the orientational
1096     propagator. This has three effects:
1097     \begin{enumerate}
1098     \item the integrator is area-preserving in phase space (i.e. it is
1099     {\it symplectic}),
1100     \item the integrator is time-{\it reversible}, making it suitable for Hybrid
1101     Monte Carlo applications, and
1102     \item the error for a single time step is of order $\mathcal{O}\left(h^4\right)$
1103     for timesteps of length $h$.
1104     \end{enumerate}
1105    
1106     The integration of the equations of motion is carried out in a
1107     velocity-Verlet style 2-part algorithm, where $h= \delta t$:
1108    
1109     {\tt moveA:}
1110     \begin{align*}
1111     {\bf v}\left(t + h / 2\right) &\leftarrow {\bf v}(t)
1112     + \frac{h}{2} \left( {\bf f}(t) / m \right), \\
1113     %
1114     {\bf r}(t + h) &\leftarrow {\bf r}(t)
1115     + h {\bf v}\left(t + h / 2 \right), \\
1116     %
1117     {\bf j}\left(t + h / 2 \right) &\leftarrow {\bf j}(t)
1118     + \frac{h}{2} {\bf \tau}^b(t), \\
1119     %
1120     \mathsf{A}(t + h) &\leftarrow \mathrm{rotate}\left( h {\bf j}
1121     (t + h / 2) \cdot \overleftrightarrow{\mathsf{I}}^{-1} \right).
1122     \end{align*}
1123    
1124     In this context, the $\mathrm{rotate}$ function is the reversible product
1125     of the three body-fixed rotations,
1126     \begin{equation}
1127     \mathrm{rotate}({\bf a}) = \mathsf{G}_x(a_x / 2) \cdot
1128     \mathsf{G}_y(a_y / 2) \cdot \mathsf{G}_z(a_z) \cdot \mathsf{G}_y(a_y /
1129     2) \cdot \mathsf{G}_x(a_x /2),
1130     \end{equation}
1131     where each rotational propagator, $\mathsf{G}_\alpha(\theta)$, rotates
1132     both the rotation matrix ($\mathsf{A}$) and the body-fixed angular
1133     momentum (${\bf j}$) by an angle $\theta$ around body-fixed axis
1134     $\alpha$,
1135     \begin{equation}
1136     \mathsf{G}_\alpha( \theta ) = \left\{
1137     \begin{array}{lcl}
1138     \mathsf{A}(t) & \leftarrow & \mathsf{A}(0) \cdot \mathsf{R}_\alpha(\theta)^T, \\
1139     {\bf j}(t) & \leftarrow & \mathsf{R}_\alpha(\theta) \cdot {\bf j}(0).
1140     \end{array}
1141     \right.
1142     \end{equation}
1143     $\mathsf{R}_\alpha$ is a quadratic approximation to
1144     the single-axis rotation matrix. For example, in the small-angle
1145     limit, the rotation matrix around the body-fixed x-axis can be
1146     approximated as
1147     \begin{equation}
1148     \mathsf{R}_x(\theta) \approx \left(
1149     \begin{array}{ccc}
1150     1 & 0 & 0 \\
1151     0 & \frac{1-\theta^2 / 4}{1 + \theta^2 / 4} & -\frac{\theta}{1+
1152     \theta^2 / 4} \\
1153     0 & \frac{\theta}{1+
1154     \theta^2 / 4} & \frac{1-\theta^2 / 4}{1 + \theta^2 / 4}
1155     \end{array}
1156     \right).
1157     \end{equation}
1158     All other rotations follow in a straightforward manner.
1159    
1160     After the first part of the propagation, the forces and body-fixed
1161     torques are calculated at the new positions and orientations
1162    
1163     {\tt doForces:}
1164     \begin{align*}
1165     {\bf f}(t + h) &\leftarrow
1166     - \left(\frac{\partial V}{\partial {\bf r}}\right)_{{\bf r}(t + h)}, \\
1167     %
1168     {\bf \tau}^{s}(t + h) &\leftarrow {\bf u}(t + h)
1169     \times \frac{\partial V}{\partial {\bf u}}, \\
1170     %
1171     {\bf \tau}^{b}(t + h) &\leftarrow \mathsf{A}(t + h)
1172     \cdot {\bf \tau}^s(t + h).
1173     \end{align*}
1174    
1175     {\sc oopse} automatically updates ${\bf u}$ when the rotation matrix
1176     $\mathsf{A}$ is calculated in {\tt moveA}. Once the forces and
1177     torques have been obtained at the new time step, the velocities can be
1178     advanced to the same time value.
1179    
1180     {\tt moveB:}
1181     \begin{align*}
1182     {\bf v}\left(t + h \right) &\leftarrow {\bf v}\left(t + h / 2 \right)
1183     + \frac{h}{2} \left( {\bf f}(t + h) / m \right), \\
1184     %
1185     {\bf j}\left(t + h \right) &\leftarrow {\bf j}\left(t + h / 2 \right)
1186     + \frac{h}{2} {\bf \tau}^b(t + h) .
1187     \end{align*}
1188    
1189     The matrix rotations used in the DLM method end up being more costly
1190     computationally than the simpler arithmetic quaternion
1191     propagation. With the same time step, a 1000-molecule water simulation
1192     shows an average 7\% increase in computation time using the DLM method
1193     in place of quaternions. This cost is more than justified when
1194     comparing the energy conservation of the two methods as illustrated in
1195     Fig.~\ref{timestep}.
1196    
1197     \begin{figure}
1198     \centering
1199     \includegraphics[width=\linewidth]{timeStep.pdf}
1200     \caption[Energy conservation for quaternion versus DLM dynamics]{Energy conservation using quaternion based integration versus
1201     the method proposed by Dullweber \emph{et al.} with increasing time
1202     step. For each time step, the dotted line is total energy using the
1203     DLM integrator, and the solid line comes from the quaternion
1204     integrator. The larger time step plots are shifted up from the true
1205     energy baseline for clarity.}
1206     \label{timestep}
1207     \end{figure}
1208    
1209     In Fig.~\ref{timestep}, the resulting energy drift at various time
1210     steps for both the DLM and quaternion integration schemes is
1211     compared. All of the 1000 molecule water simulations started with the
1212     same configuration, and the only difference was the method for
1213     handling rotational motion. At time steps of 0.1 and 0.5 fs, both
1214     methods for propagating molecule rotation conserve energy fairly well,
1215     with the quaternion method showing a slight energy drift over time in
1216     the 0.5 fs time step simulation. At time steps of 1 and 2 fs, the
1217     energy conservation benefits of the DLM method are clearly
1218     demonstrated. Thus, while maintaining the same degree of energy
1219     conservation, one can take considerably longer time steps, leading to
1220     an overall reduction in computation time.
1221    
1222     There is only one specific keyword relevant to the default integrator,
1223     and that is the time step for integrating the equations of motion.
1224    
1225     \begin{center}
1226     \begin{tabular}{llll}
1227     {\bf variable} & {\bf {\tt .bass} keyword} & {\bf units} & {\bf
1228     default value} \\
1229     $h$ & {\tt dt = 2.0;} & fs & none
1230     \end{tabular}
1231     \end{center}
1232    
1233     \subsection{\label{sec:extended}Extended Systems for other Ensembles}
1234    
1235     {\sc oopse} implements a number of extended system integrators for
1236     sampling from other ensembles relevant to chemical physics. The
1237     integrator can selected with the {\tt ensemble} keyword in the
1238     {\tt .bass} file:
1239    
1240     \begin{center}
1241     \begin{tabular}{lll}
1242     {\bf Integrator} & {\bf Ensemble} & {\bf {\tt .bass} line} \\
1243     NVE & microcanonical & {\tt ensemble = NVE; } \\
1244     NVT & canonical & {\tt ensemble = NVT; } \\
1245     NPTi & isobaric-isothermal & {\tt ensemble = NPTi;} \\
1246     & (with isotropic volume changes) & \\
1247     NPTf & isobaric-isothermal & {\tt ensemble = NPTf;} \\
1248     & (with changes to box shape) & \\
1249     NPTxyz & approximate isobaric-isothermal & {\tt ensemble = NPTxyz;} \\
1250     & (with separate barostats on each box dimension) & \\
1251     \end{tabular}
1252     \end{center}
1253    
1254     The relatively well-known Nos\'e-Hoover thermostat\cite{Hoover85} is
1255     implemented in {\sc oopse}'s NVT integrator. This method couples an
1256     extra degree of freedom (the thermostat) to the kinetic energy of the
1257     system, and has been shown to sample the canonical distribution in the
1258     system degrees of freedom while conserving a quantity that is, to
1259     within a constant, the Helmholtz free energy.\cite{melchionna93}
1260    
1261     NPT algorithms attempt to maintain constant pressure in the system by
1262     coupling the volume of the system to a barostat. {\sc oopse} contains
1263     three different constant pressure algorithms. The first two, NPTi and
1264     NPTf have been shown to conserve a quantity that is, to within a
1265     constant, the Gibbs free energy.\cite{melchionna93} The Melchionna
1266     modification to the Hoover barostat is implemented in both NPTi and
1267     NPTf. NPTi allows only isotropic changes in the simulation box, while
1268     box {\it shape} variations are allowed in NPTf. The NPTxyz integrator
1269     has {\it not} been shown to sample from the isobaric-isothermal
1270     ensemble. It is useful, however, in that it maintains orthogonality
1271     for the axes of the simulation box while attempting to equalize
1272     pressure along the three perpendicular directions in the box.
1273    
1274     Each of the extended system integrators requires additional keywords
1275     to set target values for the thermodynamic state variables that are
1276     being held constant. Keywords are also required to set the
1277     characteristic decay times for the dynamics of the extended
1278     variables.
1279    
1280     \begin{center}
1281     \begin{tabular}{llll}
1282     {\bf variable} & {\bf {\tt .bass} keyword} & {\bf units} & {\bf
1283     default value} \\
1284     $T_{\mathrm{target}}$ & {\tt targetTemperature = 300;} & K & none \\
1285     $P_{\mathrm{target}}$ & {\tt targetPressure = 1;} & atm & none \\
1286     $\tau_T$ & {\tt tauThermostat = 1e3;} & fs & none \\
1287     $\tau_B$ & {\tt tauBarostat = 5e3;} & fs & none \\
1288     & {\tt resetTime = 200;} & fs & none \\
1289     & {\tt useInitialExtendedSystemState = true;} & logical &
1290     true
1291     \end{tabular}
1292     \end{center}
1293    
1294     Two additional keywords can be used to either clear the extended
1295     system variables periodically ({\tt resetTime}), or to maintain the
1296     state of the extended system variables between simulations ({\tt
1297     useInitialExtendedSystemState}). More details on these variables
1298     and their use in the integrators follows below.
1299    
1300     \subsection{\label{oopseSec:noseHooverThermo}Nos\'{e}-Hoover Thermostatting}
1301    
1302     The Nos\'e-Hoover equations of motion are given by\cite{Hoover85}
1303     \begin{eqnarray}
1304     \dot{{\bf r}} & = & {\bf v}, \\
1305     \dot{{\bf v}} & = & \frac{{\bf f}}{m} - \chi {\bf v} ,\\
1306     \dot{\mathsf{A}} & = & \mathsf{A} \cdot
1307     \mbox{ skew}\left(\overleftrightarrow{\mathsf{I}}^{-1} \cdot {\bf j}\right), \\
1308     \dot{{\bf j}} & = & {\bf j} \times \left( \overleftrightarrow{\mathsf{I}}^{-1}
1309     \cdot {\bf j} \right) - \mbox{ rot}\left(\mathsf{A}^{T} \cdot \frac{\partial
1310     V}{\partial \mathsf{A}} \right) - \chi {\bf j}.
1311     \label{eq:nosehoovereom}
1312     \end{eqnarray}
1313    
1314     $\chi$ is an ``extra'' variable included in the extended system, and
1315     it is propagated using the first order equation of motion
1316     \begin{equation}
1317     \dot{\chi} = \frac{1}{\tau_{T}^2} \left( \frac{T}{T_{\mathrm{target}}} - 1 \right).
1318     \label{eq:nosehooverext}
1319     \end{equation}
1320    
1321     The instantaneous temperature $T$ is proportional to the total kinetic
1322     energy (both translational and orientational) and is given by
1323     \begin{equation}
1324     T = \frac{2 K}{f k_B}
1325     \end{equation}
1326     Here, $f$ is the total number of degrees of freedom in the system,
1327     \begin{equation}
1328     f = 3 N + 3 N_{\mathrm{orient}} - N_{\mathrm{constraints}},
1329     \end{equation}
1330     and $K$ is the total kinetic energy,
1331     \begin{equation}
1332     K = \sum_{i=1}^{N} \frac{1}{2} m_i {\bf v}_i^T \cdot {\bf v}_i +
1333     \sum_{i=1}^{N_{\mathrm{orient}}} \frac{1}{2} {\bf j}_i^T \cdot
1334     \overleftrightarrow{\mathsf{I}}_i^{-1} \cdot {\bf j}_i.
1335     \end{equation}
1336    
1337     In eq.(\ref{eq:nosehooverext}), $\tau_T$ is the time constant for
1338     relaxation of the temperature to the target value. To set values for
1339     $\tau_T$ or $T_{\mathrm{target}}$ in a simulation, one would use the
1340     {\tt tauThermostat} and {\tt targetTemperature} keywords in the {\tt
1341     .bass} file. The units for {\tt tauThermostat} are fs, and the units
1342     for the {\tt targetTemperature} are degrees K. The integration of
1343     the equations of motion is carried out in a velocity-Verlet style 2
1344     part algorithm:
1345    
1346     {\tt moveA:}
1347     \begin{align*}
1348     T(t) &\leftarrow \left\{{\bf v}(t)\right\}, \left\{{\bf j}(t)\right\} ,\\
1349     %
1350     {\bf v}\left(t + h / 2\right) &\leftarrow {\bf v}(t)
1351     + \frac{h}{2} \left( \frac{{\bf f}(t)}{m} - {\bf v}(t)
1352     \chi(t)\right), \\
1353     %
1354     {\bf r}(t + h) &\leftarrow {\bf r}(t)
1355     + h {\bf v}\left(t + h / 2 \right) ,\\
1356     %
1357     {\bf j}\left(t + h / 2 \right) &\leftarrow {\bf j}(t)
1358     + \frac{h}{2} \left( {\bf \tau}^b(t) - {\bf j}(t)
1359     \chi(t) \right) ,\\
1360     %
1361     \mathsf{A}(t + h) &\leftarrow \mathrm{rotate}
1362     \left(h * {\bf j}(t + h / 2)
1363     \overleftrightarrow{\mathsf{I}}^{-1} \right) ,\\
1364     %
1365     \chi\left(t + h / 2 \right) &\leftarrow \chi(t)
1366     + \frac{h}{2 \tau_T^2} \left( \frac{T(t)}
1367     {T_{\mathrm{target}}} - 1 \right) .
1368     \end{align*}
1369    
1370     Here $\mathrm{rotate}(h * {\bf j}
1371     \overleftrightarrow{\mathsf{I}}^{-1})$ is the same symplectic Trotter
1372     factorization of the three rotation operations that was discussed in
1373     the section on the DLM integrator. Note that this operation modifies
1374     both the rotation matrix $\mathsf{A}$ and the angular momentum ${\bf
1375     j}$. {\tt moveA} propagates velocities by a half time step, and
1376     positional degrees of freedom by a full time step. The new positions
1377     (and orientations) are then used to calculate a new set of forces and
1378     torques in exactly the same way they are calculated in the {\tt
1379     doForces} portion of the DLM integrator.
1380    
1381     Once the forces and torques have been obtained at the new time step,
1382     the temperature, velocities, and the extended system variable can be
1383     advanced to the same time value.
1384    
1385     {\tt moveB:}
1386     \begin{align*}
1387     T(t + h) &\leftarrow \left\{{\bf v}(t + h)\right\},
1388     \left\{{\bf j}(t + h)\right\}, \\
1389     %
1390     \chi\left(t + h \right) &\leftarrow \chi\left(t + h /
1391     2 \right) + \frac{h}{2 \tau_T^2} \left( \frac{T(t+h)}
1392     {T_{\mathrm{target}}} - 1 \right), \\
1393     %
1394     {\bf v}\left(t + h \right) &\leftarrow {\bf v}\left(t
1395     + h / 2 \right) + \frac{h}{2} \left(
1396     \frac{{\bf f}(t + h)}{m} - {\bf v}(t + h)
1397     \chi(t h)\right) ,\\
1398     %
1399     {\bf j}\left(t + h \right) &\leftarrow {\bf j}\left(t
1400     + h / 2 \right) + \frac{h}{2}
1401     \left( {\bf \tau}^b(t + h) - {\bf j}(t + h)
1402     \chi(t + h) \right) .
1403     \end{align*}
1404    
1405     Since ${\bf v}(t + h)$ and ${\bf j}(t + h)$ are required to caclculate
1406     $T(t + h)$ as well as $\chi(t + h)$, they indirectly depend on their
1407     own values at time $t + h$. {\tt moveB} is therefore done in an
1408     iterative fashion until $\chi(t + h)$ becomes self-consistent. The
1409     relative tolerance for the self-consistency check defaults to a value
1410     of $\mbox{10}^{-6}$, but {\sc oopse} will terminate the iteration
1411     after 4 loops even if the consistency check has not been satisfied.
1412    
1413     The Nos\'e-Hoover algorithm is known to conserve a Hamiltonian for the
1414     extended system that is, to within a constant, identical to the
1415     Helmholtz free energy,\cite{melchionna93}
1416     \begin{equation}
1417     H_{\mathrm{NVT}} = V + K + f k_B T_{\mathrm{target}} \left(
1418     \frac{\tau_{T}^2 \chi^2(t)}{2} + \int_{0}^{t} \chi(t^\prime) dt^\prime
1419     \right).
1420     \end{equation}
1421     Poor choices of $h$ or $\tau_T$ can result in non-conservation
1422     of $H_{\mathrm{NVT}}$, so the conserved quantity is maintained in the
1423     last column of the {\tt .stat} file to allow checks on the quality of
1424     the integration.
1425    
1426     Bond constraints are applied at the end of both the {\tt moveA} and
1427     {\tt moveB} portions of the algorithm. Details on the constraint
1428     algorithms are given in section \ref{oopseSec:rattle}.
1429    
1430     \subsection{\label{sec:NPTi}Constant-pressure integration with
1431     isotropic box deformations (NPTi)}
1432    
1433     To carry out isobaric-isothermal ensemble calculations {\sc oopse}
1434     implements the Melchionna modifications to the Nos\'e-Hoover-Andersen
1435 mmeineke 1179 equations of motion.\cite{melchionna93} The equations of motion are the same as NVT with the following exceptions:
1436 mmeineke 1121
1437     \begin{eqnarray}
1438     \dot{{\bf r}} & = & {\bf v} + \eta \left( {\bf r} - {\bf R}_0 \right), \\
1439     \dot{{\bf v}} & = & \frac{{\bf f}}{m} - (\eta + \chi) {\bf v}, \\
1440     \dot{\eta} & = & \frac{1}{\tau_{B}^2 f k_B T_{\mathrm{target}}} V \left( P -
1441     P_{\mathrm{target}} \right), \\
1442     \dot{\mathcal{V}} & = & 3 \mathcal{V} \eta .
1443     \label{eq:melchionna1}
1444     \end{eqnarray}
1445    
1446     $\chi$ and $\eta$ are the ``extra'' degrees of freedom in the extended
1447     system. $\chi$ is a thermostat, and it has the same function as it
1448     does in the Nos\'e-Hoover NVT integrator. $\eta$ is a barostat which
1449     controls changes to the volume of the simulation box. ${\bf R}_0$ is
1450     the location of the center of mass for the entire system, and
1451     $\mathcal{V}$ is the volume of the simulation box. At any time, the
1452     volume can be calculated from the determinant of the matrix which
1453     describes the box shape:
1454     \begin{equation}
1455     \mathcal{V} = \det(\mathsf{H}).
1456     \end{equation}
1457    
1458     The NPTi integrator requires an instantaneous pressure. This quantity
1459     is calculated via the pressure tensor,
1460     \begin{equation}
1461     \overleftrightarrow{\mathsf{P}}(t) = \frac{1}{\mathcal{V}(t)} \left(
1462     \sum_{i=1}^{N} m_i {\bf v}_i(t) \otimes {\bf v}_i(t) \right) +
1463     \overleftrightarrow{\mathsf{W}}(t).
1464     \end{equation}
1465     The kinetic contribution to the pressure tensor utilizes the {\it
1466     outer} product of the velocities denoted by the $\otimes$ symbol. The
1467     stress tensor is calculated from another outer product of the
1468     inter-atomic separation vectors (${\bf r}_{ij} = {\bf r}_j - {\bf
1469     r}_i$) with the forces between the same two atoms,
1470     \begin{equation}
1471     \overleftrightarrow{\mathsf{W}}(t) = \sum_{i} \sum_{j>i} {\bf r}_{ij}(t)
1472     \otimes {\bf f}_{ij}(t).
1473     \end{equation}
1474     The instantaneous pressure is then simply obtained from the trace of
1475     the Pressure tensor,
1476     \begin{equation}
1477     P(t) = \frac{1}{3} \mathrm{Tr} \left( \overleftrightarrow{\mathsf{P}}(t).
1478     \right)
1479     \end{equation}
1480    
1481     In eq.(\ref{eq:melchionna1}), $\tau_B$ is the time constant for
1482     relaxation of the pressure to the target value. To set values for
1483     $\tau_B$ or $P_{\mathrm{target}}$ in a simulation, one would use the
1484     {\tt tauBarostat} and {\tt targetPressure} keywords in the {\tt .bass}
1485     file. The units for {\tt tauBarostat} are fs, and the units for the
1486     {\tt targetPressure} are atmospheres. Like in the NVT integrator, the
1487     integration of the equations of motion is carried out in a
1488 mmeineke 1179 velocity-Verlet style 2 part algorithm with only the following differences:
1489 mmeineke 1121
1490     {\tt moveA:}
1491     \begin{align*}
1492     P(t) &\leftarrow \left\{{\bf r}(t)\right\}, \left\{{\bf v}(t)\right\} ,\\
1493     %
1494     {\bf v}\left(t + h / 2\right) &\leftarrow {\bf v}(t)
1495     + \frac{h}{2} \left( \frac{{\bf f}(t)}{m} - {\bf v}(t)
1496     \left(\chi(t) + \eta(t) \right) \right), \\
1497     %
1498     \eta(t + h / 2) &\leftarrow \eta(t) + \frac{h
1499     \mathcal{V}(t)}{2 N k_B T(t) \tau_B^2} \left( P(t)
1500     - P_{\mathrm{target}} \right), \\
1501     %
1502     {\bf r}(t + h) &\leftarrow {\bf r}(t) + h
1503     \left\{ {\bf v}\left(t + h / 2 \right)
1504     + \eta(t + h / 2)\left[ {\bf r}(t + h)
1505     - {\bf R}_0 \right] \right\} ,\\
1506     %
1507     \mathsf{H}(t + h) &\leftarrow e^{-h \eta(t + h / 2)}
1508     \mathsf{H}(t).
1509     \end{align*}
1510    
1511 mmeineke 1179 The propagation of positions to time $t + h$
1512 mmeineke 1121 depends on the positions at the same time. {\sc oopse} carries out
1513     this step iteratively (with a limit of 5 passes through the iterative
1514     loop). Also, the simulation box $\mathsf{H}$ is scaled uniformly for
1515     one full time step by an exponential factor that depends on the value
1516     of $\eta$ at time $t +
1517     h / 2$. Reshaping the box uniformly also scales the volume of
1518     the box by
1519     \begin{equation}
1520     \mathcal{V}(t + h) \leftarrow e^{ - 3 h \eta(t + h /2)}.
1521     \mathcal{V}(t)
1522     \end{equation}
1523    
1524     The {\tt doForces} step for the NPTi integrator is exactly the same as
1525     in both the DLM and NVT integrators. Once the forces and torques have
1526     been obtained at the new time step, the velocities can be advanced to
1527     the same time value.
1528    
1529     {\tt moveB:}
1530     \begin{align*}
1531     P(t + h) &\leftarrow \left\{{\bf r}(t + h)\right\},
1532     \left\{{\bf v}(t + h)\right\}, \\
1533     %
1534     \eta(t + h) &\leftarrow \eta(t + h / 2) +
1535     \frac{h \mathcal{V}(t + h)}{2 N k_B T(t + h)
1536     \tau_B^2} \left( P(t + h) - P_{\mathrm{target}} \right), \\
1537     %
1538     {\bf v}\left(t + h \right) &\leftarrow {\bf v}\left(t
1539     + h / 2 \right) + \frac{h}{2} \left(
1540     \frac{{\bf f}(t + h)}{m} - {\bf v}(t + h)
1541     (\chi(t + h) + \eta(t + h)) \right) ,\\
1542     %
1543     {\bf j}\left(t + h \right) &\leftarrow {\bf j}\left(t
1544     + h / 2 \right) + \frac{h}{2} \left( {\bf
1545     \tau}^b(t + h) - {\bf j}(t + h)
1546     \chi(t + h) \right) .
1547     \end{align*}
1548    
1549     Once again, since ${\bf v}(t + h)$ and ${\bf j}(t + h)$ are required
1550     to caclculate $T(t + h)$, $P(t + h)$, $\chi(t + h)$, and $\eta(t +
1551     h)$, they indirectly depend on their own values at time $t + h$. {\tt
1552     moveB} is therefore done in an iterative fashion until $\chi(t + h)$
1553     and $\eta(t + h)$ become self-consistent. The relative tolerance for
1554     the self-consistency check defaults to a value of $\mbox{10}^{-6}$,
1555     but {\sc oopse} will terminate the iteration after 4 loops even if the
1556     consistency check has not been satisfied.
1557    
1558     The Melchionna modification of the Nos\'e-Hoover-Andersen algorithm is
1559     known to conserve a Hamiltonian for the extended system that is, to
1560     within a constant, identical to the Gibbs free energy,
1561     \begin{equation}
1562     H_{\mathrm{NPTi}} = V + K + f k_B T_{\mathrm{target}} \left(
1563     \frac{\tau_{T}^2 \chi^2(t)}{2} + \int_{0}^{t} \chi(t^\prime) dt^\prime
1564     \right) + P_{\mathrm{target}} \mathcal{V}(t).
1565     \end{equation}
1566     Poor choices of $\delta t$, $\tau_T$, or $\tau_B$ can result in
1567     non-conservation of $H_{\mathrm{NPTi}}$, so the conserved quantity is
1568     maintained in the last column of the {\tt .stat} file to allow checks
1569     on the quality of the integration. It is also known that this
1570     algorithm samples the equilibrium distribution for the enthalpy
1571     (including contributions for the thermostat and barostat),
1572     \begin{equation}
1573     H_{\mathrm{NPTi}} = V + K + \frac{f k_B T_{\mathrm{target}}}{2} \left(
1574     \chi^2 \tau_T^2 + \eta^2 \tau_B^2 \right) + P_{\mathrm{target}}
1575     \mathcal{V}(t).
1576     \end{equation}
1577    
1578     Bond constraints are applied at the end of both the {\tt moveA} and
1579     {\tt moveB} portions of the algorithm. Details on the constraint
1580     algorithms are given in section \ref{oopseSec:rattle}.
1581    
1582     \subsection{\label{sec:NPTf}Constant-pressure integration with a
1583     flexible box (NPTf)}
1584    
1585     There is a relatively simple generalization of the
1586     Nos\'e-Hoover-Andersen method to include changes in the simulation box
1587     {\it shape} as well as in the volume of the box. This method utilizes
1588     the full $3 \times 3$ pressure tensor and introduces a tensor of
1589     extended variables ($\overleftrightarrow{\eta}$) to control changes to
1590 mmeineke 1179 the box shape. The equations of motion for this method differ from those of NPTi as follows:
1591 mmeineke 1121 \begin{eqnarray}
1592     \dot{{\bf r}} & = & {\bf v} + \overleftrightarrow{\eta} \cdot \left( {\bf r} - {\bf R}_0 \right), \\
1593     \dot{{\bf v}} & = & \frac{{\bf f}}{m} - (\overleftrightarrow{\eta} +
1594     \chi \cdot \mathsf{1}) {\bf v}, \\
1595     \dot{\overleftrightarrow{\eta}} & = & \frac{1}{\tau_{B}^2 f k_B
1596     T_{\mathrm{target}}} V \left( \overleftrightarrow{\mathsf{P}} - P_{\mathrm{target}}\mathsf{1} \right) ,\\
1597     \dot{\mathsf{H}} & = & \overleftrightarrow{\eta} \cdot \mathsf{H} .
1598     \label{eq:melchionna2}
1599     \end{eqnarray}
1600    
1601     Here, $\mathsf{1}$ is the unit matrix and $\overleftrightarrow{\mathsf{P}}$
1602     is the pressure tensor. Again, the volume, $\mathcal{V} = \det
1603     \mathsf{H}$.
1604    
1605     The propagation of the equations of motion is nearly identical to the
1606     NPTi integration:
1607    
1608     {\tt moveA:}
1609     \begin{align*}
1610     \overleftrightarrow{\mathsf{P}}(t) &\leftarrow \left\{{\bf r}(t)\right\},
1611     \left\{{\bf v}(t)\right\} ,\\
1612     %
1613     {\bf v}\left(t + h / 2\right) &\leftarrow {\bf v}(t)
1614     + \frac{h}{2} \left( \frac{{\bf f}(t)}{m} -
1615     \left(\chi(t)\mathsf{1} + \overleftrightarrow{\eta}(t) \right) \cdot
1616     {\bf v}(t) \right), \\
1617     %
1618     \overleftrightarrow{\eta}(t + h / 2) &\leftarrow
1619     \overleftrightarrow{\eta}(t) + \frac{h \mathcal{V}(t)}{2 N k_B
1620     T(t) \tau_B^2} \left( \overleftrightarrow{\mathsf{P}}(t)
1621     - P_{\mathrm{target}}\mathsf{1} \right), \\
1622     %
1623     {\bf r}(t + h) &\leftarrow {\bf r}(t) + h \left\{ {\bf v}
1624     \left(t + h / 2 \right) + \overleftrightarrow{\eta}(t +
1625     h / 2) \cdot \left[ {\bf r}(t + h)
1626     - {\bf R}_0 \right] \right\}, \\
1627     %
1628     \mathsf{H}(t + h) &\leftarrow \mathsf{H}(t) \cdot e^{-h
1629     \overleftrightarrow{\eta}(t + h / 2)} .
1630     \end{align*}
1631     {\sc oopse} uses a power series expansion truncated at second order
1632     for the exponential operation which scales the simulation box.
1633    
1634     The {\tt moveB} portion of the algorithm is largely unchanged from the
1635     NPTi integrator:
1636    
1637     {\tt moveB:}
1638     \begin{align*}
1639     \overleftrightarrow{\mathsf{P}}(t + h) &\leftarrow \left\{{\bf r}
1640     (t + h)\right\}, \left\{{\bf v}(t
1641     + h)\right\}, \left\{{\bf f}(t + h)\right\} ,\\
1642     %
1643     \overleftrightarrow{\eta}(t + h) &\leftarrow
1644     \overleftrightarrow{\eta}(t + h / 2) +
1645     \frac{h \mathcal{V}(t + h)}{2 N k_B T(t + h)
1646     \tau_B^2} \left( \overleftrightarrow{P}(t + h)
1647     - P_{\mathrm{target}}\mathsf{1} \right) ,\\
1648     %
1649     {\bf v}\left(t + h \right) &\leftarrow {\bf v}\left(t
1650     + h / 2 \right) + \frac{h}{2} \left(
1651     \frac{{\bf f}(t + h)}{m} -
1652     (\chi(t + h)\mathsf{1} + \overleftrightarrow{\eta}(t
1653     + h)) \right) \cdot {\bf v}(t + h), \\
1654     \end{align*}
1655    
1656     The iterative schemes for both {\tt moveA} and {\tt moveB} are
1657     identical to those described for the NPTi integrator.
1658    
1659     The NPTf integrator is known to conserve the following Hamiltonian:
1660     \begin{equation}
1661     H_{\mathrm{NPTf}} = V + K + f k_B T_{\mathrm{target}} \left(
1662     \frac{\tau_{T}^2 \chi^2(t)}{2} + \int_{0}^{t} \chi(t^\prime) dt^\prime
1663     \right) + P_{\mathrm{target}} \mathcal{V}(t) + \frac{f k_B
1664     T_{\mathrm{target}}}{2}
1665     \mathrm{Tr}\left[\overleftrightarrow{\eta}(t)\right]^2 \tau_B^2.
1666     \end{equation}
1667    
1668     This integrator must be used with care, particularly in liquid
1669     simulations. Liquids have very small restoring forces in the
1670     off-diagonal directions, and the simulation box can very quickly form
1671     elongated and sheared geometries which become smaller than the
1672     electrostatic or Lennard-Jones cutoff radii. The NPTf integrator
1673     finds most use in simulating crystals or liquid crystals which assume
1674     non-orthorhombic geometries.
1675    
1676     \subsection{\label{nptxyz}Constant pressure in 3 axes (NPTxyz)}
1677    
1678     There is one additional extended system integrator which is somewhat
1679     simpler than the NPTf method described above. In this case, the three
1680     axes have independent barostats which each attempt to preserve the
1681     target pressure along the box walls perpendicular to that particular
1682     axis. The lengths of the box axes are allowed to fluctuate
1683     independently, but the angle between the box axes does not change.
1684     The equations of motion are identical to those described above, but
1685     only the {\it diagonal} elements of $\overleftrightarrow{\eta}$ are
1686     computed. The off-diagonal elements are set to zero (even when the
1687     pressure tensor has non-zero off-diagonal elements).
1688    
1689     It should be noted that the NPTxyz integrator is {\it not} known to
1690     preserve any Hamiltonian of interest to the chemical physics
1691     community. The integrator is extremely useful, however, in generating
1692     initial conditions for other integration methods. It {\it is} suitable
1693     for use with liquid simulations, or in cases where there is
1694     orientational anisotropy in the system (i.e. in lipid bilayer
1695     simulations).
1696    
1697 mmeineke 1134 \subsection{\label{sec:constraints}Constraint Methods}
1698    
1699     \subsubsection{\label{oopseSec:rattle}The {\sc rattle} Method for Bond
1700 mmeineke 1121 Constraints}
1701    
1702     In order to satisfy the constraints of fixed bond lengths within {\sc
1703     oopse}, we have implemented the {\sc rattle} algorithm of
1704     Andersen.\cite{andersen83} The algorithm is a velocity verlet
1705     formulation of the {\sc shake} method\cite{ryckaert77} of iteratively
1706 mmeineke 1134 solving the Lagrange multipliers of constraint.
1707 mmeineke 1121
1708 mmeineke 1134 \subsubsection{\label{oopseSec:zcons}Z-Constraint Method}
1709 mmeineke 1121
1710     Based on the fluctuation-dissipation theorem, a force auto-correlation
1711     method was developed by Roux and Karplus to investigate the dynamics
1712     of ions inside ion channels.\cite{Roux91} The time-dependent friction
1713     coefficient can be calculated from the deviation of the instantaneous
1714     force from its mean force.
1715     \begin{equation}
1716     \xi(z,t)=\langle\delta F(z,t)\delta F(z,0)\rangle/k_{B}T,
1717     \end{equation}
1718     where%
1719     \begin{equation}
1720     \delta F(z,t)=F(z,t)-\langle F(z,t)\rangle.
1721     \end{equation}
1722    
1723    
1724     If the time-dependent friction decays rapidly, the static friction
1725     coefficient can be approximated by
1726     \begin{equation}
1727     \xi_{\text{static}}(z)=\int_{0}^{\infty}\langle\delta F(z,t)\delta F(z,0)\rangle dt.
1728     \end{equation}
1729     Allowing diffusion constant to then be calculated through the
1730     Einstein relation:\cite{Marrink94}
1731     \begin{equation}
1732     D(z)=\frac{k_{B}T}{\xi_{\text{static}}(z)}=\frac{(k_{B}T)^{2}}{\int_{0}^{\infty
1733     }\langle\delta F(z,t)\delta F(z,0)\rangle dt}.%
1734     \end{equation}
1735    
1736     The Z-Constraint method, which fixes the z coordinates of the
1737     molecules with respect to the center of the mass of the system, has
1738     been a method suggested to obtain the forces required for the force
1739     auto-correlation calculation.\cite{Marrink94} However, simply resetting the
1740     coordinate will move the center of the mass of the whole system. To
1741     avoid this problem, a new method was used in {\sc oopse}. Instead of
1742     resetting the coordinate, we reset the forces of z-constrained
1743     molecules as well as subtract the total constraint forces from the
1744     rest of the system after the force calculation at each time step.
1745    
1746     After the force calculation, define $G_\alpha$ as
1747     \begin{equation}
1748     G_{\alpha} = \sum_i F_{\alpha i},
1749     \label{oopseEq:zc1}
1750     \end{equation}
1751     where $F_{\alpha i}$ is the force in the z direction of atom $i$ in
1752     z-constrained molecule $\alpha$. The forces of the z constrained
1753     molecule are then set to:
1754     \begin{equation}
1755     F_{\alpha i} = F_{\alpha i} -
1756     \frac{m_{\alpha i} G_{\alpha}}{\sum_i m_{\alpha i}}.
1757     \end{equation}
1758     Here, $m_{\alpha i}$ is the mass of atom $i$ in the z-constrained
1759     molecule. Having rescaled the forces, the velocities must also be
1760     rescaled to subtract out any center of mass velocity in the z
1761     direction.
1762     \begin{equation}
1763     v_{\alpha i} = v_{\alpha i} -
1764     \frac{\sum_i m_{\alpha i} v_{\alpha i}}{\sum_i m_{\alpha i}},
1765     \end{equation}
1766     where $v_{\alpha i}$ is the velocity of atom $i$ in the z direction.
1767     Lastly, all of the accumulated z constrained forces must be subtracted
1768     from the system to keep the system center of mass from drifting.
1769     \begin{equation}
1770     F_{\beta i} = F_{\beta i} - \frac{m_{\beta i} \sum_{\alpha} G_{\alpha}}
1771     {\sum_{\beta}\sum_i m_{\beta i}},
1772     \end{equation}
1773     where $\beta$ are all of the unconstrained molecules in the
1774     system. Similarly, the velocities of the unconstrained molecules must
1775     also be scaled.
1776     \begin{equation}
1777     v_{\beta i} = v_{\beta i} + \sum_{\alpha}
1778     \frac{\sum_i m_{\alpha i} v_{\alpha i}}{\sum_i m_{\alpha i}}.
1779     \end{equation}
1780    
1781     At the very beginning of the simulation, the molecules may not be at their
1782     constrained positions. To move a z-constrained molecule to its specified
1783     position, a simple harmonic potential is used
1784     \begin{equation}
1785     U(t)=\frac{1}{2}k_{\text{Harmonic}}(z(t)-z_{\text{cons}})^{2},%
1786     \end{equation}
1787     where $k_{\text{Harmonic}}$ is the harmonic force constant, $z(t)$ is the
1788     current $z$ coordinate of the center of mass of the constrained molecule, and
1789     $z_{\text{cons}}$ is the constrained position. The harmonic force operating
1790     on the z-constrained molecule at time $t$ can be calculated by
1791     \begin{equation}
1792     F_{z_{\text{Harmonic}}}(t)=-\frac{\partial U(t)}{\partial z(t)}=
1793     -k_{\text{Harmonic}}(z(t)-z_{\text{cons}}).
1794     \end{equation}
1795 mmeineke 1179 Parameters concerning the z-constraint method are summarized in Table~\ref{table:zconParams}.
1796 mmeineke 1121
1797 mmeineke 1179 \begin{table}
1798     \caption{The Global Keywords: Z-Constraint Parameters}
1799     \label{table:zconParams}
1800     \begin{center}
1801     % Note when adding or removing columns, the \hsize numbers must add up to the total number
1802     % of columns.
1803     \begin{tabularx}{\linewidth}%
1804     {>{\setlength{\hsize}{1.00\hsize}}X%
1805     >{\setlength{\hsize}{0.4\hsize}}X%
1806     >{\setlength{\hsize}{1.2\hsize}}X%
1807     >{\setlength{\hsize}{1.4\hsize}}X}
1808    
1809     {\bf keyword} & {\bf units} & {\bf use} & {\bf remarks} \\ \hline
1810    
1811     {\tt zconsTime} & fs & Sets the frequency at which the {\tt .fz} file is written. & Default sets the frequency to the {\tt runTime} \\
1812     {\tt nZconstraints} & integer & The number of zconstraint molecules& If using zconstraint method, {\tt nZconstraints} must be set \\
1813     {\tt zconsForcePolicy} & string& The strategy of subtracting zconstraint force from unconstraint molecules & Possible strategies are BYMASS and BYNUMBER. Default strategy is set to BYMASS\\
1814     {\tt zconsGap} & \r(A) & Set the distance between two adjacent constraint positions& Used mainly in constraining molecules sequentially \\
1815     {\tt zconsFixtime} & fs & Sets how long the zconstraint molecule is fixed & {\tt zconsGap} must be set if {\tt zconsGap} is already set.\\
1816     {\tt zconsUsingSMD} &logical & Flag of using Steered Molecular Dynamics or Harmonic Force to move the molecule & Using harmonic force by default\\
1817    
1818     \end{tabularx}
1819     \end{center}
1820     \end{table}
1821    
1822    
1823    
1824     \section{\label{sec:minimize}Energy Minimization}
1825    
1826    
1827     As one of the basic procedures of molecular modeling, energy minimization
1828     method is used to identify configurations that are stable points on the energy
1829     surface by adjusting the atomic coordinates. Given a potential energy function
1830     $V$ which depends on a set of coordinates, energy minimization algorithm is
1831     developed to find its minimun value. Different from other packages, the
1832     coordinates in OOPSE not only include cartesian coordinates but also euler
1833     angle if directional atom or rigidbody is involved. Unfortunately, due to the
1834     number of local minima and the cost of computation, in most cases, it is
1835     always impossible to identify the global minimum. OOPSE provides two
1836     frequently used first-derivative algorithms, steepest descents and conjugate
1837     gradient, to find a reasonable local minima.
1838    
1839     Given a coordinate set $x_{k}$ and a search direction $d_{k}$, a line search
1840     algorithm is performed along $d_{k}$ to produce $x_{k+1}=x_{k}+$ $\lambda
1841     _{k}d_{k}$.
1842    
1843     In steepest descent algorithm,%
1844    
1845     \begin{equation}
1846     d_{k}=-\nabla V(x_{k})
1847     \end{equation}
1848    
1849    
1850     Therefore, the gradient and the direction of next step are always orthogonal
1851     which may causes oscillatory behavior in narrow valleys. To overcome this
1852     problem, the Fletcher-Reeves variant of the conjugate algorithm generates
1853     $d_{k+1}$ from the simple recursion%
1854    
1855     \begin{align}
1856     d_{k+1} & =-\nabla V(x_{k+1})+\gamma_{k}d_{k}\\
1857     \gamma_{k} & =\frac{\nabla V(x_{k+1})^{T}\nabla V(x_{k+1})}{\nabla
1858     V(x_{k})^{T}\nabla V(x_{k})}%
1859     \end{align}
1860    
1861    
1862     The Polak-Ribiere variant of conjugate gradient defines as%
1863    
1864     \begin{equation}
1865     \gamma_{k}=\frac{[\nabla V(x_{k+1})-\nabla V(x)]^{T}\nabla V(x_{k+1})}{\nabla
1866     V(x_{k})^{T}\nabla V(x_{k})}%
1867     \end{equation}
1868    
1869    
1870     The conjugate gradient method assumes that the conformation is close enough to
1871     a local minimum that the potential energy surface is very nearly quadratic.
1872     When initial structure is far from the minimimum, the steepest descent method
1873     can be superiror to conjugate gradient. Hence, steepest descents may generally
1874     be used for the first 10-100 steps of minimization. Another useful feature of
1875     minimization methods in OOPSE is that a modified SHAKE algorithm can be
1876     applied duing the minimization to constraint the bond length. {\tt bass} parameters concerning the minimizer are given in Table~\ref{table:minimizeParams}
1877    
1878     \begin{table}
1879     \caption{The Global Keywords: Energy Minimizer Parameters}
1880     \label{table:minimizeParams}
1881     \begin{center}
1882     % Note when adding or removing columns, the \hsize numbers must add up to the total number
1883     % of columns.
1884     \begin{tabularx}{\linewidth}%
1885     {>{\setlength{\hsize}{1.00\hsize}}X%
1886     >{\setlength{\hsize}{0.4\hsize}}X%
1887     >{\setlength{\hsize}{1.2\hsize}}X%
1888     >{\setlength{\hsize}{1.4\hsize}}X}
1889    
1890     {\bf keyword} & {\bf units} & {\bf use} & {\bf remarks} \\ \hline
1891    
1892     {\tt minimizer} & & & \\
1893     {\tt minMaxIter} & integer & Sets the maximum iteration in energy minimization & Default value is 200\\
1894     {\tt minWriteFreq} & interger & Sets the frequency at which the {\tt .dump} and {\tt .stat} files are writtern in energy minimization & \\
1895     {\tt minStepSize} & double & Set the step size of line search & Default value is 0.01\\
1896     {\tt minFTol} & double & Sets energy tolerance & Default value is $10^(-8)$\\
1897     {\tt minGTol} & double & Sets gradient tolerance & Default value is $10^(-8)$\\
1898     {\tt minLSTol} & double & Sets line search tolerance & Default value is $10^(-8)$\\
1899     {\tt minLSMaxIter} & integer & Sets the maximum iteration of line searching & Default value is 50\\
1900    
1901     \end{tabularx}
1902     \end{center}
1903     \end{table}
1904    
1905    
1906 mmeineke 1121 \section{\label{oopseSec:design}Program Design}
1907    
1908     \subsection{\label{sec:architecture} {\sc oopse} Architecture}
1909    
1910     The core of OOPSE is divided into two main object libraries:
1911     \texttt{libBASS} and \texttt{libmdtools}. \texttt{libBASS} is the
1912     library developed around the parsing engine and \texttt{libmdtools}
1913     is the software library developed around the simulation engine. These
1914     two libraries are designed to encompass all the basic functions and
1915     tools that {\sc oopse} provides. Utility programs, such as the
1916     property analyzers, need only link against the software libraries to
1917     gain access to parsing, force evaluation, and input / output
1918     routines.
1919    
1920     Contained in \texttt{libBASS} are all the routines associated with
1921     reading and parsing the \texttt{.bass} input files. Given a
1922     \texttt{.bass} file, \texttt{libBASS} will open it and any associated
1923     \texttt{.mdl} files; then create structures in memory that are
1924     templates of all the molecules specified in the input files. In
1925     addition, any simulation parameters set in the \texttt{.bass} file
1926     will be placed in a structure for later query by the controlling
1927     program.
1928    
1929     Located in \texttt{libmdtools} are all other routines necessary to a
1930     Molecular Dynamics simulation. The library uses the main data
1931     structures returned by \texttt{libBASS} to initialize the various
1932     parts of the simulation: the atom structures and positions, the force
1933     field, the integrator, \emph{et cetera}. After initialization, the
1934     library can be used to perform a variety of tasks: integrate a
1935     Molecular Dynamics trajectory, query phase space information from a
1936     specific frame of a completed trajectory, or even recalculate force or
1937     energetic information about specific frames from a completed
1938     trajectory.
1939    
1940     With these core libraries in place, several programs have been
1941     developed to utilize the routines provided by \texttt{libBASS} and
1942     \texttt{libmdtools}. The main program of the package is \texttt{oopse}
1943     and the corresponding parallel version \texttt{oopse\_MPI}. These two
1944     programs will take the \texttt{.bass} file, and create (and integrate)
1945     the simulation specified in the script. The two analysis programs
1946     \texttt{staticProps} and \texttt{dynamicProps} utilize the core
1947     libraries to initialize and read in trajectories from previously
1948     completed simulations, in addition to the ability to use functionality
1949     from \texttt{libmdtools} to recalculate forces and energies at key
1950     frames in the trajectories. Lastly, the family of system building
1951     programs (Sec.~\ref{oopseSec:initCoords}) also use the libraries to
1952     store and output the system configurations they create.
1953    
1954     \subsection{\label{oopseSec:parallelization} Parallelization of {\sc oopse}}
1955    
1956     Although processor power is continually growing roughly following
1957     Moore's Law, it is still unreasonable to simulate systems of more then
1958     a 1000 atoms on a single processor. To facilitate study of larger
1959     system sizes or smaller systems on long time scales in a reasonable
1960     period of time, parallel methods were developed allowing multiple
1961     CPU's to share the simulation workload. Three general categories of
1962     parallel decomposition methods have been developed including atomic,
1963     spatial and force decomposition methods.
1964    
1965     Algorithmically simplest of the three methods is atomic decomposition
1966     where N particles in a simulation are split among P processors for the
1967     duration of the simulation. Computational cost scales as an optimal
1968     $\mathcal{O}(N/P)$ for atomic decomposition. Unfortunately all
1969     processors must communicate positions and forces with all other
1970     processors at every force evaluation, leading communication costs to
1971     scale as an unfavorable $\mathcal{O}(N)$, \emph{independent of the
1972     number of processors}. This communication bottleneck led to the
1973     development of spatial and force decomposition methods in which
1974     communication among processors scales much more favorably. Spatial or
1975     domain decomposition divides the physical spatial domain into 3D boxes
1976     in which each processor is responsible for calculation of forces and
1977     positions of particles located in its box. Particles are reassigned to
1978     different processors as they move through simulation space. To
1979     calculate forces on a given particle, a processor must know the
1980     positions of particles within some cutoff radius located on nearby
1981     processors instead of the positions of particles on all
1982     processors. Both communication between processors and computation
1983     scale as $\mathcal{O}(N/P)$ in the spatial method. However, spatial
1984     decomposition adds algorithmic complexity to the simulation code and
1985     is not very efficient for small N since the overall communication
1986     scales as the surface to volume ratio $\mathcal{O}(N/P)^{2/3}$ in
1987     three dimensions.
1988    
1989     The parallelization method used in {\sc oopse} is the force
1990     decomposition method. Force decomposition assigns particles to
1991     processors based on a block decomposition of the force
1992     matrix. Processors are split into an optimally square grid forming row
1993     and column processor groups. Forces are calculated on particles in a
1994     given row by particles located in that processors column
1995     assignment. Force decomposition is less complex to implement than the
1996     spatial method but still scales computationally as $\mathcal{O}(N/P)$
1997     and scales as $\mathcal{O}(N/\sqrt{P})$ in communication
1998     cost. Plimpton has also found that force decompositions scale more
1999     favorably than spatial decompositions for systems up to 10,000 atoms
2000     and favorably compete with spatial methods up to 100,000
2001     atoms.\cite{plimpton95}
2002    
2003     \section{\label{oopseSec:conclusion}Conclusion}
2004    
2005     We have presented the design and implementation of our open source
2006     simulation package {\sc oopse}. The package offers novel capabilities
2007     to the field of Molecular Dynamics simulation packages in the form of
2008     dipolar force fields, and symplectic integration of rigid body
2009     dynamics. It is capable of scaling across multiple processors through
2010     the use of force based decomposition using MPI. It also implements
2011     several advanced integrators allowing the end user control over
2012     temperature and pressure. In addition, it is capable of integrating
2013     constrained dynamics through both the {\sc rattle} algorithm and the
2014     z-constraint method.
2015    
2016     These features are all brought together in a single open-source
2017     program. This allows researchers to not only benefit from
2018     {\sc oopse}, but also contribute to {\sc oopse}'s development as
2019     well.
2020    
2021    
2022     \newpage
2023     \section{Acknowledgments}
2024 mmeineke 1134 The authors would like to thank the Notre Dame BoB computer cluster where much of this project was tested. Additionally, the authors would like to acknowledge their funding from {\LARGE FIX ME}.
2025 mmeineke 1121
2026     \bibliographystyle{achemso}
2027     \bibliography{oopsePaper}
2028    
2029     \end{document}