ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/oopsePaper/oopsePaper.tex
Revision: 1155
Committed: Tue May 11 19:36:28 2004 UTC (20 years, 2 months ago) by mmeineke
Content type: application/x-tex
File size: 84129 byte(s)
Log Message:
starting to rearrange the prose after the intro.

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