ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/oopsePaper/oopsePaper.tex
Revision: 1123
Committed: Mon Apr 19 21:25:23 2004 UTC (20 years, 3 months ago) by mmeineke
Content type: application/x-tex
File size: 98361 byte(s)
Log Message:
 fixed the makefile, and fixed some visuals on the schemes

File Contents

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