ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/oopsePaper/oopsePaper.tex
Revision: 1134
Committed: Mon Apr 26 21:05:03 2004 UTC (20 years, 2 months ago) by mmeineke
Content type: application/x-tex
File size: 83139 byte(s)
Log Message:
finished removing the trajectory analysis.

took out the rattle derivation.

added a section concerning the creation of init files.

currently working on a table of key words for the package.

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