ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/oopseDocs/oopseDoc.tex
Revision: 3403
Committed: Fri May 30 18:16:59 2008 UTC (16 years, 3 months ago) by gezelter
Content type: application/x-tex
File size: 161589 byte(s)
Log Message:
Edits on Hydro and Langevin Dynamics

File Contents

# User Rev Content
1 gezelter 3395 \documentclass[]{book}
2     \usepackage{amssymb}
3     \usepackage{amsmath}
4     \usepackage{times}
5     \usepackage{listings}
6     \usepackage{graphicx}
7     \usepackage{setspace}
8     \usepackage{tabularx}
9     \usepackage{longtable}
10     \pagestyle{plain}
11     \pagenumbering{arabic}
12     \oddsidemargin 0.0cm
13     \evensidemargin 0.0cm
14     \topmargin -21pt
15     \headsep 10pt
16     \textheight 9.0in
17     \textwidth 6.5in
18     \brokenpenalty=10000
19     \renewcommand{\baselinestretch}{1.2}
20    
21     %\renewcommand\citemid{\ } % no comma in optional reference note
22     \lstset{language=C,frame=TB,basicstyle=\tiny,basicstyle=\ttfamily, %
23     xleftmargin=0.25in, xrightmargin=0.25in,captionpos=b, %
24     abovecaptionskip=0.5cm, belowcaptionskip=0.5cm, escapeinside={~}{~}}
25     \renewcommand{\lstlistingname}{Scheme}
26    
27     \begin{document}
28    
29     \newcolumntype{A}{p{1.5in}}
30     \newcolumntype{B}{p{0.75in}}
31     \newcolumntype{C}{p{1.5in}}
32     \newcolumntype{D}{p{2in}}
33    
34     \newcolumntype{E}{p{0.5in}}
35     \newcolumntype{F}{p{2.25in}}
36     \newcolumntype{G}{p{3in}}
37    
38     \newcolumntype{H}{p{0.75in}}
39     \newcolumntype{I}{p{5in}}
40    
41    
42     \title{{\sc oopse}-4: An Object-Oriented Parallel Simulation
43     Engine for Molecular Dynamics}
44    
45     \author{Teng Lin, Christopher J. Fennell, Charles F. Vardeman II, Xiuquan Sun, \\
46     Kyle Daily, Yang Zheng, Matthew A. Meineke, and J. Daniel Gezelter\\
47     Department of Chemistry and Biochemistry\\
48     University of Notre Dame\\
49     Notre Dame, Indiana 46556}
50    
51     \maketitle
52    
53     \section*{Preface}
54     {\sc oopse} is a new molecular dynamics simulation program which is
55     capable of efficiently integrating equations of motion for atom types
56     with orientational degrees of freedom (e.g. ``sticky'' atoms and point
57     dipoles). Transition metals can also be simulated using the embedded
58     atom method ({\sc eam}) potential included in the code. Parallel
59     simulations are carried out using the force-based decomposition
60     method. Simulations are specified using a very simple C-based
61     meta-data language. A number of advanced integrators are included,
62     and the basic integrator for orientational dynamics provides
63     substantial improvements over older quaternion-based schemes.
64    
65     \tableofcontents
66     %\listoffigures
67     %\listoftables
68    
69     \mainmatter
70    
71     \chapter{\label{sec:intro}Introduction}
72    
73     There are a number of excellent molecular dynamics packages available
74     to the chemical physics
75     community.\cite{Brooks83,MacKerell98,pearlman:1995,Gromacs,Gromacs3,DL_POLY,Tinker,Paradyn,namd,macromodel}
76     All of these packages are stable, polished programs which solve many
77     problems of interest. Most are now capable of performing molecular
78     dynamics simulations on parallel computers. Some have source code
79     which is freely available to the entire scientific community. Few,
80     however, are capable of efficiently integrating the equations of
81     motion for atom types with orientational degrees of freedom
82     (e.g. point dipoles, and ``sticky'' atoms). And only one of the
83     programs referenced can handle transition metal force fields like the
84     Embedded Atom Method ({\sc eam}). The direction our research program
85     has taken us now involves the use of atoms with orientational degrees
86     of freedom as well as transition metals. Since these simulation
87     methods may be of some use to other researchers, we have decided to
88     release our program (and all related source code) to the scientific
89     community.
90    
91     This document communicates the algorithmic details of our program, which
92     we have been calling the Object-Oriented Parallel Simulation Engine
93     (i.e. {\sc oopse}). We have structured this document to first discuss
94     the underlying concepts in this simulation package
95     (Sec. \ref{oopseSec:IOfiles}). The empirical energy functions
96     implemented are discussed in Sec.~\ref{oopseSec:empiricalEnergy}.
97     Sec.~\ref{oopseSec:mechanics} describes the various Molecular Dynamics
98     algorithms {\sc oopse} implements in the integration of Hamilton's
99     equations of motion. Program design considerations for parallel
100     computing are presented in
101     Sec.~\ref{oopseSec:parallelization}. Concluding remarks are presented
102     in Sec.~\ref{oopseSec:conclusion}.
103    
104     \chapter{\label{oopseSec:IOfiles}Concepts \& Files}
105    
106     A simulation in {\sc oopse} is built using a few fundamental
107     conceptual building blocks most of which are chemically intuitive.
108     The basic unit of a simulation is an {\tt atom}. The parameters
109     describing an {\tt atom} have been generalized to make it as flexible
110     as possible; this means that in addition to translational degrees of
111     freedom, {\tt Atoms} may also have {\it orientational} degrees of freedom.
112    
113     The fundamental (static) properties of {\tt atoms} are defined by the
114     {\tt forceField} chosen for the simulation. The atomic properties
115     specified by a {\tt forceField} might include (but are not limited to)
116     charge, $\sigma$ and $\epsilon$ values for Lennard-Jones interactions,
117     the strength of the dipole moment ($\mu$), the mass, and the moments
118     of inertia. Other more complicated properties of atoms might also be
119     specified by the {\tt forceField}.
120    
121     {\tt Atoms} can be grouped together in many ways. A {\tt rigidBody}
122     contains atoms that exert no forces on one another and which move as a
123     single rigid unit. A {\tt cutoffGroup} may contain atoms which
124     function together as a (rigid {\it or} non-rigid) unit for potential
125     energy calculations,
126     \begin{equation}
127     V_{ab} = s(r_{ab}) \sum_{i \in a} \sum_{j \in b} V_{ij}(r_{ij})
128     \end{equation}
129     Here, $a$ and $b$ are two {\tt cutoffGroups} containing multiple atoms
130     ($a = \left\{i\right\}$ and $b = \left\{j\right\}$). $s(r_{ab})$ is a
131     generalized switching function which insures that the atoms in the two
132     {\tt cutoffGroups} are treated identically as the two groups enter or
133     leave an interaction region.
134    
135     {\tt Atoms} may also be grouped in more traditional ways into {\tt
136     bonds}, {\tt bends}, and {\tt torsions}. These groupings allow the
137     correct choice of interaction parameters for short-range interactions
138     to be chosen from the definitions in the {\tt forceField}.
139    
140     All of these groups of {\tt atoms} are brought together in the {\tt
141     molecule}, which is the fundamental structure for setting up and {\sc
142     oopse} simulation. {\tt Molecules} contain lists of {\tt atoms}
143     followed by listings of the other atomic groupings ({\tt bonds}, {\tt
144     bends}, {\tt torsions}, {\tt rigidBodies}, and {\tt cutoffGroups})
145     which relate the atoms to one another. Since a {\tt rigidBody} is a
146     collection of atoms that are propagated in fixed relationships to one
147     another, {\sc oopse} uses an internal structure called a {\tt
148     StuntDouble} to store information about those objects that can change
149     position {\it independently} during a simulation. That is, an atom
150     that is part of a rigid body is not itself a StuntDouble. In this
151     case, the rigid body is the StuntDouble. However, an atom that is
152     free to move independently {\it is} its own StuntDouble.
153    
154     Simulations often involve heterogeneous collections of molecules. To
155     specify a mixture of {\tt molecule} types, {\sc oopse} uses {\tt
156     components}. Even simulations containing only one type of molecule
157     must specify a single {\tt component}.
158    
159     Starting a simulation requires two types of information: {\it
160     meta-data}, which describes the types of objects present in the
161     simulation, and {\it configuration} information, which describes the
162     initial state of these objects. An {\sc oopse} file is a single
163     combined file format that describes both of these kinds of data. An
164     {\sc oopse} file contains one {\tt $<$MetaData$>$} block and {\it at least
165     one} {\tt $<$Snapshot$>$} block.
166    
167     The language for the {\tt $<$MetaData$>$} block is a C-based syntax that
168     is parsed at the beginning of the simulation. Configuration
169     information is specified for all {\tt integrableObjects} in a {\tt
170     $<$Snapshot$>$} block. Both the {\tt $<$MetaData$>$} and {\tt $<$Snapshot$>$}
171     formats are described in the following sections.
172    
173     \begin{lstlisting}[float,caption={[The structure of an {\sc oopse} file]
174     The basic structure of an {\sc oopse} file contains HTML-like tags to
175     define simulation meta-data and subsequent instantaneous configuration
176     information. A well-formed {\sc oopse} file must contain one $<$MetaData$>$
177     block and {\it at least one} $<$Snapshot$>$ block. Each
178     $<$Snapshot$>$ is further divided into $<$FrameData$>$ and
179     $<$StuntDoubles$>$ sections.},
180     label=sch:oopseFormat]
181     <OOPSE>
182     <MetaData>
183     // see section ~\ref{sec:miscConcepts}~ for details on the formatting
184     // of information contained inside the <MetaData> tags
185     </MetaData>
186     <Snapshot> // An instantaneous configuration
187     <FrameData>
188     // FrameData contains information on the time
189     // stamp, the size of the simulation box, and
190     // the current state of extended system
191     // ensemble variables.
192     </FrameData>
193     <StuntDoubles>
194     // StuntDouble information comprises the
195     // positions, velocities, orientations, and
196     // angular velocities of anything that is
197     // capable of independent motion during
198     // the simulation.
199     </StuntDoubles>
200     </Snapshot>
201     <Snapshot> // Multiple <Snapshot> sections can be
202     </Snapshot> // present in a well-formed OOPSE file
203     <Snapshot> // Further information on <Snapshot> blocks
204     </Snapshot> // can be found in section ~\ref{oopseSec:coordFiles}~.
205     </OOPSE>
206     \end{lstlisting}
207    
208    
209     \section{OOPSE Files and $<$MetaData$>$ blocks}
210    
211     {\sc oopse} uses a HTML-like syntax to separate {\tt $<$MetaData$>$} and
212     {\tt $<$Snapshot$>$} blocks. A C-based syntax is used to parse the {\tt
213     $<$MetaData$>$} blocks at run time. These blocks allow the user to
214     completely describe the system they wish to simulate, as well as
215     tailor {\sc oopse}'s behavior during the simulation. {\sc oopse}
216     files are typically denoted with the extension {\tt .md} (which can
217     stand for Meta-Data or Molecular Dynamics or Molecule Definition
218     depending on the user's mood). An overview of an {\sc oopse} file is
219     shown in Scheme~\ref{sch:oopseFormat} and example file is shown in
220     Scheme~\ref{sch:mdExample}.
221    
222     \begin{lstlisting}[float,caption={[An example of a complete OOPSE
223     file] An example showing a complete OOPSE file.},
224     label={sch:mdExample}]
225     <OOPSE>
226     <MetaData>
227     molecule{
228     name = "Ar";
229     atom[0]{
230     type="Ar";
231     position( 0.0, 0.0, 0.0 );
232     }
233     }
234    
235     component{
236     type = "Ar";
237     nMol = 3;
238     }
239    
240     forceField = "LJ";
241     ensemble = "NVE"; // specify the simulation ensemble
242     dt = 1.0; // the time step for integration
243     runTime = 1e3; // the total simulation run time
244     sampleTime = 100; // trajectory file frequency
245     statusTime = 50; // statistics file frequency
246     </MetaData>
247     <Snapshot>
248     <FrameData>
249     Time: 0
250     Hmat: {{ 28.569, 0, 0 }, { 0, 28.569, 0 }, { 0, 0, 28.569 }}
251     Thermostat: 0 , 0
252     Barostat: {{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }}
253     </FrameData>
254     <StuntDoubles>
255     0 pv 17.5 13.3 12.8 1.181e-03 -1.630e-03 -1.369e-03
256     1 pv -12.8 -14.9 -8.4 -4.440e-04 -2.048e-03 1.130e-03
257     2 pv -10.0 -15.2 -6.5 2.239e-03 -6.310e-03 1.810e-03
258     </StuntDoubles>
259     </Snapshot>
260     </OOPSE>
261     \end{lstlisting}
262    
263     Within the {\tt $<$MetaData$>$} block it is necessary to provide a
264     complete description of the molecule before it is actually placed in
265     the simulation. {\sc oopse}'s meta-data syntax was originally
266     developed with this goal in mind, and allows for the use of {\it
267     include files} to specify all atoms in a molecular prototype, as well
268     as any bonds, bends, or torsions. Include files allow the user to
269     describe a molecular prototype once, then simply include it into each
270     simulation containing that molecule. Returning to the example in
271     Scheme~\ref{sch:mdExample}, the include file's contents would be
272     Scheme~\ref{sch:mdIncludeExample}, and the new {\sc oopse} file would
273     become Scheme~\ref{sch:mdExPrime}.
274    
275     \begin{lstlisting}[float,caption={An example molecule definition in an
276     include file.},label={sch:mdIncludeExample}]
277     molecule{
278     name = "Ar";
279     atom[0]{
280     type="Ar";
281     position( 0.0, 0.0, 0.0 );
282     }
283     }
284     \end{lstlisting}
285    
286     \begin{lstlisting}[float,caption={Revised OOPSE input file
287     example.},label={sch:mdExPrime}]
288     <OOPSE>
289     <MetaData>
290     #include "argon.md"
291    
292     component{
293     type = "Ar";
294     nMol = 3;
295     }
296    
297     forceField = "LJ";
298     ensemble = "NVE";
299     dt = 1.0;
300     runTime = 1e3;
301     sampleTime = 100;
302     statusTime = 50;
303     </MetaData>
304     </MetaData>
305     <Snapshot$>$
306     <FrameData>
307     Time: 0
308     Hmat: {{ 28.569, 0, 0 }, { 0, 28.569, 0 }, { 0, 0, 28.569 }}
309     Thermostat: 0 , 0
310     Barostat: {{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }}
311     </FrameData>
312     <StuntDoubles>
313     0 pv 17.5 13.3 12.8 1.181e-03 -1.630e-03 -1.369e-03
314     1 pv -12.8 -14.9 -8.4 -4.440e-04 -2.048e-03 1.130e-03
315     2 pv -10.0 -15.2 -6.5 2.239e-03 -6.310e-03 1.810e-03
316     </StuntDoubles>
317     </Snapshot>
318     </OOPSE>
319     \end{lstlisting}
320    
321     \section{\label{oopseSec:atomsMolecules}Atoms, Molecules, and other
322     ways of grouping atoms}
323    
324     As mentioned above, the fundamental unit for an {\sc oopse} simulation
325     is the {\tt atom}. Atoms can be collected into secondary structures
326     such as {\tt rigidBodies}, {\tt cutoffGroups}, or {\tt molecules}. The
327     {\tt molecule} is a way for {\sc oopse} to keep track of the atoms in
328     a simulation in logical manner. Molecular units store the identities
329     of all the atoms and rigid bodies associated with themselves, and they
330     are responsible for the evaluation of their own internal interactions
331     (\emph{i.e.}~bonds, bends, and torsions). Scheme
332     \ref{sch:mdIncludeExample} shows how one creates a molecule in an
333     included meta-data file. The positions of the atoms given in the
334     declaration are relative to the origin of the molecule, and the origin
335     is used when creating a system containing the molecule.
336    
337     One of the features that sets {\sc oopse} apart from most of the
338     current molecular simulation packages is the ability to handle rigid
339     body dynamics. Rigid bodies are non-spherical particles or collections
340     of particles (e.g. $\mbox{C}_{60}$) that have a constant internal
341     potential and move collectively.\cite{Goldstein01} They are not
342     included in most simulation packages because of the algorithmic
343     complexity involved in propagating orientational degrees of freedom.
344     Integrators which propagate orientational motion with an acceptable
345     level of energy conservation for molecular dynamics are relatively
346     new inventions.
347    
348     Moving a rigid body involves determination of both the force and
349     torque applied by the surroundings, which directly affect the
350     translational and rotational motion in turn. In order to accumulate
351     the total force on a rigid body, the external forces and torques must
352     first be calculated for all the internal particles. The total force on
353     the rigid body is simply the sum of these external forces.
354     Accumulation of the total torque on the rigid body is more complex
355     than the force because the torque is applied to the center of mass of
356     the rigid body. The space-fixed torque on rigid body $i$ is
357     \begin{equation}
358     \boldsymbol{\tau}_i=
359     \sum_{a}\biggl[(\mathbf{r}_{ia}-\mathbf{r}_i)\times \mathbf{f}_{ia}
360     + \boldsymbol{\tau}_{ia}\biggr],
361     \label{eq:torqueAccumulate}
362     \end{equation}
363     where $\boldsymbol{\tau}_i$ and $\mathbf{r}_i$ are the torque on and
364     position of the center of mass respectively, while $\mathbf{f}_{ia}$,
365     $\mathbf{r}_{ia}$, and $\boldsymbol{\tau}_{ia}$ are the force on,
366     position of, and torque on the component particles of the rigid body.
367    
368     The summation of the total torque is done in the body fixed axis of
369     each rigid body. In order to move between the space fixed and body
370     fixed coordinate axes, parameters describing the orientation must be
371     maintained for each rigid body. At a minimum, the rotation matrix
372     ($\mathsf{A}$) can be described by the three Euler angles ($\phi,
373     \theta,$ and $\psi$), where the elements of $\mathsf{A}$ are composed of
374     trigonometric operations involving $\phi, \theta,$ and
375     $\psi$.\cite{Goldstein01} In order to avoid numerical instabilities
376     inherent in using the Euler angles, the four parameter ``quaternion''
377     scheme is often used. The elements of $\mathsf{A}$ can be expressed as
378     arithmetic operations involving the four quaternions ($q_w, q_x, q_y,$
379     and $q_z$).\cite{Allen87} Use of quaternions also leads to
380     performance enhancements, particularly for very small
381     systems.\cite{Evans77}
382    
383     Rather than use one of the previously stated methods, {\sc oopse}
384     utilizes a relatively new scheme that propagates the entire nine
385     parameter rotation matrix. Further discussion on this choice can be
386     found in Sec.~\ref{oopseSec:integrate}. An example definition of a
387     rigid body can be seen in Scheme
388     \ref{sch:rigidBody}.
389    
390     \begin{lstlisting}[float,caption={[Defining rigid bodies]A sample
391     definition of a molecule containing a rigid body and a cutoff
392     group},label={sch:rigidBody}]
393     molecule{
394     name = "TIP3P";
395     atom[0]{
396     type = "O_TIP3P";
397     position( 0.0, 0.0, -0.06556 );
398     }
399     atom[1]{
400     type = "H_TIP3P";
401     position( 0.0, 0.75695, 0.52032 );
402     }
403     atom[2]{
404     type = "H_TIP3P";
405     position( 0.0, -0.75695, 0.52032 );
406     }
407    
408     rigidBody[0]{
409     members(0, 1, 2);
410     }
411    
412     cutoffGroup{
413     members(0, 1, 2);
414     }
415     }
416     \end{lstlisting}
417    
418     \section{\label{sec:miscConcepts}Creating a $<$MetaData$>$ block}
419    
420     The actual creation of a {\tt $<$MetaData$>$} block requires several key
421     components. The first part of the file needs to be the declaration of
422     all of the molecule prototypes used in the simulation. This is
423     typically done through included prototype files. Only the molecules
424     actually present in the simulation need to be declared; however, {\sc
425     oopse} allows for the declaration of more molecules than are
426     needed. This gives the user the ability to build up a library of
427     commonly used molecules into a single include file.
428    
429     Once all prototypes are declared, the ordering of the rest of the
430     block is less stringent. The molecular composition of the simulation
431     is specified with {\tt component} statements. Each different type of
432     molecule present in the simulation is considered a separate
433     component (an example is shown in
434     Sch.~\ref{sch:mdExPrime}). The component blocks tell {\sc oopse} the
435     number of molecules that will be in the simulation, and the order in
436     which the components blocks are declared sets the ordering of the real
437     atoms in the {\tt $<$Snapshot$>$} block as well as in the output files. The
438     remainder of the script then sets the various simulation parameters
439     for the system of interest.
440    
441     The required set of parameters that must be present in all simulations
442     is given in Table~\ref{table:reqParams}. Since the user can use {\sc
443     oopse} to perform energy minimizations as well as molecular dynamics
444     simulations, one of the {\tt minimizer} or {\tt ensemble} keywords
445     must be present. The {\tt ensemble} keyword is responsible for
446     selecting the integration method used for the calculation of the
447     equations of motion. An in depth discussion of the various methods
448     available in {\sc oopse} can be found in
449     Sec.~\ref{oopseSec:mechanics}. The {\tt minimizer} keyword selects
450     which minimization method to use, and more details on the choices of
451     minimizer parameters can be found in
452     Sec.~\ref{oopseSec:minimizer}. The {\tt forceField} statement is
453     important for the selection of which forces will be used in the course
454     of the simulation. {\sc oopse} supports several force fields, as
455     outlined in Sec.~\ref{oopseSec:empiricalEnergy}. The force fields are
456     interchangeable between simulations, with the only requirement being
457     that all atoms needed by the simulation are defined within the
458     selected force field.
459    
460     For molecular dynamics simulations, the time step between force
461     evaluations is set with the {\tt dt} parameter, and {\tt runTime} will
462     set the time length of the simulation. Note, that {\tt runTime} is an
463     absolute time, meaning if the simulation is started at t = 10.0~ns
464     with a {\tt runTime} of 25.0~ns, the simulation will only run for an
465     additional 15.0~ns.
466    
467     For energy minimizations, it is not necessary to specify {\tt dt} or
468     {\tt runTime}.
469    
470     To set the initial positions and velocities of all the integrable
471     objects in the simulation, {\sc oopse} will use the last good {\tt
472     $<$Snapshot$>$} block that was found in the startup file that it was
473     called with. If the {\tt useInitalTime} flag is set to {\tt true},
474     the time stamp from this snapshot will also set the initial time stamp
475     for the simulation. Additional parameters are summarized in
476     Table~\ref{table:genParams}.
477    
478     It is important to note the fundamental units in all files which are
479     read and written by {\sc oopse}. Energies are in $\mbox{kcal
480     mol}^{-1}$, distances are in $\mbox{\AA}$, times are in $\mbox{fs}$,
481     translational velocities are in $\mbox{\AA~fs}^{-1}$, and masses are
482     in $\mbox{amu}$. Orientational degrees of freedom are described using
483     quaternions (unitless, but $q_w^2 + q_x^2 + q_y^2 + q_z^2 = 1$),
484     body-fixed angular momenta ($\mbox{amu \AA}^{2} \mbox{radians
485     fs}^{-1}$), and body-fixed moments of inertia ($\mbox{amu \AA}^{2}$).
486    
487     \begin{longtable}[c]{ABCD}
488     \caption{Meta-data Keywords: Required Parameters}
489     \\
490     {\bf keyword} & {\bf units} & {\bf use} & {\bf remarks} \\ \hline
491     \endhead
492     \hline
493     \endfoot
494     {\tt forceField} & string & Sets the force field. & Possible force
495     fields are DUFF, WATER, LJ, EAM, SC, and CLAY. \\
496     {\tt component} & & Defines the molecular components of the system &
497     Every {\tt $<$MetaData$>$} block must have a component statement. \\
498     {\tt minimizer} & string & Chooses a minimizer & Possible minimizers
499     are SD and CG. Either {\tt ensemble} or {\tt minimizer} must be specified. \\
500     {\tt ensemble} & string & Sets the ensemble. & Possible ensembles are
501 gezelter 3403 NVE, NVT, NPTi, NPAT, NPTf, NPTxyz, and LD. Either {\tt ensemble}
502 gezelter 3395 or {\tt minimizer} must be specified. \\
503     {\tt dt} & fs & Sets the time step. & Selection of {\tt dt} should be
504     small enough to sample the fastest motion of the simulation. ({\tt
505     dt} is required for molecular dynamics simulations)\\
506     {\tt runTime} & fs & Sets the time at which the simulation should
507     end. & This is an absolute time, and will end the simulation when the
508     current time meets or exceeds the {\tt runTime}. ({\tt runTime} is
509     required for molecular dynamics simulations)
510     \label{table:reqParams}
511     \end{longtable}
512    
513     \begin{longtable}[c]{ABCD}
514     \caption{Meta-data Keywords: Optional Parameters}
515     \\
516     {\bf keyword} & {\bf units} & {\bf use} & {\bf remarks} \\ \hline
517     \endhead
518     \hline
519     \endfoot
520     {\tt forceFieldVariant} & string & Sets the name of the variant of the
521     force field. & {\sc eam} has three variants: {\tt u3}, {\tt u6}, and
522     {\tt VC}. \\
523     {\tt forceFieldFileName} & string & Overrides the default force field
524     file name & Each force field has a default file name, and this
525     parameter can override the default file name for the chosen force
526     field. \\
527     {\tt usePeriodicBoundaryConditions} & & & \\
528     & logical & Turns periodic boundary conditions on/off. & Default is true. \\
529     {\tt orthoBoxTolerance} & double & & decides how orthogonal the periodic
530     box must be before we can use cheaper box calculations \\
531     {\tt cutoffRadius} & $\mbox{\AA}$ & Manually sets the cutoff radius &
532     the default value is set by the {\tt cutoffPolicy} \\
533     {\tt cutoffPolicy} & string & one of mix, max, or
534     traditional & the traditional cutoff policy is to set the cutoff
535     radius for all atoms in the system to the same value (governed by the
536     largest atom). mix and max are pair-dependent cutoff
537     methods. \\
538     {\tt skinThickness} & \AA & thickness of the skin for the Verlet
539     neighbor lists & defaults to 1 \AA \\
540     {\tt switchingRadius} & $\mbox{\AA}$ & Manually sets the inner radius
541     for the switching function. & Defaults to 85~\% of the {\tt
542     cutoffRadius}. \\
543     {\tt switchingFunctionType} & & & \\
544     & string & cubic or
545     fifth\_order\_polynomial & Default is cubic. \\
546     {\tt useInitialTime} & logical & Sets whether the initial time is
547     taken from the last $<$Snapshot$>$ in the startup file. & Useful when recovering a simulation from a crashed processor. Default is false. \\
548     {\tt useInitialExtendedSystemState} & & & \\
549     & logical & keep the extended
550     system variables? & Should the extended
551     variables (the thermostat and barostat) be kept from the {\tt $<$Snapshot$>$} block? \\
552     {\tt sampleTime} & fs & Sets the frequency at which the {\tt .dump} file is written. & The default is equal to the {\tt runTime}. \\
553     {\tt resetTime} & fs & Sets the frequency at which the extended system
554     variables are reset to zero & The default is to never reset these
555     variables. \\
556     {\tt statusTime} & fs & Sets the frequency at which the {\tt .stat} file is written. & The default is equal to the {\tt sampleTime}. \\
557     {\tt finalConfig} & string & Sets the name of the final output file. & Useful when stringing simulations together. Defaults to the root name of the initial meta-data file but with an {\tt .eor} extension. \\
558     {\tt compressDumpFile} & logical & & should the {\tt .dump} file be
559     compressed on the fly? \\
560     {\tt statFileFormat} & string & columns to print in the {\tt .stat}
561     file where each column is separated by a pipe ($\mid$) symbol. & (The
562     default is the first eight of these columns in order.) \\
563     & & \multicolumn{2}{p{3.5in}}{Allowed
564     column names are: {\sc time, total\_energy, potential\_energy, kinetic\_energy,
565     temperature, pressure, volume, conserved\_quantity,
566     translational\_kinetic, rotational\_kinetic, long\_range\_potential,
567     short\_range\_potential, vanderwaals\_potential,
568     electrostatic\_potential, bond\_potential, bend\_potential,
569     dihedral\_potential, improper\_potential, vraw, vharm,
570     pressure\_tensor\_x, pressure\_tensor\_y, pressure\_tensor\_z}} \\
571     {\tt printPressureTensor} & logical & sets whether OOPSE will print
572     out the pressure tensor & can be useful for calculations of the bulk
573     modulus \\
574     {\tt electrostaticSummationMethod} & & & \\
575     & string & shifted\_force,
576     shifted\_potential, shifted\_force, or reaction\_field &
577     default is shifted\_force. \\
578     {\tt electrostaticScreeningMethod} & & & \\
579     & string & undamped or damped & default is damped \\
580     {\tt dielectric} & unitless & Sets the dielectric constant for
581     reaction field. & If {\tt electrostaticSummationMethod} is set to {\tt
582     reaction\_field}, then {\tt dielectric} must be set. \\
583     {\tt dampingAlpha} & $\mbox{\AA}^{-1}$ & governs strength of
584     electrostatic damping & defaults to 0.2 $\mbox{\AA}^{-1}$. \\
585     {\tt tempSet} & logical & resample velocities from a Maxwell-Boltzmann
586     distribution set to {\tt targetTemp} & default is false. \\
587     {\tt thermalTime} & fs & how often to perform a {\tt tempSet} &
588     default is never \\
589     {\tt targetTemp} & K & sets the target temperature & no default value \\
590     {\tt tauThermostat} & fs & time constant for Nos\'{e}-Hoover
591     thermostat & times from 1000-10,000 fs are reasonable \\
592     {\tt targetPressure} & atm & sets the target pressure & no default value\\
593     {\tt surfaceTension} & & sets the target surface tension in the x-y
594     plane & no default value \\
595     {\tt tauBarostat} & fs & time constant for the
596     Nos\'{e}-Hoover-Andersen barostat & times from 10,000 to 100,000 fs
597     are reasonable \\
598     {\tt seed } & integer & Sets the seed value for the random number generator. & The seed needs to be at least 9 digits long. The default is to take the seed from the CPU clock. \\
599     \label{table:genParams}
600     \end{longtable}
601    
602    
603     \section{\label{oopseSec:coordFiles}$<$Snapshot$>$ Blocks}
604    
605     The standard format for storage of a system's coordinates is the {\tt
606     $<$Snapshot$>$} block , the exact details of which can be seen in
607     Scheme~\ref{sch:dumpFormat}. As all bonding and molecular information
608     is stored in the {\tt $<$MetaData$>$} blocks, the {\tt $<$Snapshot$>$} blocks
609     contain only the coordinates of the objects which move independently
610     during the simulation. It is important to note that {\it not all
611     atoms} are capable of independent motion. Atoms which are part of
612     rigid bodies are not ``integrable objects'' in the equations of
613     motion; the rigid bodies themselves are the integrable objects.
614     Therefore, the coordinate file contains coordinates of all the {\tt
615     integrableObjects} in the system. For systems without rigid bodies,
616     this is simply the coordinates of all the atoms.
617    
618     It is important to note that although the simulation propagates the
619     complete rotation matrix, directional entities are written out using
620     quaternions to save space in the output files.
621    
622     \begin{lstlisting}[float,caption={[The format of the {\tt $<$Snapshot$>$} block]
623     An example of the format of the {\tt $<$Snapshot$>$} block. There is an
624     initial sub-block called {\tt $<$FrameData$>$} which contains the time
625     stamp, the three column vectors of $\mathsf{H}$, and optional extra
626     information for the extended sytem ensembles. The lines in the {\tt
627     $<$StuntDoubles$>$} sub-block provide information about the instantaneous
628     configuration of each integrable object. For each integrable object,
629     the global index is followed by a short string describing what
630     additional information is present on the line. Atoms with only
631     position and velocity information use the ``pv'' string which must
632     then be followed by the position and velocity vectors for that atom.
633     Directional atoms and Rigid Bodies typically use the ``pvqj'' string
634     which is followed by position, velocity, quaternions, and
635     lastly, body fixed angular momentum for that integrable object.},
636     label=sch:dumpFormat]
637     <Snapshot>
638     <FrameData>
639     Time: 0
640     Hmat: {{ Hxx, Hyx, Hzx }, { Hxy, Hyy, Hzy }, { Hxz, Hyz, Hzz }}
641     Thermostat: 0 , 0
642     Barostat: {{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }}
643     </FrameData>
644     <StuntDoubles>
645     0 pv x y z vx vy vz
646     1 pv x y z vx vy vz
647     2 pvqj x y z vx vy vz qw qx qy qz jx jy jz
648     3 pvqj x y z vx vy vz qw qx qy qz jx jy jz
649     </StuntDoubles>
650     </Snapshot>
651     \end{lstlisting}
652    
653     There are three {\sc oopse} files that are written using the combined
654     format. They are: the initial startup file (\texttt{.md}), the
655     simulation trajectory file (\texttt{.dump}), and the final coordinates
656     or ``end-of-run'' for the simulation (\texttt{.eor}). The initial
657     startup file is necessary for {\sc oopse} to start the simulation with
658     the proper coordinates, and this file must be generated by the user
659     before the simulation run. The trajectory (or ``dump'') file is
660     updated during simulation and is used to store snapshots of the
661     coordinates at regular intervals. The first frame is a duplication of
662     the initial configuration (the last good {\tt $<$Snapshot$>$} in the
663     startup file), and each subsequent frame is appended to the dump file
664     at an interval specified in the meta-data file with the
665     \texttt{sampleTime} flag. The final coordinate file is the
666     ``end-of-run'' file. The \texttt{.eor} file stores the final
667     configuration of the system for a given simulation. The file is
668     updated at the same time as the \texttt{.dump} file, but it only
669     contains the most recent frame. In this way, an \texttt{.eor} file may
670     be used to initialize a second simulation should it be necessary to
671     recover from a crash or power outage. The coordinate files generated
672     by {\sc oopse} (both \texttt{.dump} and \texttt{.eor}) all contain the
673     same {\tt $<$MetaData$>$} block as the startup file, so they may be
674     used to start up a new simulation if desired.
675    
676     \section{\label{oopseSec:initCoords}Generation of Initial Coordinates}
677    
678     As was stated in Sec.~\ref{oopseSec:coordFiles}, a meaningful {\tt
679     $<$Snapshot$>$} block is necessary for specifying for the starting
680     coordinates for a simulation. Since each simulation is different,
681     system creation is left to the end user; however, we have included a
682     few sample programs which make some specialized structures. The {\tt
683     $<$Snapshot$>$} block must index the integrable objects in the correct
684     order. The ordering of the integrable objects relies on the ordering
685     of molecules within the {\tt $<$MetaData$>$} block. {\sc oopse}
686     expects the order to comply with the following guidelines:
687     \begin{enumerate}
688     \item All of the molecules of the first declared component are given
689     before proceeding to the molecules of the second component, and so on
690     for all subsequently declared components.
691     \item The ordering of the atoms for each molecule follows the order
692     declared in the molecule's declaration within the model file.
693     \item Only atoms which are not members of a {\tt rigidBody} are
694     included.
695     \item Rigid Body coordinates for a molecule are listed immediately
696     after the the other atoms in a molecule. Some molecules may be
697     entirely rigid, in which case, only the rigid body coordinates are
698     given.
699     \end{enumerate}
700     An example is given in the {\sc oopse} file in Scheme~\ref{sch:initEx1}.
701    
702     \begin{lstlisting}[float,caption={Example declaration of the
703     $\text{I}_2$ molecule and the HCl molecule in $<$MetaData$>$ and
704     $<$Snapshot$>$ blocks. Note that even though $\text{I}_2$ is
705     declared before HCl, the $<$Snapshot$>$ block follows the order {\it in
706     which the components were included}.}, label=sch:initEx1]
707     <OOPSE>
708     <MetaData>
709     molecule{
710     name = "I2";
711     atom[0]{
712     type = "I";
713     }
714     atom[1]{
715     type = "I";
716     }
717     bond{
718     members( 0, 1);
719     }
720     }
721     molecule{
722     name = "HCl"
723     atom[0]{
724     type = "H";
725     }
726     atom[1]{
727     type = "Cl";
728     }
729     bond{
730     members( 0, 1);
731     }
732     }
733     component{
734     type = "HCl";
735     nMol = 4;
736     }
737     component{
738     type = "I2";
739     nMol = 1;
740     }
741     </MetaData>
742     <Snapshot>
743     <FrameData>
744     Time: 0
745     Hmat: {{ 10.0, 0.0, 0.0 }, { 0.0, 10.0, 0.0 }, { 0.0, 0.0, 10.0 }}
746     </FrameData>
747     <StuntDoubles>
748     0 pv x y z vx vy vz // H from first HCl molecule
749     1 pv x y z vx vy vz // Cl from first HCl molecule
750     2 pv x y z vx vy vz // H from second HCl molecule
751     3 pv x y z vx vy vz // Cl from second HCl molecule
752     4 pv x y z vx vy vz // H from third HCl molecule
753     5 pv x y z vx vy vz // Cl from third HCl molecule
754     6 pv x y z vx vy vz // H from fourth HCl molecule
755     7 pv x y z vx vy vz // Cl from fourth HCl molecule
756     8 pv x y z vx vy vz // First I from I2 molecule
757     9 pv x y z vx vy vz // Second I from I2 molecule
758     </StuntDoubles>
759     </Snapshot>
760     </OOPSE>
761     \end{lstlisting}
762    
763     \section{The Statistics File}
764    
765     The last output file generated by {\sc oopse} is the statistics
766     file. This file records such statistical quantities as the
767     instantaneous temperature (in $K$), volume (in $\mbox{\AA}^{3}$),
768     pressure (in $\mbox{atm}$), etc. It is written out with the frequency
769     specified in the meta-data file with the
770     \texttt{statusTime} keyword. The file allows the user to observe the
771     system variables as a function of simulation time while the simulation
772     is in progress. One useful function the statistics file serves is to
773     monitor the conserved quantity of a given simulation ensemble,
774     allowing the user to gauge the stability of the integrator. The
775     statistics file is denoted with the \texttt{.stat} file extension.
776    
777     \chapter{\label{oopseSec:empiricalEnergy}The Empirical Energy
778     Functions}
779    
780     Like many simulation packages, {\sc oopse} splits the potential energy
781     into the short-ranged (bonded) portion and a long-range (non-bonded)
782     potential,
783     \begin{equation}
784     V = V_{\mathrm{short-range}} + V_{\mathrm{long-range}}.
785     \end{equation}
786     The short-ranged portion includes the explicit bonds, bends, and
787     torsions which have been defined in the meta-data file for the
788     molecules which are present in the simulation. The functional forms and
789     parameters for these interactions are defined by the force field which
790     is chosen.
791    
792     Calculating the long-range (non-bonded) potential involves a sum over
793     all pairs of atoms (except for those atoms which are involved in a
794     bond, bend, or torsion with each other). If done poorly, calculating
795     the the long-range interactions for $N$ atoms would involve $N(N-1)/2$
796     evaluations of atomic distances. To reduce the number of distance
797     evaluations between pairs of atoms, {\sc oopse} uses a switched cutoff
798     with Verlet neighbor lists.\cite{Allen87} It is well known that
799     neutral groups which contain charges will exhibit pathological forces
800     unless the cutoff is applied to the neutral groups evenly instead of
801     to the individual atoms.\cite{leach01:mm} {\sc oopse} allows users to
802     specify cutoff groups which may contain an arbitrary number of atoms
803     in the molecule. Atoms in a cutoff group are treated as a single unit
804     for the evaluation of the switching function:
805     \begin{equation}
806     V_{\mathrm{long-range}} = \sum_{a} \sum_{b>a} s(r_{ab}) \sum_{i \in a} \sum_{j \in b} V_{ij}(r_{ij}),
807     \end{equation}
808     where $r_{ab}$ is the distance between the centers of mass of the two
809     cutoff groups ($a$ and $b$).
810    
811     The sums over $a$ and $b$ are over the cutoff groups that are present
812     in the simulation. Atoms which are not explicitly defined as members
813     of a {\tt cutoffGroup} are treated as a group consisting of only one
814     atom. The switching function, $s(r)$ is the standard cubic switching
815     function,
816     \begin{equation}
817     S(r) =
818     \begin{cases}
819     1 & \text{if $r \le r_{\text{sw}}$},\\
820     \frac{(r_{\text{cut}} + 2r - 3r_{\text{sw}})(r_{\text{cut}} - r)^2}
821     {(r_{\text{cut}} - r_{\text{sw}})^3}
822     & \text{if $r_{\text{sw}} < r \le r_{\text{cut}}$}, \\
823     0 & \text{if $r > r_{\text{cut}}$.}
824     \end{cases}
825     \label{eq:dipoleSwitching}
826     \end{equation}
827     Here, $r_{\text{sw}}$ is the {\tt switchingRadius}, or the distance
828     beyond which interactions are reduced, and $r_{\text{cut}}$ is the
829     {\tt cutoffRadius}, or the distance at which interactions are
830     truncated.
831    
832     Users of {\sc oopse} do not need to specify the {\tt cutoffRadius} or
833     {\tt switchingRadius}. In simulations containing only Lennard-Jones
834     atoms, the cutoff radius has a default value of $2.5\sigma_{ii}$,
835     where $\sigma_{ii}$ is the largest Lennard-Jones length parameter
836     present in the simulation. In simulations containing charged or
837     dipolar atoms, the default cutoff radius is $15 \mbox{\AA}$.
838    
839     The {\tt switchingRadius} is set to a default value of 95\% of the
840     {\tt cutoffRadius}. In the special case of a simulation containing
841     {\it only} Lennard-Jones atoms, the default switching radius takes the
842     same value as the cutoff radius, and {\sc oopse} will use a shifted
843     potential to remove discontinuities in the potential at the cutoff.
844     Both radii may be specified in the meta-data file.
845    
846     Force fields can be added to {\sc oopse}, although it comes with a few
847     simple examples (Lennard-Jones, {\sc duff}, {\sc water}, and {\sc
848     eam}) which are explained in the following sections.
849    
850     \section{\label{sec:LJPot}The Lennard Jones Force Field}
851    
852     The most basic force field implemented in {\sc oopse} is the
853     Lennard-Jones force field, which mimics the van der Waals interaction
854     at long distances and uses an empirical repulsion at short
855     distances. The Lennard-Jones potential is given by:
856     \begin{equation}
857     V_{\text{LJ}}(r_{ij}) =
858     4\epsilon_{ij} \biggl[
859     \biggl(\frac{\sigma_{ij}}{r_{ij}}\biggr)^{12}
860     - \biggl(\frac{\sigma_{ij}}{r_{ij}}\biggr)^{6}
861     \biggr],
862     \label{eq:lennardJonesPot}
863     \end{equation}
864     where $r_{ij}$ is the distance between particles $i$ and $j$,
865     $\sigma_{ij}$ scales the length of the interaction, and
866     $\epsilon_{ij}$ scales the well depth of the potential. Scheme
867     \ref{sch:LJFF} gives an example meta-data file that
868     sets up a system of 108 Ar particles to be simulated using the
869     Lennard-Jones force field.
870    
871     \begin{lstlisting}[float,caption={[Invocation of the Lennard-Jones
872     force field] A sample startup file for a small Lennard-Jones
873     simulation.},label={sch:LJFF}]
874     <OOPSE>
875     <MetaData>
876     #include "argon.md"
877    
878     component{
879     type = "Ar";
880     nMol = 108;
881     }
882    
883     forceField = "LJ";
884     </MetaData>
885     <Snapshot> // not shown in this scheme
886     </Snapshot>
887     </OOPSE>
888     \end{lstlisting}
889    
890     Interactions between dissimilar particles requires the generation of
891     cross term parameters for $\sigma$ and $\epsilon$. These parameters
892     are determined using the Lorentz-Berthelot mixing
893     rules:\cite{Allen87}
894     \begin{equation}
895     \sigma_{ij} = \frac{1}{2}[\sigma_{ii} + \sigma_{jj}],
896     \label{eq:sigmaMix}
897     \end{equation}
898     and
899     \begin{equation}
900     \epsilon_{ij} = \sqrt{\epsilon_{ii} \epsilon_{jj}}.
901     \label{eq:epsilonMix}
902     \end{equation}
903    
904     \section{\label{oopseSec:DUFF}Dipolar Unified-Atom Force Field}
905    
906     The dipolar unified-atom force field ({\sc duff}) was developed to
907     simulate lipid bilayers. These types of simulations require a model
908     capable of forming bilayers, while still being sufficiently
909     computationally efficient to allow large systems ($\sim$100's of
910     phospholipids, $\sim$1000's of waters) to be simulated for long times
911     ($\sim$10's of nanoseconds). With this goal in mind, {\sc duff} has no
912     point charges. Charge-neutral distributions are replaced with dipoles,
913     while most atoms and groups of atoms are reduced to Lennard-Jones
914     interaction sites. This simplification reduces the length scale of
915     long range interactions from $\frac{1}{r}$ to $\frac{1}{r^3}$,
916     removing the need for the computationally expensive Ewald
917     sum. Instead, Verlet neighbor-lists and cutoff radii are used for the
918     dipolar interactions, and, if desired, a reaction field may be added
919     to mimic longer range interactions.
920    
921     As an example, lipid head-groups in {\sc duff} are represented as
922     point dipole interaction sites. Placing a dipole at the head group's
923     center of mass mimics the charge separation found in common
924     phospholipid head groups such as phosphatidylcholine.\cite{Cevc87}
925     Additionally, a large Lennard-Jones site is located at the
926     pseudoatom's center of mass. The model is illustrated by the red atom
927     in Fig.~\ref{oopseFig:lipidModel}. The water model we use to
928     complement the dipoles of the lipids is a
929     reparameterization\cite{fennell04} of the soft sticky dipole (SSD)
930     model of Ichiye
931     \emph{et al.}\cite{liu96:new_model}
932    
933     \begin{figure}
934     \centering
935     \includegraphics[width=\linewidth]{lipidModel.pdf}
936     \caption[A representation of a lipid model in {\sc duff}]{A
937     representation of the lipid model. $\phi$ is the torsion angle,
938     $\theta$ is the bend angle, and $\mu$ is the dipole moment of the head
939     group.}
940     \label{oopseFig:lipidModel}
941     \end{figure}
942    
943     A set of scalable parameters has been used to model the alkyl groups
944     with Lennard-Jones sites. For this, parameters from the TraPPE force
945     field of Siepmann \emph{et al.}\cite{Siepmann1998} have been
946     utilized. TraPPE is a unified-atom representation of n-alkanes which
947     is parametrized against phase equilibria using Gibbs ensemble Monte
948     Carlo simulation techniques.\cite{Siepmann1998} One of the advantages
949     of TraPPE is that it generalizes the types of atoms in an alkyl chain
950     to keep the number of pseudoatoms to a minimum; thus, the parameters
951     for a unified atom such as $\text{CH}_2$ do not change depending on
952     what species are bonded to it.
953    
954     As is required by TraPPE, {\sc duff} also constrains all bonds to be
955     of fixed length. Typically, bond vibrations are the fastest motions in
956     a molecular dynamic simulation. With these vibrations present, small
957     time steps between force evaluations must be used to ensure adequate
958     energy conservation in the bond degrees of freedom. By constraining
959     the bond lengths, larger time steps may be used when integrating the
960     equations of motion. A simulation using {\sc duff} is illustrated in
961     Scheme \ref{sch:DUFF}.
962    
963     \begin{lstlisting}[float,caption={[Invocation of {\sc duff}]A portion
964     of a startup file showing a simulation utilizing {\sc
965     duff}},label={sch:DUFF}]
966     <OOPSE>
967     <MetaData>
968     #include "water.md"
969     #include "lipid.md"
970    
971     component{
972     type = "simpleLipid_16";
973     nMol = 60;
974     }
975    
976     component{
977     type = "SSD_water";
978     nMol = 1936;
979     }
980    
981     forceField = "DUFF";
982     </MetaData>
983     <Snapshot> // not shown in this scheme
984     </Snapshot>
985     </OOPSE
986     \end{lstlisting}
987    
988     \subsection{\label{oopseSec:energyFunctions}{\sc duff} Energy Functions}
989    
990     The total potential energy function in {\sc duff} is
991     \begin{equation}
992     V = \sum^{N}_{I=1} V^{I}_{\text{Internal}}
993     + \sum^{N-1}_{I=1} \sum_{J>I} V^{IJ}_{\text{Cross}},
994     \label{eq:totalPotential}
995     \end{equation}
996     where $V^{I}_{\text{Internal}}$ is the internal potential of molecule $I$:
997     \begin{equation}
998     V^{I}_{\text{Internal}} =
999     \sum_{\theta_{ijk} \in I} V_{\text{bend}}(\theta_{ijk})
1000     + \sum_{\phi_{ijkl} \in I} V_{\text{torsion}}(\phi_{ijkl})
1001     + \sum_{i \in I} \sum_{(j>i+4) \in I}
1002     \biggl[ V_{\text{LJ}}(r_{ij}) + V_{\text{dipole}}
1003     (\mathbf{r}_{ij},\boldsymbol{\Omega}_{i},\boldsymbol{\Omega}_{j})
1004     \biggr].
1005     \label{eq:internalPotential}
1006     \end{equation}
1007     Here $V_{\text{bend}}$ is the bend potential for all 1, 3 bonded pairs
1008     within the molecule $I$, and $V_{\text{torsion}}$ is the torsion
1009     potential for all 1, 4 bonded pairs. The pairwise portions of the
1010     non-bonded interactions are excluded for atom pairs that are involved
1011     in the smae bond, bend, or torsion. All other atom pairs within a
1012     molecule are subject to the LJ pair potential.
1013    
1014     The bend potential of a molecule is represented by the following function:
1015     \begin{equation}
1016     V_{\text{bend}}(\theta_{ijk}) = k_{\theta}( \theta_{ijk} - \theta_0
1017     )^2, \label{eq:bendPot}
1018     \end{equation}
1019     where $\theta_{ijk}$ is the angle defined by atoms $i$, $j$, and $k$
1020     (see Fig.~\ref{oopseFig:lipidModel}), $\theta_0$ is the equilibrium
1021     bond angle, and $k_{\theta}$ is the force constant which determines the
1022     strength of the harmonic bend. The parameters for $k_{\theta}$ and
1023     $\theta_0$ are borrowed from those in TraPPE.\cite{Siepmann1998}
1024    
1025     The torsion potential and parameters are also borrowed from TraPPE. It is
1026     of the form:
1027     \begin{equation}
1028     V_{\text{torsion}}(\phi) = c_1[1 + \cos \phi]
1029     + c_2[1 + \cos(2\phi)]
1030     + c_3[1 + \cos(3\phi)],
1031     \label{eq:origTorsionPot}
1032     \end{equation}
1033     where:
1034     \begin{equation}
1035     \cos\phi = (\hat{\mathbf{r}}_{ij} \times \hat{\mathbf{r}}_{jk}) \cdot
1036     (\hat{\mathbf{r}}_{jk} \times \hat{\mathbf{r}}_{kl}).
1037     \label{eq:torsPhi}
1038     \end{equation}
1039     Here, $\hat{\mathbf{r}}_{\alpha\beta}$ are the set of unit bond
1040     vectors between atoms $i$, $j$, $k$, and $l$. For computational
1041     efficiency, the torsion potential has been recast after the method of
1042     {\sc charmm},\cite{Brooks83} in which the angle series is converted to
1043     a power series of the form:
1044     \begin{equation}
1045     V_{\text{torsion}}(\phi) =
1046     k_3 \cos^3 \phi + k_2 \cos^2 \phi + k_1 \cos \phi + k_0,
1047     \label{eq:torsionPot}
1048     \end{equation}
1049     where:
1050     \begin{align*}
1051     k_0 &= c_1 + c_3, \\
1052     k_1 &= c_1 - 3c_3, \\
1053     k_2 &= 2 c_2, \\
1054     k_3 &= 4c_3.
1055     \end{align*}
1056     By recasting the potential as a power series, repeated trigonometric
1057     evaluations are avoided during the calculation of the potential
1058     energy.
1059    
1060    
1061     The cross potential between molecules $I$ and $J$,
1062     $V^{IJ}_{\text{Cross}}$, is as follows:
1063     \begin{equation}
1064     V^{IJ}_{\text{Cross}} =
1065     \sum_{i \in I} \sum_{j \in J}
1066     \biggl[ V_{\text{LJ}}(r_{ij}) + V_{\text{dipole}}
1067     (\mathbf{r}_{ij},\boldsymbol{\Omega}_{i},\boldsymbol{\Omega}_{j})
1068     + V_{\text{sticky}}
1069     (\mathbf{r}_{ij},\boldsymbol{\Omega}_{i},\boldsymbol{\Omega}_{j})
1070     \biggr],
1071     \label{eq:crossPotentail}
1072     \end{equation}
1073     where $V_{\text{LJ}}$ is the Lennard Jones potential,
1074     $V_{\text{dipole}}$ is the dipole dipole potential, and
1075     $V_{\text{sticky}}$ is the sticky potential defined by the SSD model
1076     (Sec.~\ref{oopseSec:SSD}). Note that not all atom types include all
1077     interactions.
1078    
1079     The dipole-dipole potential has the following form:
1080     \begin{equation}
1081     V_{\text{dipole}}(\mathbf{r}_{ij},\boldsymbol{\Omega}_{i},
1082     \boldsymbol{\Omega}_{j}) = \frac{|\mu_i||\mu_j|}{4\pi\epsilon_{0}r_{ij}^{3}} \biggl[
1083     \boldsymbol{\hat{u}}_{i} \cdot \boldsymbol{\hat{u}}_{j}
1084     -
1085     3(\boldsymbol{\hat{u}}_i \cdot \hat{\mathbf{r}}_{ij}) %
1086     (\boldsymbol{\hat{u}}_j \cdot \hat{\mathbf{r}}_{ij}) \biggr].
1087     \label{eq:dipolePot}
1088     \end{equation}
1089     Here $\mathbf{r}_{ij}$ is the vector starting at atom $i$ pointing
1090     towards $j$, and $\boldsymbol{\Omega}_i$ and $\boldsymbol{\Omega}_j$
1091     are the orientational degrees of freedom for atoms $i$ and $j$
1092     respectively. The magnitude of the dipole moment of atom $i$ is
1093     $|\mu_i|$, $\boldsymbol{\hat{u}}_i$ is the standard unit orientation
1094     vector of $\boldsymbol{\Omega}_i$, and $\boldsymbol{\hat{r}}_{ij}$ is
1095     the unit vector pointing along $\mathbf{r}_{ij}$
1096     ($\boldsymbol{\hat{r}}_{ij}=\mathbf{r}_{ij}/|\mathbf{r}_{ij}|$).
1097    
1098     \subsection{\label{oopseSec:SSD}The {\sc duff} Water Models: SSD/E
1099     and SSD/RF}
1100    
1101     In the interest of computational efficiency, the default solvent used
1102     by {\sc oopse} is the extended Soft Sticky Dipole (SSD/E) water
1103     model.\cite{fennell04} The original SSD was developed by Ichiye
1104     \emph{et al.}\cite{liu96:new_model} as a modified form of the hard-sphere
1105     water model proposed by Bratko, Blum, and
1106     Luzar.\cite{Bratko85,Bratko95} It consists of a single point dipole
1107     with a Lennard-Jones core and a sticky potential that directs the
1108     particles to assume the proper hydrogen bond orientation in the first
1109     solvation shell. Thus, the interaction between two SSD water molecules
1110     \emph{i} and \emph{j} is given by the potential
1111     \begin{equation}
1112     V_{ij} =
1113     V_{ij}^{LJ} (r_{ij})\ + V_{ij}^{dp}
1114     (\mathbf{r}_{ij},\boldsymbol{\Omega}_i,\boldsymbol{\Omega}_j)\ +
1115     V_{ij}^{sp}
1116     (\mathbf{r}_{ij},\boldsymbol{\Omega}_i,\boldsymbol{\Omega}_j),
1117     \label{eq:ssdPot}
1118     \end{equation}
1119     where the $\mathbf{r}_{ij}$ is the position vector between molecules
1120     \emph{i} and \emph{j} with magnitude equal to the distance $r_{ij}$, and
1121     $\boldsymbol{\Omega}_i$ and $\boldsymbol{\Omega}_j$ represent the
1122     orientations of the respective molecules. The Lennard-Jones and dipole
1123     parts of the potential are given by equations \ref{eq:lennardJonesPot}
1124     and \ref{eq:dipolePot} respectively. The sticky part is described by
1125     the following,
1126     \begin{equation}
1127     u_{ij}^{sp}(\mathbf{r}_{ij},\boldsymbol{\Omega}_i,\boldsymbol{\Omega}_j)=
1128     \frac{\nu_0}{2}[s(r_{ij})w(\mathbf{r}_{ij},
1129     \boldsymbol{\Omega}_i,\boldsymbol{\Omega}_j) +
1130     s^\prime(r_{ij})w^\prime(\mathbf{r}_{ij},
1131     \boldsymbol{\Omega}_i,\boldsymbol{\Omega}_j)]\ ,
1132     \label{eq:stickyPot}
1133     \end{equation}
1134     where $\nu_0$ is a strength parameter for the sticky potential, and
1135     $s$ and $s^\prime$ are cubic switching functions which turn off the
1136     sticky interaction beyond the first solvation shell. The $w$ function
1137     can be thought of as an attractive potential with tetrahedral
1138     geometry:
1139     \begin{equation}
1140     w({\bf r}_{ij},{\bf \Omega}_i,{\bf \Omega}_j)=
1141     \sin\theta_{ij}\sin2\theta_{ij}\cos2\phi_{ij},
1142     \label{eq:stickyW}
1143     \end{equation}
1144     while the $w^\prime$ function counters the normal aligned and
1145     anti-aligned structures favored by point dipoles:
1146     \begin{equation}
1147     w^\prime({\bf r}_{ij},{\bf \Omega}_i,{\bf \Omega}_j)=
1148     (\cos\theta_{ij}-0.6)^2(\cos\theta_{ij}+0.8)^2-w^0,
1149     \label{eq:stickyWprime}
1150     \end{equation}
1151     It should be noted that $w$ is proportional to the sum of the $Y_3^2$
1152     and $Y_3^{-2}$ spherical harmonics (a linear combination which
1153     enhances the tetrahedral geometry for hydrogen bonded structures),
1154     while $w^\prime$ is a purely empirical function. A more detailed
1155     description of the functional parts and variables in this potential
1156     can be found in the original SSD
1157     articles.\cite{liu96:new_model,liu96:monte_carlo,chandra99:ssd_md,Ichiye03}
1158    
1159     \begin{figure}
1160     \centering
1161     \includegraphics[width=\linewidth]{waterAngle.pdf}
1162     \caption[Coordinate definition for the SSD/E water model]{Coordinates
1163     for the interaction between two SSD/E water molecules. $\theta_{ij}$
1164     is the angle that $r_{ij}$ makes with the $\hat{z}$ vector in the
1165     body-fixed frame for molecule $i$. The $\hat{z}$ vector bisects the
1166     HOH angle in each water molecule. }
1167     \label{oopseFig:ssd}
1168     \end{figure}
1169    
1170    
1171     Since SSD/E is a single-point {\it dipolar} model, the force
1172     calculations are simplified significantly relative to the standard
1173     {\it charged} multi-point models. In the original Monte Carlo
1174     simulations using this model, Ichiye {\it et al.} reported that using
1175     SSD decreased computer time by a factor of 6-7 compared to other
1176     models.\cite{liu96:new_model} What is most impressive is that these
1177     savings did not come at the expense of accurate depiction of the
1178     liquid state properties. Indeed, SSD/E maintains reasonable agreement
1179     with the Head-Gordon diffraction data for the structural features of
1180     liquid water.\cite{hura00,liu96:new_model} Additionally, the dynamical
1181     properties exhibited by SSD/E agree with experiment better than those
1182     of more computationally expensive models (like TIP3P and
1183     SPC/E).\cite{chandra99:ssd_md} The combination of speed and accurate
1184     depiction of solvent properties makes SSD/E a very attractive model
1185     for the simulation of large scale biochemical simulations.
1186    
1187     Recent constant pressure simulations revealed issues in the original
1188     SSD model that led to lower than expected densities at all target
1189     pressures.\cite{Ichiye03,fennell04} The default model in {\sc oopse}
1190     is therefore SSD/E, a density corrected derivative of SSD that
1191     exhibits improved liquid structure and transport behavior. If the use
1192     of a reaction field long-range interaction correction is desired, it
1193     is recommended that the parameters be modified to those of the SSD/RF
1194     model (an SSD variant parameterized for reaction field). These solvent
1195     parameters are listed and can be easily modified in the {\sc duff}
1196     force field file ({\tt DUFF.frc}). A table of the parameter values
1197     and the drawbacks and benefits of the different density corrected SSD
1198     models can be found in reference~\cite{fennell04}.
1199    
1200     \section{\label{oopseSec:WATER}The {\sc water} Force Field}
1201    
1202     In addition to the {\sc duff} force field's solvent description, a
1203     separate {\sc water} force field has been included for simulating most
1204     of the common rigid-body water models. This force field includes the
1205     simple and point-dipolar models (SSD, SSD1, SSD/E, SSD/RF, and DPD
1206     water), as well as the common charge-based models (SPC, SPC/E, TIP3P,
1207     TIP4P, and
1208     TIP5P).\cite{liu96:new_model,Ichiye03,fennell04,Marrink01,Berendsen81,Berendsen87,Jorgensen83,Mahoney00}
1209     In order to handle these models, charge-charge interactions were
1210     included in the force-loop:
1211     \begin{equation}
1212     V_{\text{charge}}(r_{ij}) = \sum_{ij}\frac{q_iq_je^2}{r_{ij}},
1213     \end{equation}
1214     where $q$ represents the charge on particle $i$ or $j$, and $e$ is the
1215     charge of an electron in Coulombs. The charge-charge interaction
1216     support is rudimentary in the current version of {\sc oopse}. As with
1217     the other pair interactions, charges can be simulated with a pure
1218     cutoff or a reaction field. The various methods for performing the
1219     Ewald summation have not yet been included. The {\sc water} force
1220     field can be easily expanded through modification of the {\sc water}
1221     force field file ({\tt WATER.frc}). By adding atom types and inserting
1222     the appropriate parameters, it is possible to extend the force field
1223     to handle rigid molecules other than water.
1224    
1225     \section{\label{oopseSec:eam}Embedded Atom Method}
1226    
1227     {\sc oopse} implements a potential that describes bonding in
1228     transition metal
1229     systems.~\cite{Finnis84,Ercolessi88,Chen90,Qi99,Ercolessi02} This
1230     potential has an attractive interaction which models ``Embedding'' a
1231     positively charged pseudo-atom core in the electron density due to the
1232     free valance ``sea'' of electrons created by the surrounding atoms in
1233     the system. A pairwise part of the potential (which is primarily
1234     repulsive) describes the interaction of the positively charged metal
1235     core ions with one another. The Embedded Atom Method ({\sc
1236     eam})~\cite{Daw84,FBD86,johnson89,Lu97} has been widely adopted in the
1237     materials science community and has been included in {\sc oopse}. A
1238     good review of {\sc eam} and other formulations of metallic potentials
1239     was given by Voter.\cite{Voter:95}
1240    
1241     The {\sc eam} potential has the form:
1242     \begin{equation}
1243     V = \sum_{i} F_{i}\left[\rho_{i}\right] + \sum_{i} \sum_{j \neq i}
1244     \phi_{ij}({\bf r}_{ij})
1245     \end{equation}
1246     where $F_{i} $ is an embedding functional that approximates the energy
1247     required to embed a positively-charged core ion $i$ into a linear
1248     superposition of spherically averaged atomic electron densities given
1249     by $\rho_{i}$,
1250     \begin{equation}
1251     \rho_{i} = \sum_{j \neq i} f_{j}({\bf r}_{ij}),
1252     \end{equation}
1253     Since the density at site $i$ ($\rho_i$) must be computed before the
1254     embedding functional can be evaluated, {\sc eam} and the related
1255     transition metal potentials require two loops through the atom pairs
1256     to compute the inter-atomic forces.
1257    
1258     The pairwise portion of the potential, $\phi_{ij}$, is a primarily
1259     repulsive interaction between atoms $i$ and $j$. In the original
1260     formulation of {\sc eam}\cite{Daw84}, $\phi_{ij}$ was an entirely
1261     repulsive term; however later refinements to {\sc eam} allowed for
1262     more general forms for $\phi$.\cite{Daw89} The effective cutoff
1263     distance, $r_{{\text cut}}$ is the distance at which the values of
1264     $f(r)$ and $\phi(r)$ drop to zero for all atoms present in the
1265     simulation. In practice, this distance is fairly small, limiting the
1266     summations in the {\sc eam} equation to the few dozen atoms
1267     surrounding atom $i$ for both the density $\rho$ and pairwise $\phi$
1268     interactions.
1269    
1270     In computing forces for alloys, mixing rules as outlined by
1271     Johnson~\cite{johnson89} are used to compute the heterogenous pair
1272     potential,
1273     \begin{equation}
1274     \label{eq:johnson}
1275     \phi_{ab}(r)=\frac{1}{2}\left(
1276     \frac{f_{b}(r)}{f_{a}(r)}\phi_{aa}(r)+
1277     \frac{f_{a}(r)}{f_{b}(r)}\phi_{bb}(r)
1278     \right).
1279     \end{equation}
1280     No mixing rule is needed for the densities, since the density at site
1281     $i$ is simply the linear sum of density contributions of all the other
1282     atoms.
1283    
1284     The {\sc eam} force field illustrates an additional feature of {\sc
1285     oopse}. Foiles, Baskes and Daw fit {\sc eam} potentials for Cu, Ag,
1286     Au, Ni, Pd, Pt and alloys of these metals.\cite{FBD86} These fits are
1287     included in {\sc oopse} as the {\tt u3} variant of the {\sc eam} force
1288     field. Voter and Chen reparamaterized a set of {\sc eam} functions
1289     which do a better job of predicting melting points.\cite{Voter:87}
1290     These functions are included in {\sc oopse} as the {\tt VC} variant of
1291     the {\sc eam} force field. An additional set of functions (the
1292     ``Universal 6'' functions) are included in {\sc oopse} as the {\tt u6}
1293     variant of {\sc eam}. For example, to specify the Voter-Chen variant
1294     of the {\sc eam} force field, the user would add the {\tt
1295     forceFieldVariant = "VC";} line to the meta-data file.
1296    
1297     The potential files used by the {\sc eam} force field are in the
1298     standard {\tt funcfl} format, which is the format utilized by a number
1299     of other codes (e.g. ParaDyn~\cite{Paradyn}, {\sc dynamo 86}). It
1300     should be noted that the energy units in these files are in eV, not
1301     $\mbox{kcal mol}^{-1}$ as in the rest of the {\sc oopse} force field
1302     files.
1303    
1304     \section{\label{oopseSec:sc}The Sutton-Chen Force Field}
1305    
1306     The Sutton-Chen ({\sc sc})~\cite{Chen90} potential has been used to
1307     study a wide range of phenomena in metals. Although it is similar in
1308     form to the {\sc eam} potential, the Sutton-Chen model takes on a
1309     simpler form,
1310     \begin{equation}
1311     \label{eq:SCP1}
1312     U_{tot}=\sum _{i}\left[ \frac{1}{2}\sum _{j\neq
1313     i}D_{ij}V^{pair}_{ij}(r_{ij})-c_{i}D_{ii}\sqrt{\rho_{i}}\right] ,
1314     \end{equation}
1315     where $V^{pair}_{ij}$ and $\rho_{i}$ are given by
1316     \begin{equation}
1317     \label{eq:SCP2}
1318     V^{pair}_{ij}(r)=\left(
1319     \frac{\alpha_{ij}}{r_{ij}}\right)^{n_{ij}}, \rho_{i}=\sum_{j\neq i}\left(
1320     \frac{\alpha_{ij}}{r_{ij}}\right) ^{m_{ij}}
1321     \end{equation}
1322    
1323     $V^{pair}_{ij}$ is a repulsive pairwise potential that accounts for
1324     interactions of the pseudo-atom cores. The $\sqrt{\rho_i}$ term in
1325     Eq. (\ref{eq:SCP1}) is an attractive many-body potential that models
1326     the interactions between the valence electrons and the cores of the
1327     pseudo-atoms. $D_{ij}$, $D_{ii}$, $c_i$ and $\alpha_{ij}$ are
1328     parameters used to tune the potential for different transition
1329     metals.
1330    
1331     The {\sc sc} potential form has also been parameterized by Qi {\it et
1332     al.}\cite{Qi99} These parameters were obtained via empirical and {\it
1333     ab initio} calculations to match structural features of the FCC
1334     crystal. To specify the original Sutton-Chen variant of the {\sc sc}
1335     force field, the user would add the {\tt forceFieldVariant = "SC";}
1336     line to the meta-data file, while specification of the Qi {\it et al.}
1337     quantum-adapted variant of the {\sc sc} potential, the user would add
1338     the {\tt forceFieldVariant = "QSC";} line to the meta-data file.
1339    
1340     \section{\label{oopseSec:clay}The CLAY force field}
1341    
1342     The {\sc clay} force field is based on an ionic (nonbonded)
1343     description of the metal-oxygen interactions associated with hydrated
1344     phases. All atoms are represented as point charges and are allowed
1345     complete translational freedom. Metal-oxygen interactions are based on
1346     a simple Lennard-Jones potential combined with electrostatics. The
1347     empirical parameters were optimized by Cygan {\it et
1348     al.}\cite{Cygan04} on the basis of known mineral structures, and
1349     partial atomic charges were derived from periodic DFT quantum chemical
1350     calculations of simple oxide, hydroxide, and oxyhydroxide model
1351     compounds with well-defined structures.
1352    
1353    
1354     \section{\label{oopseSec:electrostatics}Electrostatics}
1355    
1356     To aid in performing simulations in more traditional force fields, we
1357     have added routines to carry out electrostatic interactions using a
1358     number of different electrostatic summation methods. These methods
1359     are extended from the damped and cutoff-neutralized Coulombic sum
1360     originally proposed by Wolf, {\it et al.}\cite{Wolf99} One of these,
1361     the damped shifted force method, shows a remarkable ability to
1362     reproduce the energetic and dynamic characteristics exhibited by
1363     simulations employing lattice summation techniques. The basic idea is
1364     to construct well-behaved real-space summation methods using two tricks:
1365     \begin{enumerate}
1366     \item shifting through the use of image charges, and
1367     \item damping the electrostatic interaction.
1368     \end{enumerate}
1369     Starting with the original observation that the effective range of the
1370     electrostatic interaction in condensed phases is considerably less
1371     than $r^{-1}$, either the cutoff sphere neutralization or the
1372     distance-dependent damping technique could be used as a foundation for
1373     a new pairwise summation method. Wolf \textit{et al.} made the
1374     observation that charge neutralization within the cutoff sphere plays
1375     a significant role in energy convergence; therefore we will begin our
1376     analysis with the various shifted forms that maintain this charge
1377     neutralization. We can evaluate the methods of Wolf
1378     \textit{et al.} and Zahn \textit{et al.} by considering the standard
1379     shifted potential,
1380     \begin{equation}
1381     V_\textrm{SP}(r) = \begin{cases}
1382     v(r)-v_\textrm{c} &\quad r\leqslant R_\textrm{c} \\ 0 &\quad r >
1383     R_\textrm{c}
1384     \end{cases},
1385     \label{eq:shiftingPotForm}
1386     \end{equation}
1387     and shifted force,
1388     \begin{equation}
1389     V_\textrm{SF}(r) = \begin{cases}
1390     v(r)-v_\textrm{c}-\left(\frac{d v(r)}{d r}\right)_{r=R_\textrm{c}}(r-R_\textrm{c
1391     })
1392     &\quad r\leqslant R_\textrm{c} \\ 0 &\quad r > R_\textrm{c}
1393     \end{cases},
1394     \label{eq:shiftingForm}
1395     \end{equation}
1396     functions where $v(r)$ is the unshifted form of the potential, and
1397     $v_c$ is $v(R_\textrm{c})$. The Shifted Force ({\sc sf}) form ensures
1398     that both the potential and the forces goes to zero at the cutoff
1399     radius, while the Shifted Potential ({\sc sp}) form only ensures the
1400     potential is smooth at the cutoff radius
1401     ($R_\textrm{c}$).\cite{Allen87}
1402    
1403     The forces associated with the shifted potential are simply the forces
1404     of the unshifted potential itself (when inside the cutoff sphere),
1405     \begin{equation}
1406     F_{\textrm{SP}} = -\left( \frac{d v(r)}{dr} \right),
1407     \end{equation}
1408     and are zero outside. Inside the cutoff sphere, the forces associated
1409     with the shifted force form can be written,
1410     \begin{equation}
1411     F_{\textrm{SF}} = -\left( \frac{d v(r)}{dr} \right) + \left(\frac{d
1412     v(r)}{dr} \right)_{r=R_\textrm{c}}.
1413     \end{equation}
1414    
1415     If the potential, $v(r)$, is taken to be the normal Coulomb potential,
1416     \begin{equation}
1417     v(r) = \frac{q_i q_j}{r},
1418     \label{eq:Coulomb}
1419     \end{equation}
1420     then the Shifted Potential ({\sc sp}) forms will give Wolf {\it et
1421     al.}'s undamped prescription:
1422     \begin{equation}
1423     V_\textrm{SP}(r) =
1424     q_iq_j\left(\frac{1}{r}-\frac{1}{R_\textrm{c}}\right) \quad
1425     r\leqslant R_\textrm{c},
1426     \label{eq:SPPot}
1427     \end{equation}
1428     with associated forces,
1429     \begin{equation}
1430     F_\textrm{SP}(r) = q_iq_j\left(\frac{1}{r^2}\right) \quad r\leqslant R_\textrm{c
1431     }.
1432     \label{eq:SPForces}
1433     \end{equation}
1434     These forces are identical to the forces of the standard Coulomb
1435     interaction, and cutting these off at $R_c$ was addressed by Wolf
1436     \textit{et al.} as undesirable. They pointed out that the effect of
1437     the image charges is neglected in the forces when this form is
1438     used,\cite{Wolf99} thereby eliminating any benefit from the method in
1439     molecular dynamics. Additionally, there is a discontinuity in the
1440     forces at the cutoff radius which results in energy drift during MD
1441     simulations.
1442    
1443     The shifted force ({\sc sf}) form using the normal Coulomb potential
1444     will give,
1445     \begin{equation}
1446     V_\textrm{SF}(r) = q_iq_j\left[\frac{1}{r}-\frac{1}{R_\textrm{c}}+\left(\frac{1}
1447     {R_\textrm{c}^2}\right)(r-R_\textrm{c})\right] \quad r\leqslant R_\textrm{c}.
1448     \label{eq:SFPot}
1449     \end{equation}
1450     with associated forces,
1451     \begin{equation}
1452     F_\textrm{SF}(r) = q_iq_j\left(\frac{1}{r^2}-\frac{1}{R_\textrm{c}^2}\right) \quad r\leqslant R_\textrm{c}.
1453     \label{eq:SFForces}
1454     \end{equation}
1455     This formulation has the benefits that there are no discontinuities at
1456     the cutoff radius, while the neutralizing image charges are present in
1457     both the energy and force expressions. It would be simple to add the
1458     self-neutralizing term back when computing the total energy of the
1459     system, thereby maintaining the agreement with the Madelung energies.
1460     A side effect of this treatment is the alteration in the shape of the
1461     potential that comes from the derivative term. Thus, a degree of
1462     clarity about agreement with the empirical potential is lost in order
1463     to gain functionality in dynamics simulations.
1464    
1465     Wolf \textit{et al.} originally discussed the energetics of the
1466     shifted Coulomb potential (Eq. \ref{eq:SPPot}) and found that it was
1467     insufficient for accurate determination of the energy with reasonable
1468     cutoff distances. The calculated Madelung energies fluctuated around
1469     the expected value as the cutoff radius was increased, but the
1470     oscillations converged toward the correct value.\cite{Wolf99} A
1471     damping function was incorporated to accelerate the convergence; and
1472     though alternative forms for the damping function could be
1473     used,\cite{Jones56,Heyes81} the complimentary error function was
1474     chosen to mirror the effective screening used in the Ewald summation.
1475     Incorporating this error function damping into the simple Coulomb
1476     potential,
1477     \begin{equation}
1478     v(r) = \frac{\mathrm{erfc}\left(\alpha r\right)}{r},
1479     \label{eq:dampCoulomb}
1480     \end{equation}
1481     the shifted potential (eq. (\ref{eq:SPPot})) becomes
1482     \begin{equation}
1483     V_{\textrm{DSP}}(r) = q_iq_j\left(\frac{\textrm{erfc}\left(\alpha r\right)}{r}-\
1484     frac{\textrm{erfc}\left(\alpha R_\textrm{c}\right)}{R_\textrm{c}}\right) \quad r
1485     \leqslant R_\textrm{c},
1486     \label{eq:DSPPot}
1487     \end{equation}
1488     with associated forces,
1489     \begin{equation}
1490     F_{\textrm{DSP}}(r) = q_iq_j\left(\frac{\textrm{erfc}\left(\alpha r\right)}{r^2}
1491     +\frac{2\alpha}{\pi^{1/2}}\frac{\exp{\left(-\alpha^2r^2\right)}}{r}\right) \quad
1492     r\leqslant R_\textrm{c}.
1493     \label{eq:DSPForces}
1494     \end{equation}
1495     Again, this damped shifted potential suffers from a
1496     force-discontinuity at the cutoff radius, and the image charges play
1497     no role in the forces. To remedy these concerns, one may derive a
1498     {\sc sf} variant by including the derivative term in
1499     eq. (\ref{eq:shiftingForm}),
1500     \begin{equation}
1501     \begin{split}
1502     V_\mathrm{DSF}(r) = q_iq_j\Biggr{[} & \frac{\mathrm{erfc}\left(\alpha r \right)}{r} -\frac{\mathrm{erfc}\left(\alpha R_\mathrm{c} \right) }{R_\mathrm{c}} \\
1503     & \left. +\left(\frac{\mathrm{erfc}\left(\alpha
1504     R_\mathrm{c}\right)}{R_\mathrm{c}^2}+\frac{2\alpha}{\pi^{1/2}}\frac{\exp\left(-\alpha^2R_\mathrm{c}^2\right)}{R_\mathrm{c}}\right)\left(r-R_\mathrm{c}\right)
1505     \right] \quad r\leqslant R_\textrm{c}
1506     \label{eq:DSFPot}
1507     \end{split}
1508     \end{equation}
1509     The derivative of the above potential will lead to the following forces,
1510     \begin{equation}
1511     \begin{split}
1512     F_\mathrm{DSF}(r) =
1513     q_iq_j\Biggr{[}&\left(\frac{\textrm{erfc}\left(\alpha r\right)}{r^2}+\frac{2\alpha}{\pi^{1/2}}\frac{\exp{\left(-\alpha^2r^2\right)}}{r}\right) \\ &\left.-\left(\frac{\textrm{erfc}\left(\alpha R_{\textrm{c}}\right)}{R_{\textrm{c}}^2}+\frac{2\alpha}{\pi^{1/2}}\frac{\exp{\left(-\alpha^2R_{\textrm{c}}^2
1514     \right)}}{R_{\textrm{c}}}\right)\right] \quad r\leqslant R_\textrm{c}.
1515     \label{eq:DSFForces}
1516     \end{split}
1517     \end{equation}
1518     If the damping parameter $(\alpha)$ is set to zero, the undamped case,
1519     eqs. (\ref{eq:SPPot} through \ref{eq:SFForces}) are correctly
1520     recovered from eqs. (\ref{eq:DSPPot} through \ref{eq:DSFForces}).
1521    
1522     It has been shown that the Damped Shifted Force method obtains nearly
1523     identical behavior to the smooth particle mesh Ewald ({\sc spme})
1524     method on a number of commonly simulated systems.\cite{Fennell06} For
1525     this reason, the default electrostatic summation method utilized by
1526     {\sc oopse} is the DSF (Eq. \ref{eq:DSFPot}) with a damping parameter
1527     ($\alpha$) that is set algorithmically from the cutoff radius.
1528    
1529     \section{\label{oopseSec:pbc}Periodic Boundary Conditions}
1530    
1531     \newcommand{\roundme}{\operatorname{round}}
1532    
1533     \textit{Periodic boundary conditions} are widely used to simulate bulk
1534     properties with a relatively small number of particles. In this method
1535     the simulation box is replicated throughout space to form an infinite
1536     lattice. During the simulation, when a particle moves in the primary
1537     cell, its image in other cells move in exactly the same direction with
1538     exactly the same orientation. Thus, as a particle leaves the primary
1539     cell, one of its images will enter through the opposite face. If the
1540     simulation box is large enough to avoid ``feeling'' the symmetries of
1541     the periodic lattice, surface effects can be ignored. The available
1542     periodic cells in {\sc oopse} are cubic, orthorhombic and
1543     parallelepiped. {\sc oopse} use a $3 \times 3$ matrix, $\mathsf{H}$,
1544     to describe the shape and size of the simulation box. $\mathsf{H}$ is
1545     defined:
1546     \begin{equation}
1547     \mathsf{H} = ( \mathbf{h}_x, \mathbf{h}_y, \mathbf{h}_z ),
1548     \end{equation}
1549     where $\mathbf{h}_{\alpha}$ is the column vector of the $\alpha$ axis of the
1550     box. During the course of the simulation both the size and shape of
1551     the box can be changed to allow volume fluctuations when constraining
1552     the pressure.
1553    
1554     A real space vector, $\mathbf{r}$ can be transformed in to a box space
1555     vector, $\mathbf{s}$, and back through the following transformations:
1556     \begin{align}
1557     \mathbf{s} &= \mathsf{H}^{-1} \mathbf{r}, \\
1558     \mathbf{r} &= \mathsf{H} \mathbf{s}.
1559     \end{align}
1560     The vector $\mathbf{s}$ is now a vector expressed as the number of box
1561     lengths in the $\mathbf{h}_x$, $\mathbf{h}_y$, and $\mathbf{h}_z$
1562     directions. To find the minimum image of a vector $\mathbf{r}$, {\sc
1563     oopse} first converts it to its corresponding vector in box space, and
1564     then casts each element to lie in the range $[-0.5,0.5]$:
1565     \begin{equation}
1566     s_{i}^{\prime}=s_{i}-\roundme(s_{i}),
1567     \end{equation}
1568     where $s_i$ is the $i$th element of $\mathbf{s}$, and
1569     $\roundme(s_i)$ is given by
1570     \begin{equation}
1571     \roundme(x) =
1572     \begin{cases}
1573     \lfloor x+0.5 \rfloor & \text{if $x \ge 0$,} \\
1574     \lceil x-0.5 \rceil & \text{if $x < 0$.}
1575     \end{cases}
1576     \end{equation}
1577     Here $\lfloor x \rfloor$ is the floor operator, and gives the largest
1578     integer value that is not greater than $x$, and $\lceil x \rceil$ is
1579     the ceiling operator, and gives the smallest integer that is not less
1580     than $x$.
1581    
1582     Finally, the minimum image coordinates $\mathbf{r}^{\prime}$ are
1583     obtained by transforming back to real space,
1584     \begin{equation}
1585     \mathbf{r}^{\prime}=\mathsf{H}^{-1}\mathbf{s}^{\prime}.%
1586     \end{equation}
1587     In this way, particles are allowed to diffuse freely in $\mathbf{r}$,
1588     but their minimum images, or $\mathbf{r}^{\prime}$, are used to compute
1589     the inter-atomic forces.
1590    
1591     \chapter{\label{oopseSec:mechanics}Mechanics}
1592    
1593     \section{\label{oopseSec:integrate}Integrating the Equations of Motion: the
1594     {\sc dlm} method}
1595    
1596     The default method for integrating the equations of motion in {\sc
1597     oopse} is a velocity-Verlet version of the symplectic splitting method
1598     proposed by Dullweber, Leimkuhler and McLachlan
1599     ({\sc dlm}).\cite{Dullweber1997} When there are no directional atoms or
1600     rigid bodies present in the simulation, this integrator becomes the
1601     standard velocity-Verlet integrator which is known to sample the
1602     microcanonical (NVE) ensemble.\cite{Frenkel1996}
1603    
1604     Previous integration methods for orientational motion have problems
1605     that are avoided in the {\sc dlm} method. Direct propagation of the Euler
1606     angles has a known $1/\sin\theta$ divergence in the equations of
1607     motion for $\phi$ and $\psi$,\cite{Allen87} leading to numerical
1608     instabilities any time one of the directional atoms or rigid bodies
1609     has an orientation near $\theta=0$ or $\theta=\pi$. Quaternion-based
1610     integration methods work well for propagating orientational motion;
1611     however, energy conservation concerns arise when using the
1612     microcanonical (NVE) ensemble. An earlier implementation of {\sc
1613     oopse} utilized quaternions for propagation of rotational motion;
1614     however, a detailed investigation showed that they resulted in a
1615     steady drift in the total energy, something that has been observed by
1616     Laird {\it et al.}\cite{Laird97}
1617    
1618     The key difference in the integration method proposed by Dullweber
1619     \emph{et al.} is that the entire $3 \times 3$ rotation matrix is
1620     propagated from one time step to the next. In the past, this would not
1621     have been feasible, since the rotation matrix for a single body has
1622     nine elements compared with the more memory-efficient methods (using
1623     three Euler angles or 4 quaternions). Computer memory has become much
1624     less costly in recent years, and this can be translated into
1625     substantial benefits in energy conservation.
1626    
1627     The basic equations of motion being integrated are derived from the
1628     Hamiltonian for conservative systems containing rigid bodies,
1629     \begin{equation}
1630     H = \sum_{i} \left( \frac{1}{2} m_i {\bf v}_i^T \cdot {\bf v}_i +
1631     \frac{1}{2} {\bf j}_i^T \cdot \overleftrightarrow{\mathsf{I}}_i^{-1} \cdot
1632     {\bf j}_i \right) +
1633     V\left(\left\{{\bf r}\right\}, \left\{\mathsf{A}\right\}\right),
1634     \end{equation}
1635     where ${\bf r}_i$ and ${\bf v}_i$ are the cartesian position vector
1636     and velocity of the center of mass of particle $i$, and ${\bf j}_i$,
1637     $\overleftrightarrow{\mathsf{I}}_i$ are the body-fixed angular
1638     momentum and moment of inertia tensor respectively, and the
1639     superscript $T$ denotes the transpose of the vector. $\mathsf{A}_i$
1640     is the $3 \times 3$ rotation matrix describing the instantaneous
1641     orientation of the particle. $V$ is the potential energy function
1642     which may depend on both the positions $\left\{{\bf r}\right\}$ and
1643     orientations $\left\{\mathsf{A}\right\}$ of all particles. The
1644     equations of motion for the particle centers of mass are derived from
1645     Hamilton's equations and are quite simple,
1646     \begin{eqnarray}
1647     \dot{{\bf r}} & = & {\bf v}, \\
1648     \dot{{\bf v}} & = & \frac{{\bf f}}{m},
1649     \end{eqnarray}
1650     where ${\bf f}$ is the instantaneous force on the center of mass
1651     of the particle,
1652     \begin{equation}
1653     {\bf f} = - \frac{\partial}{\partial
1654     {\bf r}} V(\left\{{\bf r}(t)\right\}, \left\{\mathsf{A}(t)\right\}).
1655     \end{equation}
1656    
1657     The equations of motion for the orientational degrees of freedom are
1658     \begin{eqnarray}
1659     \dot{\mathsf{A}} & = & \mathsf{A} \cdot
1660     \mbox{ skew}\left(\overleftrightarrow{\mathsf{I}}^{-1} \cdot {\bf j}\right),\\
1661     \dot{{\bf j}} & = & {\bf j} \times \left( \overleftrightarrow{\mathsf{I}}^{-1}
1662     \cdot {\bf j} \right) - \mbox{ rot}\left(\mathsf{A}^{T} \cdot \frac{\partial
1663     V}{\partial \mathsf{A}} \right).
1664     \end{eqnarray}
1665     In these equations of motion, the $\mbox{skew}$ matrix of a vector
1666     ${\bf v} = \left( v_1, v_2, v_3 \right)$ is defined:
1667     \begin{equation}
1668     \mbox{skew}\left( {\bf v} \right) := \left(
1669     \begin{array}{ccc}
1670     0 & v_3 & - v_2 \\
1671     -v_3 & 0 & v_1 \\
1672     v_2 & -v_1 & 0
1673     \end{array}
1674     \right).
1675     \end{equation}
1676     The $\mbox{rot}$ notation refers to the mapping of the $3 \times 3$
1677     rotation matrix to a vector of orientations by first computing the
1678     skew-symmetric part $\left(\mathsf{A} - \mathsf{A}^{T}\right)$ and
1679     then associating this with a length 3 vector by inverting the
1680     $\mbox{skew}$ function above:
1681     \begin{equation}
1682     \mbox{rot}\left(\mathsf{A}\right) := \mbox{ skew}^{-1}\left(\mathsf{A}
1683     - \mathsf{A}^{T} \right).
1684     \end{equation}
1685     Written this way, the $\mbox{rot}$ operation creates a set of
1686     conjugate angle coordinates to the body-fixed angular momenta
1687     represented by ${\bf j}$. This equation of motion for angular momenta
1688     is equivalent to the more familiar body-fixed forms,
1689     \begin{eqnarray}
1690     \dot{j_{x}} & = & \tau^b_x(t) -
1691     \left(\overleftrightarrow{\mathsf{I}}_{yy}^{-1} - \overleftrightarrow{\mathsf{I}}_{zz}^{-1} \right) j_y j_z, \\
1692     \dot{j_{y}} & = & \tau^b_y(t) -
1693     \left(\overleftrightarrow{\mathsf{I}}_{zz}^{-1} - \overleftrightarrow{\mathsf{I}}_{xx}^{-1} \right) j_z j_x,\\
1694     \dot{j_{z}} & = & \tau^b_z(t) -
1695     \left(\overleftrightarrow{\mathsf{I}}_{xx}^{-1} - \overleftrightarrow{\mathsf{I}}_{yy}^{-1} \right) j_x j_y,
1696     \end{eqnarray}
1697     which utilize the body-fixed torques, ${\bf \tau}^b$. Torques are
1698     most easily derived in the space-fixed frame,
1699     \begin{equation}
1700     {\bf \tau}^b(t) = \mathsf{A}(t) \cdot {\bf \tau}^s(t),
1701     \end{equation}
1702     where the torques are either derived from the forces on the
1703     constituent atoms of the rigid body, or for directional atoms,
1704     directly from derivatives of the potential energy,
1705     \begin{equation}
1706     {\bf \tau}^s(t) = - \hat{\bf u}(t) \times \left( \frac{\partial}
1707     {\partial \hat{\bf u}} V\left(\left\{ {\bf r}(t) \right\}, \left\{
1708     \mathsf{A}(t) \right\}\right) \right).
1709     \end{equation}
1710     Here $\hat{\bf u}$ is a unit vector pointing along the principal axis
1711     of the particle in the space-fixed frame.
1712    
1713     The {\sc dlm} method uses a Trotter factorization of the orientational
1714     propagator. This has three effects:
1715     \begin{enumerate}
1716     \item the integrator is area-preserving in phase space (i.e. it is
1717     {\it symplectic}),
1718     \item the integrator is time-{\it reversible}, making it suitable for Hybrid
1719     Monte Carlo applications, and
1720     \item the error for a single time step is of order $\mathcal{O}\left(h^4\right)$
1721     for timesteps of length $h$.
1722     \end{enumerate}
1723    
1724     The integration of the equations of motion is carried out in a
1725     velocity-Verlet style 2-part algorithm, where $h= \delta t$:
1726    
1727     {\tt moveA:}
1728     \begin{align*}
1729     {\bf v}\left(t + h / 2\right) &\leftarrow {\bf v}(t)
1730     + \frac{h}{2} \left( {\bf f}(t) / m \right), \\
1731     %
1732     {\bf r}(t + h) &\leftarrow {\bf r}(t)
1733     + h {\bf v}\left(t + h / 2 \right), \\
1734     %
1735     {\bf j}\left(t + h / 2 \right) &\leftarrow {\bf j}(t)
1736     + \frac{h}{2} {\bf \tau}^b(t), \\
1737     %
1738     \mathsf{A}(t + h) &\leftarrow \mathrm{rotate}\left( h {\bf j}
1739     (t + h / 2) \cdot \overleftrightarrow{\mathsf{I}}^{-1} \right).
1740     \end{align*}
1741    
1742     In this context, the $\mathrm{rotate}$ function is the reversible product
1743     of the three body-fixed rotations,
1744     \begin{equation}
1745     \mathrm{rotate}({\bf a}) = \mathsf{G}_x(a_x / 2) \cdot
1746     \mathsf{G}_y(a_y / 2) \cdot \mathsf{G}_z(a_z) \cdot \mathsf{G}_y(a_y /
1747     2) \cdot \mathsf{G}_x(a_x /2),
1748     \end{equation}
1749     where each rotational propagator, $\mathsf{G}_\alpha(\theta)$, rotates
1750     both the rotation matrix ($\mathsf{A}$) and the body-fixed angular
1751     momentum (${\bf j}$) by an angle $\theta$ around body-fixed axis
1752     $\alpha$,
1753     \begin{equation}
1754     \mathsf{G}_\alpha( \theta ) = \left\{
1755     \begin{array}{lcl}
1756     \mathsf{A}(t) & \leftarrow & \mathsf{A}(0) \cdot \mathsf{R}_\alpha(\theta)^T, \\
1757     {\bf j}(t) & \leftarrow & \mathsf{R}_\alpha(\theta) \cdot {\bf j}(0).
1758     \end{array}
1759     \right.
1760     \end{equation}
1761     $\mathsf{R}_\alpha$ is a quadratic approximation to
1762     the single-axis rotation matrix. For example, in the small-angle
1763     limit, the rotation matrix around the body-fixed x-axis can be
1764     approximated as
1765     \begin{equation}
1766     \mathsf{R}_x(\theta) \approx \left(
1767     \begin{array}{ccc}
1768     1 & 0 & 0 \\
1769     0 & \frac{1-\theta^2 / 4}{1 + \theta^2 / 4} & -\frac{\theta}{1+
1770     \theta^2 / 4} \\
1771     0 & \frac{\theta}{1+
1772     \theta^2 / 4} & \frac{1-\theta^2 / 4}{1 + \theta^2 / 4}
1773     \end{array}
1774     \right).
1775     \end{equation}
1776     All other rotations follow in a straightforward manner.
1777    
1778     After the first part of the propagation, the forces and body-fixed
1779     torques are calculated at the new positions and orientations
1780    
1781     {\tt doForces:}
1782     \begin{align*}
1783     {\bf f}(t + h) &\leftarrow
1784     - \left(\frac{\partial V}{\partial {\bf r}}\right)_{{\bf r}(t + h)}, \\
1785     %
1786     {\bf \tau}^{s}(t + h) &\leftarrow {\bf u}(t + h)
1787     \times \frac{\partial V}{\partial {\bf u}}, \\
1788     %
1789     {\bf \tau}^{b}(t + h) &\leftarrow \mathsf{A}(t + h)
1790     \cdot {\bf \tau}^s(t + h).
1791     \end{align*}
1792    
1793     {\sc oopse} automatically updates ${\bf u}$ when the rotation matrix
1794     $\mathsf{A}$ is calculated in {\tt moveA}. Once the forces and
1795     torques have been obtained at the new time step, the velocities can be
1796     advanced to the same time value.
1797    
1798     {\tt moveB:}
1799     \begin{align*}
1800     {\bf v}\left(t + h \right) &\leftarrow {\bf v}\left(t + h / 2 \right)
1801     + \frac{h}{2} \left( {\bf f}(t + h) / m \right), \\
1802     %
1803     {\bf j}\left(t + h \right) &\leftarrow {\bf j}\left(t + h / 2 \right)
1804     + \frac{h}{2} {\bf \tau}^b(t + h) .
1805     \end{align*}
1806    
1807     The matrix rotations used in the {\sc dlm} method end up being more
1808     costly computationally than the simpler arithmetic quaternion
1809     propagation. With the same time step, a 1024-molecule water simulation
1810     incurs an average 12\% increase in computation time using the {\sc
1811     dlm} method in place of quaternions. This cost is more than justified
1812     when comparing the energy conservation achieved by the two
1813     methods. Figure ~\ref{quatdlm} provides a comparative analysis of the
1814     {\sc dlm} method versus the traditional quaternion scheme.
1815    
1816     \begin{figure}
1817     \centering
1818     \includegraphics[width=\linewidth]{quatvsdlm.pdf}
1819     \caption[Energy conservation analysis of the {\sc dlm} and quaternion
1820     integration methods]{Analysis of the energy conservation of the {\sc
1821     dlm} and quaternion integration methods. $\delta \mathrm{E}_1$ is the
1822     linear drift in energy over time and $\delta \mathrm{E}_0$ is the
1823     standard deviation of energy fluctuations around this drift. All
1824     simulations were of a 1024-molecule simulation of SSD water at 298 K
1825     starting from the same initial configuration. Note that the {\sc dlm}
1826     method provides more than an order of magnitude improvement in both
1827     the energy drift and the size of the energy fluctuations when compared
1828     with the quaternion method at any given time step. At time steps
1829     larger than 4 fs, the quaternion scheme resulted in rapidly rising
1830     energies which eventually lead to simulation failure. Using the {\sc
1831     dlm} method, time steps up to 8 fs can be taken before this behavior
1832     is evident.}
1833     \label{quatdlm}
1834     \end{figure}
1835    
1836     In Fig.~\ref{quatdlm}, $\delta \mbox{E}_1$ is a measure of the linear
1837     energy drift in units of $\mbox{kcal mol}^{-1}$ per particle over a
1838     nanosecond of simulation time, and $\delta \mbox{E}_0$ is the standard
1839     deviation of the energy fluctuations in units of $\mbox{kcal
1840     mol}^{-1}$ per particle. In the top plot, it is apparent that the
1841     energy drift is reduced by a significant amount (2 to 3 orders of
1842     magnitude improvement at all tested time steps) by chosing the {\sc
1843     dlm} method over the simple non-symplectic quaternion integration
1844     method. In addition to this improvement in energy drift, the
1845     fluctuations in the total energy are also dampened by 1 to 2 orders of
1846     magnitude by utilizing the {\sc dlm} method.
1847    
1848     Although the {\sc dlm} method is more computationally expensive than
1849     the traditional quaternion scheme for propagating a single time step,
1850     consideration of the computational cost for a long simulation with a
1851     particular level of energy conservation is in order. A plot of energy
1852     drift versus computational cost was generated
1853     (Fig.~\ref{cpuCost}). This figure provides an estimate of the CPU time
1854     required under the two integration schemes for 1 nanosecond of
1855     simulation time for the model 1024-molecule system. By chosing a
1856     desired energy drift value it is possible to determine the CPU time
1857     required for both methods. If a $\delta \mbox{E}_1$ of $1 \times
1858     10^{-3} \mbox{kcal mol}^{-1}$ per particle is desired, a nanosecond of
1859     simulation time will require ~19 hours of CPU time with the {\sc dlm}
1860     integrator, while the quaternion scheme will require ~154 hours of CPU
1861     time. This demonstrates the computational advantage of the integration
1862     scheme utilized in {\sc oopse}.
1863    
1864     \begin{figure}
1865     \centering
1866     \includegraphics[width=\linewidth]{compCost.pdf}
1867     \caption[Energy drift as a function of required simulation run
1868     time]{Energy drift as a function of required simulation run time.
1869     $\delta \mathrm{E}_1$ is the linear drift in energy over time.
1870     Simulations were performed on a single 2.5 GHz Pentium 4
1871     processor. Simulation time comparisons can be made by tracing
1872     horizontally from one curve to the other. For example, a simulation
1873     that takes ~24 hours using the {\sc dlm} method will take roughly 210
1874     hours using the simple quaternion method if the same degree of energy
1875     conservation is desired.}
1876     \label{cpuCost}
1877     \end{figure}
1878    
1879     There is only one specific keyword relevant to the default integrator,
1880     and that is the time step for integrating the equations of motion.
1881    
1882     \begin{center}
1883     \begin{tabular}{llll}
1884     {\bf variable} & {\bf Meta-data keyword} & {\bf units} & {\bf
1885     default value} \\
1886     $h$ & {\tt dt = 2.0;} & fs & none
1887     \end{tabular}
1888     \end{center}
1889    
1890     \section{\label{sec:extended}Extended Systems for other Ensembles}
1891    
1892     {\sc oopse} implements a number of extended system integrators for
1893     sampling from other ensembles relevant to chemical physics. The
1894     integrator can be selected with the {\tt ensemble} keyword in the
1895     meta-data file:
1896    
1897     \begin{center}
1898     \begin{tabular}{lll}
1899     {\bf Integrator} & {\bf Ensemble} & {\bf Meta-data instruction} \\
1900     NVE & microcanonical & {\tt ensemble = NVE; } \\
1901     NVT & canonical & {\tt ensemble = NVT; } \\
1902     NPTi & isobaric-isothermal & {\tt ensemble = NPTi;} \\
1903     & (with isotropic volume changes) & \\
1904     NPTf & isobaric-isothermal & {\tt ensemble = NPTf;} \\
1905     & (with changes to box shape) & \\
1906     NPTxyz & approximate isobaric-isothermal & {\tt ensemble = NPTxyz;} \\
1907     & (with separate barostats on each box dimension) & \\
1908 gezelter 3403 LD & Langevin Dynamics & {\tt ensemble = LD;} \\
1909     & (approximates the effects of an implicit solvent) & \\
1910 gezelter 3395 \end{tabular}
1911     \end{center}
1912    
1913     The relatively well-known Nos\'e-Hoover thermostat\cite{Hoover85} is
1914     implemented in {\sc oopse}'s NVT integrator. This method couples an
1915     extra degree of freedom (the thermostat) to the kinetic energy of the
1916     system and it has been shown to sample the canonical distribution in
1917     the system degrees of freedom while conserving a quantity that is, to
1918     within a constant, the Helmholtz free energy.\cite{melchionna93}
1919    
1920     NPT algorithms attempt to maintain constant pressure in the system by
1921     coupling the volume of the system to a barostat. {\sc oopse} contains
1922     three different constant pressure algorithms. The first two, NPTi and
1923     NPTf have been shown to conserve a quantity that is, to within a
1924     constant, the Gibbs free energy.\cite{melchionna93} The Melchionna
1925     modification to the Hoover barostat is implemented in both NPTi and
1926     NPTf. NPTi allows only isotropic changes in the simulation box, while
1927     box {\it shape} variations are allowed in NPTf. The NPTxyz integrator
1928     has {\it not} been shown to sample from the isobaric-isothermal
1929     ensemble. It is useful, however, in that it maintains orthogonality
1930     for the axes of the simulation box while attempting to equalize
1931     pressure along the three perpendicular directions in the box.
1932    
1933     Each of the extended system integrators requires additional keywords
1934     to set target values for the thermodynamic state variables that are
1935     being held constant. Keywords are also required to set the
1936     characteristic decay times for the dynamics of the extended
1937     variables.
1938    
1939     \begin{center}
1940     \begin{tabular}{llll}
1941     {\bf variable} & {\bf Meta-data instruction} & {\bf units} & {\bf
1942     default value} \\
1943     $T_{\mathrm{target}}$ & {\tt targetTemperature = 300;} & K & none \\
1944     $P_{\mathrm{target}}$ & {\tt targetPressure = 1;} & atm & none \\
1945     $\tau_T$ & {\tt tauThermostat = 1e3;} & fs & none \\
1946     $\tau_B$ & {\tt tauBarostat = 5e3;} & fs & none \\
1947     & {\tt resetTime = 200;} & fs & none \\
1948     & {\tt useInitialExtendedSystemState = true;} & logical &
1949     true
1950     \end{tabular}
1951     \end{center}
1952    
1953     Two additional keywords can be used to either clear the extended
1954     system variables periodically ({\tt resetTime}), or to maintain the
1955     state of the extended system variables between simulations ({\tt
1956     useInitialExtendedSystemState}). More details on these variables
1957     and their use in the integrators follows below.
1958    
1959     \section{\label{oopseSec:noseHooverThermo}Nos\'{e}-Hoover Thermostatting}
1960    
1961     The Nos\'e-Hoover equations of motion are given by\cite{Hoover85}
1962     \begin{eqnarray}
1963     \dot{{\bf r}} & = & {\bf v}, \\
1964     \dot{{\bf v}} & = & \frac{{\bf f}}{m} - \chi {\bf v} ,\\
1965     \dot{\mathsf{A}} & = & \mathsf{A} \cdot
1966     \mbox{ skew}\left(\overleftrightarrow{\mathsf{I}}^{-1} \cdot {\bf j}\right), \\
1967     \dot{{\bf j}} & = & {\bf j} \times \left( \overleftrightarrow{\mathsf{I}}^{-1}
1968     \cdot {\bf j} \right) - \mbox{ rot}\left(\mathsf{A}^{T} \cdot \frac{\partial
1969     V}{\partial \mathsf{A}} \right) - \chi {\bf j}.
1970     \label{eq:nosehoovereom}
1971     \end{eqnarray}
1972    
1973     $\chi$ is an ``extra'' variable included in the extended system, and
1974     it is propagated using the first order equation of motion
1975     \begin{equation}
1976     \dot{\chi} = \frac{1}{\tau_{T}^2} \left( \frac{T}{T_{\mathrm{target}}} - 1 \right).
1977     \label{eq:nosehooverext}
1978     \end{equation}
1979    
1980     The instantaneous temperature $T$ is proportional to the total kinetic
1981     energy (both translational and orientational) and is given by
1982     \begin{equation}
1983     T = \frac{2 K}{f k_B}
1984     \end{equation}
1985     Here, $f$ is the total number of degrees of freedom in the system,
1986     \begin{equation}
1987     f = 3 N + 2 N_{\mathrm{linear}} + 3 N_{\mathrm{non-linear}} - N_{\mathrm{constraints}},
1988     \end{equation}
1989     and $K$ is the total kinetic energy,
1990     \begin{equation}
1991     K = \sum_{i=1}^{N} \frac{1}{2} m_i {\bf v}_i^T \cdot {\bf v}_i +
1992     \sum_{i=1}^{N_{\mathrm{linear}}+N_{\mathrm{non-linear}}} \frac{1}{2} {\bf j}_i^T \cdot
1993     \overleftrightarrow{\mathsf{I}}_i^{-1} \cdot {\bf j}_i.
1994     \end{equation}
1995     $N_{\mathrm{linear}}$ is the number of linear rotors (i.e. with two
1996     non-zero moments of inertia), and $N_{\mathrm{non-linear}}$ is the
1997     number of non-linear rotors (i.e. with three non-zero moments of
1998     inertia).
1999    
2000     In eq.(\ref{eq:nosehooverext}), $\tau_T$ is the time constant for
2001     relaxation of the temperature to the target value. To set values for
2002     $\tau_T$ or $T_{\mathrm{target}}$ in a simulation, one would use the
2003     {\tt tauThermostat} and {\tt targetTemperature} keywords in the
2004     meta-data file. The units for {\tt tauThermostat} are fs, and the
2005     units for the {\tt targetTemperature} are degrees K. The integration
2006     of the equations of motion is carried out in a velocity-Verlet style 2
2007     part algorithm:
2008    
2009     {\tt moveA:}
2010     \begin{align*}
2011     T(t) &\leftarrow \left\{{\bf v}(t)\right\}, \left\{{\bf j}(t)\right\} ,\\
2012     %
2013     {\bf v}\left(t + h / 2\right) &\leftarrow {\bf v}(t)
2014     + \frac{h}{2} \left( \frac{{\bf f}(t)}{m} - {\bf v}(t)
2015     \chi(t)\right), \\
2016     %
2017     {\bf r}(t + h) &\leftarrow {\bf r}(t)
2018     + h {\bf v}\left(t + h / 2 \right) ,\\
2019     %
2020     {\bf j}\left(t + h / 2 \right) &\leftarrow {\bf j}(t)
2021     + \frac{h}{2} \left( {\bf \tau}^b(t) - {\bf j}(t)
2022     \chi(t) \right) ,\\
2023     %
2024     \mathsf{A}(t + h) &\leftarrow \mathrm{rotate}
2025     \left(h * {\bf j}(t + h / 2)
2026     \overleftrightarrow{\mathsf{I}}^{-1} \right) ,\\
2027     %
2028     \chi\left(t + h / 2 \right) &\leftarrow \chi(t)
2029     + \frac{h}{2 \tau_T^2} \left( \frac{T(t)}
2030     {T_{\mathrm{target}}} - 1 \right) .
2031     \end{align*}
2032    
2033     Here $\mathrm{rotate}(h * {\bf j}
2034     \overleftrightarrow{\mathsf{I}}^{-1})$ is the same symplectic Trotter
2035     factorization of the three rotation operations that was discussed in
2036     the section on the {\sc dlm} integrator. Note that this operation modifies
2037     both the rotation matrix $\mathsf{A}$ and the angular momentum ${\bf
2038     j}$. {\tt moveA} propagates velocities by a half time step, and
2039     positional degrees of freedom by a full time step. The new positions
2040     (and orientations) are then used to calculate a new set of forces and
2041     torques in exactly the same way they are calculated in the {\tt
2042     doForces} portion of the {\sc dlm} integrator.
2043    
2044     Once the forces and torques have been obtained at the new time step,
2045     the temperature, velocities, and the extended system variable can be
2046     advanced to the same time value.
2047    
2048     {\tt moveB:}
2049     \begin{align*}
2050     T(t + h) &\leftarrow \left\{{\bf v}(t + h)\right\},
2051     \left\{{\bf j}(t + h)\right\}, \\
2052     %
2053     \chi\left(t + h \right) &\leftarrow \chi\left(t + h /
2054     2 \right) + \frac{h}{2 \tau_T^2} \left( \frac{T(t+h)}
2055     {T_{\mathrm{target}}} - 1 \right), \\
2056     %
2057     {\bf v}\left(t + h \right) &\leftarrow {\bf v}\left(t
2058     + h / 2 \right) + \frac{h}{2} \left(
2059     \frac{{\bf f}(t + h)}{m} - {\bf v}(t + h)
2060     \chi(t h)\right) ,\\
2061     %
2062     {\bf j}\left(t + h \right) &\leftarrow {\bf j}\left(t
2063     + h / 2 \right) + \frac{h}{2}
2064     \left( {\bf \tau}^b(t + h) - {\bf j}(t + h)
2065     \chi(t + h) \right) .
2066     \end{align*}
2067    
2068     Since ${\bf v}(t + h)$ and ${\bf j}(t + h)$ are required to calculate
2069     $T(t + h)$ as well as $\chi(t + h)$, they indirectly depend on their
2070     own values at time $t + h$. {\tt moveB} is therefore done in an
2071     iterative fashion until $\chi(t + h)$ becomes self-consistent. The
2072     relative tolerance for the self-consistency check defaults to a value
2073     of $\mbox{10}^{-6}$, but {\sc oopse} will terminate the iteration
2074     after 4 loops even if the consistency check has not been satisfied.
2075    
2076     The Nos\'e-Hoover algorithm is known to conserve a Hamiltonian for the
2077     extended system that is, to within a constant, identical to the
2078     Helmholtz free energy,\cite{melchionna93}
2079     \begin{equation}
2080     H_{\mathrm{NVT}} = V + K + f k_B T_{\mathrm{target}} \left(
2081     \frac{\tau_{T}^2 \chi^2(t)}{2} + \int_{0}^{t} \chi(t^\prime) dt^\prime
2082     \right).
2083     \end{equation}
2084     Poor choices of $h$ or $\tau_T$ can result in non-conservation
2085     of $H_{\mathrm{NVT}}$, so the conserved quantity is maintained in the
2086     last column of the {\tt .stat} file to allow checks on the quality of
2087     the integration.
2088    
2089     Bond constraints are applied at the end of both the {\tt moveA} and
2090     {\tt moveB} portions of the algorithm. Details on the constraint
2091     algorithms are given in section \ref{oopseSec:rattle}.
2092    
2093     \section{\label{sec:NPTi}Constant-pressure integration with
2094     isotropic box deformations (NPTi)}
2095    
2096     To carry out isobaric-isothermal ensemble calculations, {\sc oopse}
2097     implements the Melchionna modifications to the Nos\'e-Hoover-Andersen
2098     equations of motion.\cite{melchionna93} The equations of motion are
2099     the same as NVT with the following exceptions:
2100    
2101     \begin{eqnarray}
2102     \dot{{\bf r}} & = & {\bf v} + \eta \left( {\bf r} - {\bf R}_0 \right), \\
2103     \dot{{\bf v}} & = & \frac{{\bf f}}{m} - (\eta + \chi) {\bf v}, \\
2104     \dot{\eta} & = & \frac{1}{\tau_{B}^2 f k_B T_{\mathrm{target}}} V \left( P -
2105     P_{\mathrm{target}} \right), \\
2106     \dot{\mathcal{V}} & = & 3 \mathcal{V} \eta .
2107     \label{eq:melchionna1}
2108     \end{eqnarray}
2109    
2110     $\chi$ and $\eta$ are the ``extra'' degrees of freedom in the extended
2111     system. $\chi$ is a thermostat, and it has the same function as it
2112     does in the Nos\'e-Hoover NVT integrator. $\eta$ is a barostat which
2113     controls changes to the volume of the simulation box. ${\bf R}_0$ is
2114     the location of the center of mass for the entire system, and
2115     $\mathcal{V}$ is the volume of the simulation box. At any time, the
2116     volume can be calculated from the determinant of the matrix which
2117     describes the box shape:
2118     \begin{equation}
2119     \mathcal{V} = \det(\mathsf{H}).
2120     \end{equation}
2121    
2122     The NPTi integrator requires an instantaneous pressure. This quantity
2123     is calculated via the pressure tensor,
2124     \begin{equation}
2125     \overleftrightarrow{\mathsf{P}}(t) = \frac{1}{\mathcal{V}(t)} \left(
2126     \sum_{i=1}^{N} m_i {\bf v}_i(t) \otimes {\bf v}_i(t) \right) +
2127     \overleftrightarrow{\mathsf{W}}(t).
2128     \end{equation}
2129     The kinetic contribution to the pressure tensor utilizes the {\it
2130     outer} product of the velocities, denoted by the $\otimes$ symbol. The
2131     stress tensor is calculated from another outer product of the
2132     inter-atomic separation vectors (${\bf r}_{ij} = {\bf r}_j - {\bf
2133     r}_i$) with the forces between the same two atoms,
2134     \begin{equation}
2135     \overleftrightarrow{\mathsf{W}}(t) = \sum_{i} \sum_{j>i} {\bf r}_{ij}(t)
2136     \otimes {\bf f}_{ij}(t).
2137     \end{equation}
2138     In systems containing cutoff groups, the stress tensor is computed
2139     between the centers-of-mass of the cutoff groups:
2140     \begin{equation}
2141     \overleftrightarrow{\mathsf{W}}(t) = \sum_{a} \sum_{b} {\bf r}_{ab}(t)
2142     \otimes {\bf f}_{ab}(t).
2143     \end{equation}
2144     where ${\bf r}_{ab}$ is the distance between the centers of mass, and
2145     \begin{equation}
2146     {\bf f}_{ab} = s(r_{ab}) \sum_{i \in a} \sum_{j \in b} {\bf f}_{ij} +
2147     s^{\prime}(r_{ab}) \frac{{\bf r}_{ab}}{|r_{ab}|} \sum_{i \in a} \sum_{j
2148     \in b} V_{ij}({\bf r}_{ij}).
2149     \end{equation}
2150    
2151     The instantaneous pressure is then simply obtained from the trace of
2152     the pressure tensor,
2153     \begin{equation}
2154     P(t) = \frac{1}{3} \mathrm{Tr} \left( \overleftrightarrow{\mathsf{P}}(t)
2155     \right).
2156     \end{equation}
2157    
2158     In eq.(\ref{eq:melchionna1}), $\tau_B$ is the time constant for
2159     relaxation of the pressure to the target value. To set values for
2160     $\tau_B$ or $P_{\mathrm{target}}$ in a simulation, one would use the
2161     {\tt tauBarostat} and {\tt targetPressure} keywords in the meta-data
2162     file. The units for {\tt tauBarostat} are fs, and the units for the
2163     {\tt targetPressure} are atmospheres. Like in the NVT integrator, the
2164     integration of the equations of motion is carried out in a
2165     velocity-Verlet style two part algorithm with only the following
2166     differences:
2167    
2168     {\tt moveA:}
2169     \begin{align*}
2170     P(t) &\leftarrow \left\{{\bf r}(t)\right\}, \left\{{\bf v}(t)\right\} ,\\
2171     %
2172     {\bf v}\left(t + h / 2\right) &\leftarrow {\bf v}(t)
2173     + \frac{h}{2} \left( \frac{{\bf f}(t)}{m} - {\bf v}(t)
2174     \left(\chi(t) + \eta(t) \right) \right), \\
2175     %
2176     \eta(t + h / 2) &\leftarrow \eta(t) + \frac{h
2177     \mathcal{V}(t)}{2 N k_B T(t) \tau_B^2} \left( P(t)
2178     - P_{\mathrm{target}} \right), \\
2179     %
2180     {\bf r}(t + h) &\leftarrow {\bf r}(t) + h
2181     \left\{ {\bf v}\left(t + h / 2 \right)
2182     + \eta(t + h / 2)\left[ {\bf r}(t + h)
2183     - {\bf R}_0 \right] \right\} ,\\
2184     %
2185     \mathsf{H}(t + h) &\leftarrow e^{-h \eta(t + h / 2)}
2186     \mathsf{H}(t).
2187     \end{align*}
2188    
2189     The propagation of positions to time $t + h$
2190     depends on the positions at the same time. {\sc oopse} carries out
2191     this step iteratively (with a limit of 5 passes through the iterative
2192     loop). Also, the simulation box $\mathsf{H}$ is scaled uniformly for
2193     one full time step by an exponential factor that depends on the value
2194     of $\eta$ at time $t +
2195     h / 2$. Reshaping the box uniformly also scales the volume of
2196     the box by
2197     \begin{equation}
2198     \mathcal{V}(t + h) \leftarrow e^{ - 3 h \eta(t + h /2)} \times
2199     \mathcal{V}(t).
2200     \end{equation}
2201    
2202     The {\tt doForces} step for the NPTi integrator is exactly the same as
2203     in both the {\sc dlm} and NVT integrators. Once the forces and torques have
2204     been obtained at the new time step, the velocities can be advanced to
2205     the same time value.
2206    
2207     {\tt moveB:}
2208     \begin{align*}
2209     P(t + h) &\leftarrow \left\{{\bf r}(t + h)\right\},
2210     \left\{{\bf v}(t + h)\right\}, \\
2211     %
2212     \eta(t + h) &\leftarrow \eta(t + h / 2) +
2213     \frac{h \mathcal{V}(t + h)}{2 N k_B T(t + h)
2214     \tau_B^2} \left( P(t + h) - P_{\mathrm{target}} \right), \\
2215     %
2216     {\bf v}\left(t + h \right) &\leftarrow {\bf v}\left(t
2217     + h / 2 \right) + \frac{h}{2} \left(
2218     \frac{{\bf f}(t + h)}{m} - {\bf v}(t + h)
2219     (\chi(t + h) + \eta(t + h)) \right) ,\\
2220     %
2221     {\bf j}\left(t + h \right) &\leftarrow {\bf j}\left(t
2222     + h / 2 \right) + \frac{h}{2} \left( {\bf
2223     \tau}^b(t + h) - {\bf j}(t + h)
2224     \chi(t + h) \right) .
2225     \end{align*}
2226    
2227     Once again, since ${\bf v}(t + h)$ and ${\bf j}(t + h)$ are required
2228     to calculate $T(t + h)$, $P(t + h)$, $\chi(t + h)$, and $\eta(t +
2229     h)$, they indirectly depend on their own values at time $t + h$. {\tt
2230     moveB} is therefore done in an iterative fashion until $\chi(t + h)$
2231     and $\eta(t + h)$ become self-consistent. The relative tolerance for
2232     the self-consistency check defaults to a value of $\mbox{10}^{-6}$,
2233     but {\sc oopse} will terminate the iteration after 4 loops even if the
2234     consistency check has not been satisfied.
2235    
2236     The Melchionna modification of the Nos\'e-Hoover-Andersen algorithm is
2237     known to conserve a Hamiltonian for the extended system that is, to
2238     within a constant, identical to the Gibbs free energy,
2239     \begin{equation}
2240     H_{\mathrm{NPTi}} = V + K + f k_B T_{\mathrm{target}} \left(
2241     \frac{\tau_{T}^2 \chi^2(t)}{2} + \int_{0}^{t} \chi(t^\prime) dt^\prime
2242     \right) + P_{\mathrm{target}} \mathcal{V}(t).
2243     \end{equation}
2244     Poor choices of $\delta t$, $\tau_T$, or $\tau_B$ can result in
2245     non-conservation of $H_{\mathrm{NPTi}}$, so the conserved quantity is
2246     maintained in the last column of the {\tt .stat} file to allow checks
2247     on the quality of the integration. It is also known that this
2248     algorithm samples the equilibrium distribution for the enthalpy
2249     (including contributions for the thermostat and barostat),
2250     \begin{equation}
2251     H_{\mathrm{NPTi}} = V + K + \frac{f k_B T_{\mathrm{target}}}{2} \left(
2252     \chi^2 \tau_T^2 + \eta^2 \tau_B^2 \right) + P_{\mathrm{target}}
2253     \mathcal{V}(t).
2254     \end{equation}
2255    
2256     Bond constraints are applied at the end of both the {\tt moveA} and
2257     {\tt moveB} portions of the algorithm. Details on the constraint
2258     algorithms are given in section \ref{oopseSec:rattle}.
2259    
2260     \section{\label{sec:NPTf}Constant-pressure integration with a
2261     flexible box (NPTf)}
2262    
2263     There is a relatively simple generalization of the
2264     Nos\'e-Hoover-Andersen method to include changes in the simulation box
2265     {\it shape} as well as in the volume of the box. This method utilizes
2266     the full $3 \times 3$ pressure tensor and introduces a tensor of
2267     extended variables ($\overleftrightarrow{\eta}$) to control changes to
2268     the box shape. The equations of motion for this method differ from
2269     those of NPTi as follows:
2270     \begin{eqnarray}
2271     \dot{{\bf r}} & = & {\bf v} + \overleftrightarrow{\eta} \cdot \left( {\bf r} - {\bf R}_0 \right), \\
2272     \dot{{\bf v}} & = & \frac{{\bf f}}{m} - (\overleftrightarrow{\eta} +
2273     \chi \cdot \mathsf{1}) {\bf v}, \\
2274     \dot{\overleftrightarrow{\eta}} & = & \frac{1}{\tau_{B}^2 f k_B
2275     T_{\mathrm{target}}} V \left( \overleftrightarrow{\mathsf{P}} - P_{\mathrm{target}}\mathsf{1} \right) ,\\
2276     \dot{\mathsf{H}} & = & \overleftrightarrow{\eta} \cdot \mathsf{H} .
2277     \label{eq:melchionna2}
2278     \end{eqnarray}
2279    
2280     Here, $\mathsf{1}$ is the unit matrix and $\overleftrightarrow{\mathsf{P}}$
2281     is the pressure tensor. Again, the volume, $\mathcal{V} = \det
2282     \mathsf{H}$.
2283    
2284     The propagation of the equations of motion is nearly identical to the
2285     NPTi integration:
2286    
2287     {\tt moveA:}
2288     \begin{align*}
2289     \overleftrightarrow{\mathsf{P}}(t) &\leftarrow \left\{{\bf r}(t)\right\},
2290     \left\{{\bf v}(t)\right\} ,\\
2291     %
2292     {\bf v}\left(t + h / 2\right) &\leftarrow {\bf v}(t)
2293     + \frac{h}{2} \left( \frac{{\bf f}(t)}{m} -
2294     \left(\chi(t)\mathsf{1} + \overleftrightarrow{\eta}(t) \right) \cdot
2295     {\bf v}(t) \right), \\
2296     %
2297     \overleftrightarrow{\eta}(t + h / 2) &\leftarrow
2298     \overleftrightarrow{\eta}(t) + \frac{h \mathcal{V}(t)}{2 N k_B
2299     T(t) \tau_B^2} \left( \overleftrightarrow{\mathsf{P}}(t)
2300     - P_{\mathrm{target}}\mathsf{1} \right), \\
2301     %
2302     {\bf r}(t + h) &\leftarrow {\bf r}(t) + h \left\{ {\bf v}
2303     \left(t + h / 2 \right) + \overleftrightarrow{\eta}(t +
2304     h / 2) \cdot \left[ {\bf r}(t + h)
2305     - {\bf R}_0 \right] \right\}, \\
2306     %
2307     \mathsf{H}(t + h) &\leftarrow \mathsf{H}(t) \cdot e^{-h
2308     \overleftrightarrow{\eta}(t + h / 2)} .
2309     \end{align*}
2310     {\sc oopse} uses a power series expansion truncated at second order
2311     for the exponential operation which scales the simulation box.
2312    
2313     The {\tt moveB} portion of the algorithm is largely unchanged from the
2314     NPTi integrator:
2315    
2316     {\tt moveB:}
2317     \begin{align*}
2318     \overleftrightarrow{\mathsf{P}}(t + h) &\leftarrow \left\{{\bf r}
2319     (t + h)\right\}, \left\{{\bf v}(t
2320     + h)\right\}, \left\{{\bf f}(t + h)\right\} ,\\
2321     %
2322     \overleftrightarrow{\eta}(t + h) &\leftarrow
2323     \overleftrightarrow{\eta}(t + h / 2) +
2324     \frac{h \mathcal{V}(t + h)}{2 N k_B T(t + h)
2325     \tau_B^2} \left( \overleftrightarrow{P}(t + h)
2326     - P_{\mathrm{target}}\mathsf{1} \right) ,\\
2327     %
2328     {\bf v}\left(t + h \right) &\leftarrow {\bf v}\left(t
2329     + h / 2 \right) + \frac{h}{2} \left(
2330     \frac{{\bf f}(t + h)}{m} -
2331     (\chi(t + h)\mathsf{1} + \overleftrightarrow{\eta}(t
2332     + h)) \right) \cdot {\bf v}(t + h), \\
2333     \end{align*}
2334    
2335     The iterative schemes for both {\tt moveA} and {\tt moveB} are
2336     identical to those described for the NPTi integrator.
2337    
2338     The NPTf integrator is known to conserve the following Hamiltonian:
2339     \begin{equation}
2340     H_{\mathrm{NPTf}} = V + K + f k_B T_{\mathrm{target}} \left(
2341     \frac{\tau_{T}^2 \chi^2(t)}{2} + \int_{0}^{t} \chi(t^\prime) dt^\prime
2342     \right) + P_{\mathrm{target}} \mathcal{V}(t) + \frac{f k_B
2343     T_{\mathrm{target}}}{2}
2344     \mathrm{Tr}\left[\overleftrightarrow{\eta}(t)\right]^2 \tau_B^2.
2345     \end{equation}
2346    
2347     This integrator must be used with care, particularly in liquid
2348     simulations. Liquids have very small restoring forces in the
2349     off-diagonal directions, and the simulation box can very quickly form
2350     elongated and sheared geometries which become smaller than the cutoff
2351     radius. The NPTf integrator finds most use in simulating crystals or
2352     liquid crystals which assume non-orthorhombic geometries.
2353    
2354     \section{\label{nptxyz}Constant pressure in 3 axes (NPTxyz)}
2355    
2356     There is one additional extended system integrator which is somewhat
2357     simpler than the NPTf method described above. In this case, the three
2358     axes have independent barostats which each attempt to preserve the
2359     target pressure along the box walls perpendicular to that particular
2360     axis. The lengths of the box axes are allowed to fluctuate
2361     independently, but the angle between the box axes does not change.
2362     The equations of motion are identical to those described above, but
2363     only the {\it diagonal} elements of $\overleftrightarrow{\eta}$ are
2364     computed. The off-diagonal elements are set to zero (even when the
2365     pressure tensor has non-zero off-diagonal elements).
2366    
2367     It should be noted that the NPTxyz integrator is {\it not} known to
2368     preserve any Hamiltonian of interest to the chemical physics
2369     community. The integrator is extremely useful, however, in generating
2370     initial conditions for other integration methods. It {\it is} suitable
2371     for use with liquid simulations, or in cases where there is
2372     orientational anisotropy in the system (i.e. in lipid bilayer
2373     simulations).
2374    
2375 gezelter 3403 \section{Langevin Dynamics (LD)\label{LDRB}}
2376 gezelter 3395
2377 gezelter 3403 {\sc oopse} implements a Langevin integrator in order to perform
2378     molecular dynamics simulations in implicit solvent environments. This
2379     can result in substantial performance gains when the detailed dynamics
2380     of the solvent is not important. Since {\sc oopse} also handles rigid
2381     bodies of arbitrary composition and shape, the Langevin integrator is
2382     by necessity somewhat more complex than in other simulation packages.
2383 gezelter 3395
2384 xsun 3402 Consider the Langevin equations of motion in generalized coordinates
2385 gezelter 3395 \begin{equation}
2386 xsun 3399 {\bf M} \dot{{\bf V}}(t) = {\bf F}_{s}(t) +
2387     {\bf F}_{f}(t) + {\bf F}_{r}(t)
2388     \label{LDGeneralizedForm}
2389     \end{equation}
2390     where ${\bf M}$ is a $6 \times 6$ diagonal mass matrix (which
2391     includes the mass of the rigid body as well as the moments of inertia
2392     in the body-fixed frame) and ${\bf V}$ is a generalized velocity,
2393     ${\bf V} =
2394     \left\{{\bf v},{\bf \omega}\right\}$. The right side of
2395     Eq.~\ref{LDGeneralizedForm} consists of three generalized forces: a
2396     system force (${\bf F}_{s}$), a frictional or dissipative force (${\bf
2397     F}_{f}$) and a stochastic force (${\bf F}_{r}$). While the evolution
2398     of the system in Newtonian mechanics is typically done in the lab
2399     frame, it is convenient to handle the dynamics of rigid bodies in
2400     body-fixed frames. Thus the friction and random forces on each
2401     substructure are calculated in a body-fixed frame and may converted
2402     back to the lab frame using that substructure's rotation matrix (${\bf
2403     Q}$):
2404     \begin{equation}
2405     {\bf F}_{f,r} =
2406     \left( \begin{array}{c}
2407     {\bf f}_{f,r} \\
2408     {\bf \tau}_{f,r}
2409     \end{array} \right)
2410     =
2411     \left( \begin{array}{c}
2412     {\bf Q}^{T} {\bf f}^{~b}_{f,r} \\
2413     {\bf Q}^{T} {\bf \tau}^{~b}_{f,r}
2414     \end{array} \right)
2415     \end{equation}
2416     The body-fixed friction force, ${\bf F}_{f}^{~b}$, is proportional to
2417     the (body-fixed) velocity at the center of resistance
2418     ${\bf v}_{R}^{~b}$ and the angular velocity ${\bf \omega}$
2419     \begin{equation}
2420     {\bf F}_{f}^{~b}(t) = \left( \begin{array}{l}
2421     {\bf f}_{f}^{~b}(t) \\
2422     {\bf \tau}_{f}^{~b}(t) \\
2423     \end{array} \right) = - \left( \begin{array}{*{20}c}
2424     \Xi_{R}^{tt} & \Xi_{R}^{rt} \\
2425     \Xi_{R}^{tr} & \Xi_{R}^{rr} \\
2426     \end{array} \right)\left( \begin{array}{l}
2427     {\bf v}_{R}^{~b}(t) \\
2428     {\bf \omega}(t) \\
2429     \end{array} \right),
2430     \end{equation}
2431     while the random force, ${\bf F}_{r}$, is a Gaussian stochastic
2432     variable with zero mean and variance,
2433     \begin{equation}
2434     \left\langle {{\bf F}_{r}(t) ({\bf F}_{r}(t'))^T } \right\rangle =
2435     \left\langle {{\bf F}_{r}^{~b} (t) ({\bf F}_{r}^{~b} (t'))^T } \right\rangle =
2436     2 k_B T \Xi_R \delta(t - t'). \label{eq:randomForce}
2437     \end{equation}
2438     $\Xi_R$ is the $6\times6$ resistance tensor at the center of
2439 gezelter 3403 resistance.
2440    
2441     For atoms and ellipsoids, there are good approximations for this
2442     tensor that are based on Stokes' law. For arbitrary rigid bodies, the
2443     resistance tensor must be pre-computed before Langevin dynamics can be
2444     used. The {\sc oopse} distribution contains a utitilty program called
2445     Hydro that performs this computation.
2446    
2447     Once this tensor is known for a given {\tt integrableObject},
2448     obtaining a stochastic vector that has the properties in
2449     Eq. (\ref{eq:randomForce}) can be done efficiently by carrying out a
2450     one-time Cholesky decomposition to obtain the square root matrix of
2451     the resistance tensor,
2452 xsun 3399 \begin{equation}
2453     \Xi_R = {\bf S} {\bf S}^{T},
2454     \label{eq:Cholesky}
2455     \end{equation}
2456     where ${\bf S}$ is a lower triangular matrix.\cite{Schlick2002} A
2457     vector with the statistics required for the random force can then be
2458     obtained by multiplying ${\bf S}$ onto a random 6-vector ${\bf Z}$ which
2459     has elements chosen from a Gaussian distribution, such that:
2460     \begin{equation}
2461     \langle {\bf Z}_i \rangle = 0, \hspace{1in} \langle {\bf Z}_i \cdot
2462     {\bf Z}_j \rangle = \frac{2 k_B T}{\delta t} \delta_{ij},
2463     \end{equation}
2464     where $\delta t$ is the timestep in use during the simulation. The
2465     random force, ${\bf F}_{r}^{~b} = {\bf S} {\bf Z}$, can be shown to have the
2466     correct properties required by Eq. (\ref{eq:randomForce}).
2467    
2468     The equation of motion for the translational velocity of the center of
2469     mass (${\bf v}$) can be written as
2470     \begin{equation}
2471     m \dot{{\bf v}} (t) = {\bf f}_{s}(t) + {\bf f}_{f}(t) +
2472     {\bf f}_{r}(t)
2473     \end{equation}
2474     Since the frictional and random forces are applied at the center of
2475     resistance, which generally does not coincide with the center of mass,
2476     extra torques are exerted at the center of mass. Thus, the net
2477     body-fixed torque at the center of mass, $\tau^{~b}(t)$,
2478     is given by
2479     \begin{equation}
2480     \tau^{~b} \leftarrow \tau_{s}^{~b} + \tau_{f}^{~b} + \tau_{r}^{~b} + {\bf r}_{MR} \times \left( {\bf f}_{f}^{~b} + {\bf f}_{r}^{~b} \right)
2481     \end{equation}
2482     where ${\bf r}_{MR}$ is the vector from the center of mass to the center of
2483     resistance. Instead of integrating the angular velocity in lab-fixed
2484     frame, we consider the equation of motion for the angular momentum
2485     (${\bf j}$) in the body-fixed frame
2486     \begin{equation}
2487     \frac{\partial}{\partial t}{\bf j}(t) = \tau^{~b}(t)
2488     \end{equation}
2489 gezelter 3403 By embedding the friction and random forces into the the total force
2490     and torque, {\sc oopse} integrates the Langevin equations of motion
2491     for a rigid body of arbitrary shape in a velocity-Verlet style 2-part
2492     algorithm, where $h = \delta t$:
2493 xsun 3399
2494     {\tt move A:}
2495     \begin{align*}
2496     {\bf v}\left(t + h / 2\right) &\leftarrow {\bf v}(t)
2497     + \frac{h}{2} \left( {\bf f}(t) / m \right), \\
2498     %
2499     {\bf r}(t + h) &\leftarrow {\bf r}(t)
2500     + h {\bf v}\left(t + h / 2 \right), \\
2501     %
2502     {\bf j}\left(t + h / 2 \right) &\leftarrow {\bf j}(t)
2503     + \frac{h}{2} {\bf \tau}^{~b}(t), \\
2504     %
2505     {\bf Q}(t + h) &\leftarrow \mathrm{rotate}\left( h {\bf j}
2506     (t + h / 2) \cdot \overleftrightarrow{\mathsf{I}}^{-1} \right).
2507     \end{align*}
2508     In this context, $\overleftrightarrow{\mathsf{I}}$ is the diagonal
2509     moment of inertia tensor, and the $\mathrm{rotate}$ function is the
2510     reversible product of the three body-fixed rotations,
2511     \begin{equation}
2512     \mathrm{rotate}({\bf a}) = \mathsf{G}_x(a_x / 2) \cdot
2513     \mathsf{G}_y(a_y / 2) \cdot \mathsf{G}_z(a_z) \cdot \mathsf{G}_y(a_y
2514     / 2) \cdot \mathsf{G}_x(a_x /2),
2515     \end{equation}
2516     where each rotational propagator, $\mathsf{G}_\alpha(\theta)$,
2517     rotates both the rotation matrix ($\mathbf{Q}$) and the body-fixed
2518     angular momentum (${\bf j}$) by an angle $\theta$ around body-fixed
2519     axis $\alpha$,
2520     \begin{equation}
2521     \mathsf{G}_\alpha( \theta ) = \left\{
2522     \begin{array}{lcl}
2523     \mathbf{Q}(t) & \leftarrow & \mathbf{Q}(0) \cdot \mathsf{R}_\alpha(\theta)^T, \\
2524     {\bf j}(t) & \leftarrow & \mathsf{R}_\alpha(\theta) \cdot {\bf
2525     j}(0).
2526     \end{array}
2527     \right.
2528     \end{equation}
2529     $\mathsf{R}_\alpha$ is a quadratic approximation to the single-axis
2530     rotation matrix. For example, in the small-angle limit, the
2531     rotation matrix around the body-fixed x-axis can be approximated as
2532     \begin{equation}
2533     \mathsf{R}_x(\theta) \approx \left(
2534     \begin{array}{ccc}
2535     1 & 0 & 0 \\
2536     0 & \frac{1-\theta^2 / 4}{1 + \theta^2 / 4} & -\frac{\theta}{1+
2537     \theta^2 / 4} \\
2538     0 & \frac{\theta}{1+ \theta^2 / 4} & \frac{1-\theta^2 / 4}{1 +
2539     \theta^2 / 4}
2540     \end{array}
2541     \right).
2542     \end{equation}
2543     All other rotations follow in a straightforward manner. After the
2544     first part of the propagation, the forces and body-fixed torques are
2545     calculated at the new positions and orientations. The system forces
2546     and torques are derivatives of the total potential energy function
2547     ($U$) with respect to the rigid body positions (${\bf r}$) and the
2548     columns of the transposed rotation matrix ${\bf Q}^T = \left({\bf
2549     u}_x, {\bf u}_y, {\bf u}_z \right)$:
2550    
2551     {\tt Forces:}
2552     \begin{align*}
2553     {\bf f}_{s}(t + h) & \leftarrow
2554     - \left(\frac{\partial U}{\partial {\bf r}}\right)_{{\bf r}(t + h)} \\
2555     %
2556     {\bf \tau}_{s}(t + h) &\leftarrow {\bf u}(t + h)
2557     \times \frac{\partial U}{\partial {\bf u}} \\
2558     %
2559     {\bf v}^{b}_{R}(t+h) & \leftarrow \mathbf{Q}(t+h) \cdot \left({\bf v}(t+h) + {\bf \omega}(t+h) \times {\bf r}_{MR} \right) \\
2560     %
2561     {\bf f}_{R,f}^{b}(t+h) & \leftarrow - \Xi_{R}^{tt} \cdot
2562     {\bf v}^{b}_{R}(t+h) - \Xi_{R}^{rt} \cdot {\bf \omega}(t+h) \\
2563     %
2564     {\bf \tau}_{R,f}^{b}(t+h) & \leftarrow - \Xi_{R}^{tr} \cdot
2565     {\bf v}^{b}_{R}(t+h) - \Xi_{R}^{rr} \cdot {\bf \omega}(t+h) \\
2566     %
2567     Z & \leftarrow {\tt GaussianNormal}(2 k_B T / h, 6) \\
2568     {\bf F}_{R,r}^{b}(t+h) & \leftarrow {\bf S} \cdot Z \\
2569     %
2570     {\bf f}(t+h) & \leftarrow {\bf f}_{s}(t+h) + \mathbf{Q}^{T}(t+h)
2571     \cdot \left({\bf f}_{R,f}^{~b} + {\bf f}_{R,r}^{~b} \right) \\
2572     %
2573     \tau(t+h) & \leftarrow \tau_{s}(t+h) + \mathbf{Q}^{T}(t+h) \cdot \left(\tau_{R,f}^{~b} + \tau_{R,r}^{~b} \right) + {\bf r}_{MR} \times \left({\bf f}_{f}(t+h) + {\bf f}_{r}(t+h) \right) \\
2574     \tau^{~b}(t+h) & \leftarrow \mathbf{Q}(t+h) \cdot \tau(t+h) \\
2575     \end{align*}
2576     Frictional (and random) forces and torques must be computed at the
2577     center of resistance, so there are additional steps required to find
2578     the body-fixed velocity (${\bf v}_{R}^{~b}$) at this location. Mapping
2579     the frictional and random forces at the center of resistance back to
2580     the center of mass also introduces an additional term in the torque
2581     one obtains at the center of mass.
2582    
2583     Once the forces and torques have been obtained at the new time step,
2584     the velocities can be advanced to the same time value.
2585    
2586     {\tt move B:}
2587     \begin{align*}
2588     {\bf v}\left(t + h \right) &\leftarrow {\bf v}\left(t + h / 2
2589     \right)
2590     + \frac{h}{2} \left( {\bf f}(t + h) / m \right), \\
2591     %
2592     {\bf j}\left(t + h \right) &\leftarrow {\bf j}\left(t + h / 2
2593     \right)
2594     + \frac{h}{2} {\bf \tau}^{~b}(t + h) .
2595     \end{align*}
2596    
2597 gezelter 3403 The viscosity of the implicit solvent must be specified using the {\tt
2598     viscosity} keyword in the meta-data file if the Langevin integrator is
2599     selected. For simple particles (spheres and ellipsoids), no further
2600     parameters are necessary. Since there are no analytic solutions for
2601     the resistance tensors for composite rigid bodies, the approximate
2602     tensors for these objects must also be specified in order to use
2603     Langevin dynamics. The meta-data file must therefore point to another
2604     file which contains the information about the hydrodynamic properties
2605     of all complex rigid bodies being used during the simulation. The
2606     {\tt HydroPropFile} keyword is used to specify the name of this
2607     file. A {\tt HydroPropFile} should be precalculated using the Hydro
2608     program that is included in the {\sc oopse} distribution.
2609 xsun 3399
2610 gezelter 3403 \begin{longtable}[c]{ABG}
2611     \caption{Meta-data Keywords: Required parameters for the Langevin integrator}
2612 xsun 3399 \\
2613 gezelter 3403 {\bf keyword} & {\bf units} & {\bf use} \\ \hline
2614 xsun 3399 \endhead
2615     \hline
2616     \endfoot
2617 gezelter 3403 {\tt viscosity} & centipoise & Sets the value of viscosity of the implicit
2618     solvent \\
2619     {\tt targetTemp} & K & Sets the target temperature of the system.
2620     This parameter must be specified to use Langevin dynamics. \\
2621     {\tt HydroPropFile} & string & Specifies the name of the resistance
2622     tensor (usually a {\tt .diff} file) which is precalculated by {\tt
2623     Hydro}. This keyworkd is not necessary if the simulation contains only
2624     simple bodies (spheres and ellipsoids). \\
2625     {\tt beadSize} & $\mbox{\AA}$ & Sets the diameter of the beads to use
2626     when the {\tt RoughShell} model is used to approximate the resistance
2627     tensor.
2628 xsun 3399 \label{table:ldParameters}
2629     \end{longtable}
2630    
2631 xsun 3402 \section{\label{sec:constraints}Constraint Methods}
2632    
2633     \subsection{\label{oopseSec:rattle}The {\sc rattle} Method for Bond
2634     Constraints}
2635    
2636     In order to satisfy the constraints of fixed bond lengths within {\sc
2637     oopse}, we have implemented the {\sc rattle} algorithm of
2638     Andersen.\cite{andersen83} {\sc rattle} is a velocity-Verlet
2639     formulation of the {\sc shake} method\cite{ryckaert77} for iteratively
2640     solving the Lagrange multipliers which maintain the holonomic
2641     constraints. Both methods are covered in depth in the
2642     literature,\cite{leach01:mm,Allen87} and a detailed description of
2643     this method would be redundant.
2644    
2645     \subsection{\label{oopseSec:zcons}The Z-Constraint Method}
2646    
2647     A force auto-correlation method based on the fluctuation-dissipation
2648     theorem was developed by Roux and Karplus to investigate the dynamics
2649     of ions inside ion channels.\cite{Roux91} The time-dependent friction
2650     coefficient can be calculated from the deviation of the instantaneous
2651     force from its mean value:
2652     \begin{equation}
2653     \xi(z,t)=\langle\delta F(z,t)\delta F(z,0)\rangle/k_{B}T,
2654     \end{equation}
2655     where%
2656     \begin{equation}
2657     \delta F(z,t)=F(z,t)-\langle F(z,t)\rangle.
2658     \end{equation}
2659    
2660     If the time-dependent friction decays rapidly, the static friction
2661     coefficient can be approximated by
2662     \begin{equation}
2663     \xi_{\text{static}}(z)=\int_{0}^{\infty}\langle\delta F(z,t)\delta F(z,0)\rangle dt.
2664     \end{equation}
2665    
2666     This allows the diffusion constant to then be calculated through the
2667     Einstein relation:\cite{Marrink94}
2668     \begin{equation}
2669     D(z)=\frac{k_{B}T}{\xi_{\text{static}}(z)}=\frac{(k_{B}T)^{2}}{\int_{0}^{\infty
2670     }\langle\delta F(z,t)\delta F(z,0)\rangle dt}.%
2671     \end{equation}
2672    
2673     The Z-Constraint method, which fixes the $z$ coordinates of a few
2674     ``tagged'' molecules with respect to the center of the mass of the
2675     system is a technique that was proposed to obtain the forces required
2676     for the force auto-correlation calculation.\cite{Marrink94} However,
2677     simply resetting the coordinate will move the center of the mass of
2678     the whole system. To avoid this problem, we have developed a new
2679     method that is utilized in {\sc oopse}. Instead of resetting the
2680     coordinates, we reset the forces of $z$-constrained molecules and
2681     subtract the total constraint forces from the rest of the system after
2682     the force calculation at each time step.
2683    
2684     After the force calculation, the total force on molecule $\alpha$ is:
2685     \begin{equation}
2686     G_{\alpha} = \sum_i F_{\alpha i},
2687     \label{oopseEq:zc1}
2688     \end{equation}
2689     where $F_{\alpha i}$ is the force in the $z$ direction on atom $i$ in
2690     $z$-constrained molecule $\alpha$. The forces on the atoms in the
2691     $z$-constrained molecule are then adjusted to remove the total force
2692     on molecule $\alpha$:
2693     \begin{equation}
2694     F_{\alpha i} = F_{\alpha i} -
2695     \frac{m_{\alpha i} G_{\alpha}}{\sum_i m_{\alpha i}}.
2696     \end{equation}
2697     Here, $m_{\alpha i}$ is the mass of atom $i$ in the $z$-constrained
2698     molecule. After the forces have been adjusted, the velocities must
2699     also be modified to subtract out molecule $\alpha$'s center-of-mass
2700     velocity in the $z$ direction.
2701     \begin{equation}
2702     v_{\alpha i} = v_{\alpha i} -
2703     \frac{\sum_i m_{\alpha i} v_{\alpha i}}{\sum_i m_{\alpha i}},
2704     \end{equation}
2705     where $v_{\alpha i}$ is the velocity of atom $i$ in the $z$ direction.
2706     Lastly, all of the accumulated constraint forces must be subtracted
2707     from the rest of the unconstrained system to keep the system center of
2708     mass of the entire system from drifting.
2709     \begin{equation}
2710     F_{\beta i} = F_{\beta i} - \frac{m_{\beta i} \sum_{\alpha} G_{\alpha}}
2711     {\sum_{\beta}\sum_i m_{\beta i}},
2712     \end{equation}
2713     where $\beta$ denotes all {\it unconstrained} molecules in the
2714     system. Similarly, the velocities of the unconstrained molecules must
2715     also be scaled:
2716     \begin{equation}
2717     v_{\beta i} = v_{\beta i} + \sum_{\alpha} \frac{\sum_i m_{\alpha i}
2718     v_{\alpha i}}{\sum_i m_{\alpha i}}.
2719     \end{equation}
2720    
2721     This method will pin down the centers-of-mass of all of the
2722     $z$-constrained molecules, and will also keep the entire system fixed
2723     at the original system center-of-mass location.
2724    
2725     At the very beginning of the simulation, the molecules may not be at
2726     their desired positions. To steer a $z$-constrained molecule to its
2727     specified position, a simple harmonic potential is used:
2728     \begin{equation}
2729     U(t)=\frac{1}{2}k_{\text{Harmonic}}(z(t)-z_{\text{cons}})^{2},%
2730     \end{equation}
2731     where $k_{\text{Harmonic}}$ is an harmonic force constant, $z(t)$ is
2732     the current $z$ coordinate of the center of mass of the constrained
2733     molecule, and $z_{\text{cons}}$ is the desired constraint
2734     position. The harmonic force operating on the $z$-constrained molecule
2735     at time $t$ can be calculated by
2736     \begin{equation}
2737     F_{z_{\text{Harmonic}}}(t)=-\frac{\partial U(t)}{\partial z(t)}=
2738     -k_{\text{Harmonic}}(z(t)-z_{\text{cons}}).
2739     \end{equation}
2740    
2741     The user may also specify the use of a constant velocity method
2742     (steered molecular dynamics) to move the molecules to their desired
2743     initial positions. Based on concepts from atomic force microscopy,
2744     {\sc smd} has been used to study many processes which occur via rare
2745     events on the time scale of a few hundreds of picoseconds. For
2746     example,{\sc smd} has been used to observe the dissociation of
2747     Streptavidin-biotin Complex.\cite{smd}
2748    
2749     To use of the $z$-constraint method in an {\sc oopse} simulation, the
2750     molecules must be specified using the {\tt nZconstraints} keyword in
2751     the meta-data file. The other parameters for modifying the behavior
2752     of the $z$-constraint method are listed in table~\ref{table:zconParams}.
2753    
2754     \begin{longtable}[c]{ABCD}
2755     \caption{Meta-data Keywords: Z-Constraint Parameters}
2756     \\
2757     {\bf keyword} & {\bf units} & {\bf use} & {\bf remarks} \\ \hline
2758     \endhead
2759     \hline
2760     \endfoot
2761     {\tt zconsTime} & fs & Sets the frequency at which the {\tt .fz} file
2762     is written & \\
2763     {\tt zconsForcePolicy} & string & The strategy for subtracting
2764     the $z$-constraint force from the {\it unconstrained} molecules & Possible
2765     strategies are {\tt BYMASS} and {\tt BYNUMBER}. The default
2766     strategy is {\tt BYMASS}\\
2767     {\tt zconsGap} & $\mbox{\AA}$ & Sets the distance between two adjacent
2768     constraint positions&Used mainly to move molecules through a
2769     simulation to estimate potentials of mean force. \\
2770     {\tt zconsFixtime} & fs & Sets the length of time the $z$-constraint
2771     molecule is held fixed & {\tt zconsFixtime} must be set if {\tt
2772     zconsGap} is set\\
2773     {\tt zconsUsingSMD} & logical & Flag for using Steered Molecular
2774     Dynamics to move the molecules to the correct constrained positions &
2775     Harmonic Forces are used by default
2776     \label{table:zconParams}
2777     \end{longtable}
2778    
2779 gezelter 3395 \chapter{\label{oopseSec:thermInt}Thermodynamic Integration}
2780    
2781     Thermodynamic integration is an established technique that has been
2782     used extensively in the calculation of free energies for condensed
2783     phases of
2784     materials.\cite{Frenkel84,Hermens88,Meijer90,Baez95a,Vlot99}. This
2785     method uses a sequence of simulations during which the system of
2786     interest is converted into a reference system for which the free
2787     energy is known analytically ($A_0$). The difference in potential
2788     energy between the reference system and the system of interest
2789     ($\Delta V$) is then integrated in order to determine the free energy
2790     difference between the two states:
2791     \begin{equation}
2792     A = A_0 + \int_0^1 \left\langle \Delta V \right\rangle_\lambda
2793     d\lambda.
2794     \label{eq:thermInt}
2795     \end{equation}
2796     Here, $\lambda$ is the parameter that governs the transformation
2797     between the reference system and the system of interest. For
2798     crystalline phases, an harmonically-restrained (Einstein) crystal is
2799     chosen as the reference state, while for liquid phases, the ideal gas
2800     is taken as the reference state.
2801    
2802     In an Einstein crystal, the molecules are restrained at their ideal
2803     lattice locations and orientations. Using harmonic restraints, as
2804     applied by B\`{a}ez and Clancy, the total potential for this reference
2805     crystal ($V_\mathrm{EC}$) is the sum of all the harmonic restraints,
2806     \begin{equation}
2807     V_\mathrm{EC} = \sum_{i} \left[ \frac{K_\mathrm{v}}{2} (r_i - r_i^\circ)^2 +
2808     \frac{K_\theta}{2} (\theta_i - \theta_i^\circ)^2 +
2809     \frac{K_\omega}{2}(\omega_i - \omega_i^\circ)^2 \right],
2810     \end{equation}
2811     where $K_\mathrm{v}$, $K_\mathrm{\theta}$, and $K_\mathrm{\omega}$ are
2812     the spring constants restraining translational motion and deflection
2813     of and rotation around the principle axis of the molecule
2814     respectively. The values of $\theta$ range from $0$ to $\pi$, while
2815     $\omega$ ranges from $-\pi$ to $\pi$.
2816    
2817     The partition function for a molecular crystal restrained in this
2818     fashion can be evaluated analytically, and the Helmholtz Free Energy
2819     ({\it A}) is given by
2820     \begin{eqnarray}
2821     \frac{A}{N} = \frac{E_m}{N}\ -\ kT\ln \left (\frac{kT}{h\nu}\right )^3&-&kT\ln \left
2822     [\pi^\frac{1}{2}\left (\frac{8\pi^2I_\mathrm{A}kT}{h^2}\right
2823     )^\frac{1}{2}\left (\frac{8\pi^2I_\mathrm{B}kT}{h^2}\right
2824     )^\frac{1}{2}\left (\frac{8\pi^2I_\mathrm{C}kT}{h^2}\right
2825     )^\frac{1}{2}\right ] \nonumber \\ &-& kT\ln \left [\frac{kT}{2(\pi
2826     K_\omega K_\theta)^{\frac{1}{2}}}\exp\left
2827     (-\frac{kT}{2K_\theta}\right)\int_0^{\left (\frac{kT}{2K_\theta}\right
2828     )^\frac{1}{2}}\exp(t^2)\mathrm{d}t\right ],
2829     \label{ecFreeEnergy}
2830     \end{eqnarray}
2831     where $2\pi\nu = (K_\mathrm{v}/m)^{1/2}$, and $E_m$ is the minimum
2832     potential energy of the ideal crystal.\cite{Baez95a}
2833    
2834     {\sc oopse} can perform the simulations that aid the user in
2835     constructing the thermodynamic path from the molecular system to one
2836     of the reference systems. To do this, the user sets the value of
2837     $\lambda$ (between 0 \& 1) in the meta-data file. If the system of
2838     interest is crystalline, {\sc oopse} must be able to find the {\it
2839     reference} configuration of the system in a file called {\tt
2840     idealCrystal.in} in the directory from which the simulation was run.
2841     This file is a standard {\tt .dump} file, but all information about
2842     velocities and angular momenta are discarded when the file is read.
2843    
2844     The configuration found in the {\tt idealCrystal.in} file is used for
2845     the reference positions and molecular orientations of the Einstein
2846     crystal. To complete the specification of the Einstein crystal, a set
2847     of force constants must also be specified; one for displacments of the
2848     molecular centers of mass, and two for displacements from the ideal
2849     orientations of the molecules.
2850    
2851     To construct a thermodynamic integration path, the user would run a
2852     sequence of $N$ simulations, each with a different value of lambda
2853     between $0$ and $1$. When {\tt useSolidThermInt} is set to {\tt true}
2854     in the meta-data file, two additional energy columns are reported in
2855     the {\tt .stat} file for the simulation. The first, {\tt vRaw}, is
2856     the unperturbed energy for the configuration, and the second, {\tt
2857     vHarm}, is the energy of the harmonic (Einstein) system in an
2858     identical configuration. The total potential energy of the
2859     configuration is a linear combination of {\tt vRaw} and {\tt vHarm}
2860     weighted by the value of $\lambda$.
2861    
2862     From a running average of the difference between {\tt vRaw} and {\tt
2863     vHarm}, the user can obtain the integrand in Eq. (\ref{eq:thermInt})
2864     for fixed value of $\lambda$.
2865    
2866     There are two additional files with the suffixes {\tt .zang0} and {\tt
2867     .zang} generated by {\sc oopse} during the first run of a solid
2868     thermodynamic integration. These files contain the initial ({\tt
2869     .zang0}) and final ({\tt .zang}) values of the angular displacement
2870     coordinates for each of the molecules. These are particularly useful
2871     when chaining a number of simulations (with successive values of
2872     $\lambda$) together.
2873    
2874     For {\it liquid} thermodynamic integrations, the reference system is
2875     the ideal gas (with a potential exactly equal to 0), so the {\tt
2876     .stat} file contains only the standard columns. The potential energy
2877     column contains the potential of the {\it unperturbed} system (and not
2878     the $\lambda$-weighted potential. This allows the user to use the
2879     potential energy directly as the $\Delta V$ in the integrand of
2880     Eq. (\ref{eq:thermInt}).
2881    
2882     Meta-data parameters concerning thermodynamic integrations are given in
2883     Table~\ref{table:thermIntParams}
2884    
2885     \begin{longtable}[c]{ABCD}
2886     \caption{Meta-data Keywords: Thermodynamic Integration Parameters}
2887     \\
2888     {\bf keyword} & {\bf units} & {\bf use} & {\bf remarks} \\ \hline
2889     \endhead
2890     \hline
2891     \endfoot
2892     {\tt useSolidThermInt} & logical & perform thermodynamic integration
2893     to an Einstein crystal? & default is ``false'' \\
2894     {\tt useLiquidThermInt} & logical & perform thermodynamic integration
2895     to an ideal gas? & default is ``false'' \\
2896     {\tt thermodynamicIntegrationLambda} & & & \\
2897     & double & transformation
2898     parameter & Sets how far along the thermodynamic integration path the
2899     simulation will be. \\
2900     {\tt thermodynamicIntegrationK} & & & \\
2901     & double & & power of $\lambda$
2902     governing shape of integration pathway \\
2903     {\tt thermIntDistSpringConst} & & & \\
2904     & $\mbox{kcal~mol}^{-1} \mbox{\AA}^{-2}$
2905     & & spring constant for translations in Einstein crystal \\
2906     {\tt thermIntThetaSpringConst} & & & \\
2907     & $\mbox{kcal~mol}^{-1}
2908     \mbox{rad}^{-2}$ & & spring constant for deflection away from z-axis
2909     in Einstein crystal \\
2910     {\tt thermIntOmegaSpringConst} & & & \\
2911     & $\mbox{kcal~mol}^{-1}
2912     \mbox{rad}^{-2}$ & & spring constant for rotation around z-axis in
2913     Einstein crystal
2914     \label{table:thermIntParams}
2915     \end{longtable}
2916    
2917    
2918     \chapter{\label{oopseSec:minimizer}Energy Minimization}
2919    
2920     As one of the basic procedures of molecular modeling, energy
2921     minimization is used to identify local configurations that are stable
2922     points on the potential energy surface. There is a vast literature on
2923     energy minimization algorithms have been developed to search for the
2924     global energy minimum as well as to find local structures which are
2925     stable fixed points on the surface. We have included two simple
2926     minimization algorithms: steepest descent, ({\sc sd}) and conjugate
2927     gradient ({\sc cg}) to help users find reasonable local minima from
2928     their initial configurations. Since {\sc oopse} handles atoms and
2929     rigid bodies which have orientational coordinates as well as
2930     translational coordinates, there is some subtlety to the choice of
2931     parameters for minimization algorithms.
2932    
2933     Given a coordinate set $x_{k}$ and a search direction $d_{k}$, a line
2934     search algorithm is performed along $d_{k}$ to produce
2935     $x_{k+1}=x_{k}+$ $\lambda _{k}d_{k}$. In the steepest descent ({\sc
2936     sd}) algorithm,%
2937     \begin{equation}
2938     d_{k}=-\nabla V(x_{k}).
2939     \end{equation}
2940     The gradient and the direction of next step are always orthogonal.
2941     This may cause oscillatory behavior in narrow valleys. To overcome
2942     this problem, the Fletcher-Reeves variant~\cite{FletcherReeves} of the
2943     conjugate gradient ({\sc cg}) algorithm is used to generate $d_{k+1}$
2944     via simple recursion:
2945     \begin{equation}
2946     d_{k+1} =-\nabla V(x_{k+1})+\gamma_{k}d_{k}
2947     \end{equation}
2948     where
2949     \begin{equation}
2950     \gamma_{k} =\frac{\nabla V(x_{k+1})^{T}\nabla V(x_{k+1})}{\nabla
2951     V(x_{k})^{T}\nabla V(x_{k})}.
2952     \end{equation}
2953    
2954     The Polak-Ribiere variant~\cite{PolakRibiere} of the conjugate
2955     gradient ($\gamma_{k}$) is defined as%
2956     \begin{equation}
2957     \gamma_{k}=\frac{[\nabla V(x_{k+1})-\nabla V(x)]^{T}\nabla V(x_{k+1})}{\nabla
2958     V(x_{k})^{T}\nabla V(x_{k})}%
2959     \end{equation}
2960     It is widely agreed that the Polak-Ribiere variant gives better
2961     convergence than the Fletcher-Reeves variant, so the conjugate
2962     gradient approach implemented in {\sc oopse} is the Polak-Ribiere
2963     variant.
2964    
2965     The conjugate gradient method assumes that the conformation is close
2966     enough to a local minimum that the potential energy surface is very
2967     nearly quadratic. When the initial structure is far from the minimum,
2968     the steepest descent method can be superior to the conjugate gradient
2969     method. Hence, the steepest descent method is often used for the first
2970     10-100 steps of minimization. Another useful feature of minimization
2971     methods in {\sc oopse} is that a modified {\sc shake} algorithm can be
2972     applied during the minimization to constraint the bond lengths if this
2973     is required by the force field. Meta-data parameters concerning the
2974     minimizer are given in Table~\ref{table:minimizeParams}
2975    
2976     \begin{longtable}[c]{ABCD}
2977     \caption{Meta-data Keywords: Energy Minimizer Parameters}
2978     \\
2979     {\bf keyword} & {\bf units} & {\bf use} & {\bf remarks} \\ \hline
2980     \endhead
2981     \hline
2982     \endfoot
2983     {\tt minimizer} & string & selects the minimization method to be used
2984     & either {\tt CG} (conjugate gradient) or {\tt SD} (steepest
2985     descent) \\
2986     {\tt minimizerMaxIter} & steps & Sets the maximum number of iterations
2987     for the energy minimization & The default value is 200\\
2988     {\tt minimizerWriteFreq} & steps & Sets the frequency with which the {\tt .dump} and {\tt .stat} files are writtern during energy minimization & \\
2989     {\tt minimizerStepSize} & $\mbox{\AA}$ & Sets the step size for the
2990     line search & The default value is 0.01\\
2991     {\tt minimizerFTol} & $\mbox{kcal mol}^{-1}$ & Sets the energy tolerance
2992     for stopping the minimziation. & The default value is $10^{-8}$\\
2993     {\tt minimizerGTol} & $\mbox{kcal mol}^{-1}\mbox{\AA}^{-1}$ & Sets the
2994     gradient tolerance for stopping the minimization. & The default value
2995     is $10^{-8}$\\
2996     {\tt minimizerLSTol} & $\mbox{kcal mol}^{-1}$ & Sets line search
2997     tolerance for terminating each step of the minimization. & The default
2998     value is $10^{-8}$\\
2999     {\tt minimizerLSMaxIter} & steps & Sets the maximum number of
3000     iterations for each line search & The default value is 50\\
3001     \label{table:minimizeParams}
3002     \end{longtable}
3003    
3004     \chapter{\label{oopseSec:anal}Analysis of Physical Properties}
3005    
3006     {\sc oopse} includes a few utility programs which compute properties
3007     from the dump files that are generated during a molecular dynamics
3008     simulation. These programs are:
3009    
3010     \begin{description}
3011     \item[{\bf Dump2XYZ}] Converts an {\sc oopse} dump file into a file
3012     suitable for viewing in a molecular dynamics viewer like Jmol
3013     \item[{\bf StaticProps}] Computes static properties like the pair
3014     distribution function, $g(r)$.
3015     \item[{\bf DynamicProps}] Computes time correlation functions like the
3016     velocity autocorrelation function, $\langle v(t) \cdot v(0)\rangle$,
3017     or the mean square displacement $\langle |r(t) - r(0)|^{2} \rangle$.
3018     \end{description}
3019    
3020     These programs often need to operate on a subset of the data contained
3021     within a dump file. For example, if you want only the {\it oxygen-oxygen}
3022     pair distribution from a water simulation, or if you want to make a
3023     movie including only the water molecules within a 6 angstrom radius of
3024     lipid head groups, you need a way to specify your selection to these
3025     utility programs. OOPSE has a selection syntax which allows you to
3026     specify the selection in a compact form in order to generate only the
3027     data you want. For example a common use of the StaticProps command
3028     would be:
3029    
3030     {\tt StaticProps -i tp4.dump -{}-gofr -{}-sele1="select O*" -{}-sele2="select O*"}
3031    
3032     This command computes the oxygen-oxygen pair distribution function,
3033     $g_{OO}(r)$, from a file named {\tt tp4.dump}. In order to understand
3034     this selection syntax and to make full use of the selection
3035     capabilities of the analysis programs, it is necessary to understand a
3036     few of the core concepts that are used to perform simulations.
3037    
3038     \section{\label{oopseSec:concepts}Concepts}
3039    
3040     OOPSE manipulates both traditional atoms as well as some objects that
3041     {\it behave like atoms}. These objects can be rigid collections of
3042     atoms or atoms which have orientational degrees of freedom. Here is a
3043     diagram of the class heirarchy:
3044    
3045     \begin{figure}
3046     \centering
3047     \includegraphics[width=3in]{heirarchy.pdf}
3048     \caption[Class heirarchy for StuntDoubles in {\sc oopse}-4]{ \\ The
3049     class heirarchy of StuntDoubles in {\sc oopse}-4. The selection
3050     syntax allows the user to select any of the objects that are descended
3051     from a StuntDouble.}
3052     \label{oopseFig:heirarchy}
3053     \end{figure}
3054    
3055     \begin{itemize}
3056     \item A {\bf StuntDouble} is {\it any} object that can be manipulated by the
3057     integrators and minimizers.
3058     \item An {\bf Atom} is a fundamental point-particle that can be moved around during a simulation.
3059     \item A {\bf DirectionalAtom} is an atom which has {\it orientational} as well as translational degrees of freedom.
3060     \item A {\bf RigidBody} is a collection of {\bf Atom}s or {\bf
3061     DirectionalAtom}s which behaves as a single unit.
3062     \end{itemize}
3063    
3064     Every Molecule, Atom and DirectionalAtom in {\sc oopse} have their own names
3065     which are specified in the {\tt .md} file. In contrast, RigidBodies are
3066     denoted by their membership and index inside a particular molecule:
3067     [MoleculeName]\_RB\_[index] (the contents inside the brackets
3068     depend on the specifics of the simulation). The names of rigid bodies are
3069     generated automatically. For example, the name of the first rigid body
3070     in a DMPC molecule is DMPC\_RB\_0.
3071    
3072     \section{\label{oopseSec:syntax}Syntax of the Select Command}
3073    
3074     The most general form of the select command is: {\tt select {\it expression}}
3075    
3076     This expression represents an arbitrary set of StuntDoubles (Atoms or
3077     RigidBodies) in {\sc oopse}. Expressions are composed of either name
3078     expressions, index expressions, predefined sets, user-defined
3079     expressions, comparison operators, within expressions, or logical
3080     combinations of the above expression types. Expressions can be
3081     combined using parentheses and the Boolean operators.
3082    
3083     \subsection{\label{oopseSec:logical}Logical expressions}
3084    
3085     The logical operators allow complex queries to be constructed out of
3086     simpler ones using the standard boolean connectives {\bf and}, {\bf
3087     or}, {\bf not}. Parentheses can be used to alter the precedence of the
3088     operators.
3089    
3090     \begin{center}
3091     \begin{tabular}{|ll|}
3092     \hline
3093     {\bf logical operator} & {\bf equivalent operator} \\
3094     \hline
3095     and & ``\&'', ``\&\&'' \\
3096     or & ``$|$'', ``$||$'', ``,'' \\
3097     not & ``!'' \\
3098     \hline
3099     \end{tabular}
3100     \end{center}
3101    
3102     \subsection{\label{oopseSec:name}Name expressions}
3103    
3104     \begin{center}
3105     \begin{tabular}{|llp{3in}|}
3106     \hline
3107     {\bf type of expression} & {\bf examples} & {\bf translation of
3108     examples} \\
3109     \hline
3110     expression without ``.'' & select DMPC & select all StuntDoubles
3111     belonging to all DMPC molecules \\
3112     & select C* & select all atoms which have atom types beginning with C
3113     \\
3114     & select DMPC\_RB\_* & select all RigidBodies in DMPC molecules (but
3115     only select the rigid bodies, and not the atoms belonging to them). \\
3116     \hline
3117     expression has one ``.'' & select TIP3P.O\_TIP3P & select the O\_TIP3P
3118     atoms belonging to TIP3P molecules \\
3119     & select DMPC\_RB\_O.PO4 & select the PO4 atoms belonging to
3120     the first
3121     RigidBody in each DMPC molecule \\
3122     & select DMPC.20 & select the twentieth StuntDouble in each DMPC
3123     molecule \\
3124     \hline
3125     expression has two ``.''s & select DMPC.DMPC\_RB\_?.* &
3126     select all atoms
3127     belonging to all rigid bodies within all DMPC molecules \\
3128     \hline
3129     \end{tabular}
3130     \end{center}
3131    
3132     \subsection{\label{oopseSec:index}Index expressions}
3133    
3134     \begin{center}
3135     \begin{tabular}{|lp{4in}|}
3136     \hline
3137     {\bf examples} & {\bf translation of examples} \\
3138     \hline
3139     select 20 & select all of the StuntDoubles belonging to Molecule 20 \\
3140     select 20 to 30 & select all of the StuntDoubles belonging to
3141     molecules which have global indices between 20 (inclusive) and 30
3142     (exclusive) \\
3143     \hline
3144     \end{tabular}
3145     \end{center}
3146    
3147     \subsection{\label{oopseSec:predefined}Predefined sets}
3148    
3149     \begin{center}
3150     \begin{tabular}{|ll|}
3151     \hline
3152     {\bf keyword} & {\bf description} \\
3153     \hline
3154     all & select all StuntDoubles \\
3155     none & select none of the StuntDoubles \\
3156     \hline
3157     \end{tabular}
3158     \end{center}
3159    
3160     \subsection{\label{oopseSec:userdefined}User-defined expressions}
3161    
3162     Users can define arbitrary terms to represent groups of StuntDoubles,
3163     and then use the define terms in select commands. The general form for
3164     the define command is: {\bf define {\it term expression}}
3165    
3166     Once defined, the user can specify such terms in boolean expressions
3167    
3168     {\tt define SSDWATER SSD or SSD1 or SSDRF}
3169    
3170     {\tt select SSDWATER}
3171    
3172     \subsection{\label{oopseSec:comparison}Comparison expressions}
3173    
3174     StuntDoubles can be selected by using comparision operators on their
3175     properties. The general form for the comparison command is: a property
3176     name, followed by a comparision operator and then a number.
3177    
3178     \begin{center}
3179     \begin{tabular}{|l|l|}
3180     \hline
3181     {\bf property} & mass, charge \\
3182     {\bf comparison operator} & ``$>$'', ``$<$'', ``$=$'', ``$>=$'',
3183     ``$<=$'', ``$!=$'' \\
3184     \hline
3185     \end{tabular}
3186     \end{center}
3187    
3188     For example, the phrase {\tt select mass > 16.0 and charge < -2}
3189     wouldselect StuntDoubles which have mass greater than 16.0 and charges
3190     less than -2.
3191    
3192     \subsection{\label{oopseSec:within}Within expressions}
3193    
3194     The ``within'' keyword allows the user to select all StuntDoubles
3195     within the specified distance (in Angstroms) from a selection,
3196     including the selected atom itself. The general form for within
3197     selection is: {\tt select within(distance, expression)}
3198    
3199     For example, the phrase {\tt select within(2.5, PO4 or NC4)} would
3200     select all StuntDoubles which are within 2.5 angstroms of PO4 or NC4
3201     atoms.
3202    
3203     \section{\label{oopseSec:tools}Tools which use the selection command}
3204    
3205     \subsection{\label{oopseSec:Dump2XYZ}Dump2XYZ}
3206    
3207     Dump2XYZ can transform an OOPSE dump file into a xyz file which can
3208     be opened by other molecular dynamics viewers such as Jmol and
3209     VMD. The options available for Dump2XYZ are as follows:
3210    
3211    
3212     \begin{longtable}[c]{|EFG|}
3213     \caption{Dump2XYZ Command-line Options}
3214     \\ \hline
3215     {\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline
3216     \endhead
3217     \hline
3218     \endfoot
3219     -h & {\tt -{}-help} & Print help and exit \\
3220     -V & {\tt -{}-version} & Print version and exit \\
3221     -i & {\tt -{}-input=filename} & input dump file \\
3222     -o & {\tt -{}-output=filename} & output file name \\
3223     -n & {\tt -{}-frame=INT} & print every n frame (default=`1') \\
3224     -w & {\tt -{}-water} & skip the the waters (default=off) \\
3225     -m & {\tt -{}-periodicBox} & map to the periodic box (default=off)\\
3226     -z & {\tt -{}-zconstraint} & replace the atom types of zconstraint molecules (default=off) \\
3227     -r & {\tt -{}-rigidbody} & add a pseudo COM atom to rigidbody (default=off) \\
3228     -t & {\tt -{}-watertype} & replace the atom type of water model (default=on) \\
3229     -b & {\tt -{}-basetype} & using base atom type (default=off) \\
3230     & {\tt -{}-repeatX=INT} & The number of images to repeat in the x direction (default=`0') \\
3231     & {\tt -{}-repeatY=INT} & The number of images to repeat in the y direction (default=`0') \\
3232     & {\tt -{}-repeatZ=INT} & The number of images to repeat in the z direction (default=`0') \\
3233     -s & {\tt -{}-selection=selection script} & By specifying {\tt -{}-selection}=``selection command'' with Dump2XYZ, the user can select an arbitrary set of StuntDoubles to be
3234     converted. \\
3235     & {\tt -{}-originsele} & By specifying {\tt -{}-originsele}=``selection command'' with Dump2XYZ, the user can re-center the origin of the system around a specific StuntDouble \\
3236     & {\tt -{}-refsele} & In order to rotate the system, {\tt -{}-originsele} and {\tt -{}-refsele} must be given to define the new coordinate set. A StuntDouble which contains a dipole (the direction of the dipole is always (0, 0, 1) in body frame) is specified by {\tt -{}-originsele}. The new x-z plane is defined by the direction of the dipole and the StuntDouble is specified by {\tt -{}-refsele}.
3237     \end{longtable}
3238    
3239    
3240     \subsection{\label{oopseSec:StaticProps}StaticProps}
3241    
3242     {\tt StaticProps} can compute properties which are averaged over some
3243     or all of the configurations that are contained within a dump file.
3244     The most common example of a static property that can be computed is
3245     the pair distribution function between atoms of type $A$ and other
3246     atoms of type $B$, $g_{AB}(r)$. StaticProps can also be used to
3247     compute the density distributions of other molecules in a reference
3248     frame {\it fixed to the body-fixed reference frame} of a selected atom
3249     or rigid body.
3250    
3251     There are five seperate radial distribution functions availiable in
3252     OOPSE. Since every radial distrbution function invlove the calculation
3253     between pairs of bodies, {\tt -{}-sele1} and {\tt -{}-sele2} must be specified to tell
3254     StaticProps which bodies to include in the calculation.
3255    
3256     \begin{description}
3257     \item[{\tt -{}-gofr}] Computes the pair distribution function,
3258     \begin{equation*}
3259     g_{AB}(r) = \frac{1}{\rho_B}\frac{1}{N_A} \langle \sum_{i \in A}
3260     \sum_{j \in B} \delta(r - r_{ij}) \rangle
3261     \end{equation*}
3262     \item[{\tt -{}-r\_theta}] Computes the angle-dependent pair distribution
3263     function. The angle is defined by the intermolecular vector $\vec{r}$ and
3264     $z$-axis of DirectionalAtom A,
3265     \begin{equation*}
3266     g_{AB}(r, \cos \theta) = \frac{1}{\rho_B}\frac{1}{N_A} \langle \sum_{i \in A}
3267     \sum_{j \in B} \delta(r - r_{ij}) \delta(\cos \theta_{ij} - \cos \theta)\rangle
3268     \end{equation*}
3269     \item[{\tt -{}-r\_omega}] Computes the angle-dependent pair distribution
3270     function. The angle is defined by the $z$-axes of the two
3271     DirectionalAtoms A and B.
3272     \begin{equation*}
3273     g_{AB}(r, \cos \omega) = \frac{1}{\rho_B}\frac{1}{N_A} \langle \sum_{i \in A}
3274     \sum_{j \in B} \delta(r - r_{ij}) \delta(\cos \omega_{ij} - \cos \omega)\rangle
3275     \end{equation*}
3276     \item[{\tt -{}-theta\_omega}] Computes the pair distribution in the angular
3277     space $\theta, \omega$ defined by the two angles mentioned above.
3278     \begin{equation*}
3279     g_{AB}(\cos\theta, \cos \omega) = \frac{1}{\rho_B}\frac{1}{N_A} \langle \sum_{i \in A}
3280     \sum_{j \in B} \langle \delta(\cos \theta_{ij} - \cos \theta)
3281     \delta(\cos \omega_{ij} - \cos \omega)\rangle
3282     \end{equation*}
3283     \item[{\tt -{}-gxyz}] Calculates the density distribution of particles of type
3284     B in the body frame of particle A. Therefore, {\tt -{}-originsele} and
3285     {\tt -{}-refsele} must be given to define A's internal coordinate set as
3286     the reference frame for the calculation.
3287     \end{description}
3288    
3289     The vectors (and angles) associated with these angular pair
3290     distribution functions are most easily seen in the figure below:
3291    
3292     \begin{figure}
3293     \centering
3294     \includegraphics[width=3in]{definition.pdf}
3295     \caption[Definitions of the angles between directional objects]{ \\ Any
3296     two directional objects (DirectionalAtoms and RigidBodies) have a set
3297     of two angles ($\theta$, and $\omega$) between the z-axes of their
3298     body-fixed frames.}
3299     \label{oopseFig:gofr}
3300     \end{figure}
3301    
3302     The options available for {\tt StaticProps} are as follows:
3303     \begin{longtable}[c]{|EFG|}
3304     \caption{StaticProps Command-line Options}
3305     \\ \hline
3306     {\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline
3307     \endhead
3308     \hline
3309     \endfoot
3310     -h& {\tt -{}-help} & Print help and exit \\
3311     -V& {\tt -{}-version} & Print version and exit \\
3312     -i& {\tt -{}-input=filename} & input dump file \\
3313     -o& {\tt -{}-output=filename} & output file name \\
3314     -n& {\tt -{}-step=INT} & process every n frame (default=`1') \\
3315     -r& {\tt -{}-nrbins=INT} & number of bins for distance (default=`100') \\
3316     -a& {\tt -{}-nanglebins=INT} & number of bins for cos(angle) (default= `50') \\
3317     -l& {\tt -{}-length=DOUBLE} & maximum length (Defaults to 1/2 smallest length of first frame) \\
3318     & {\tt -{}-sele1=selection script} & select the first StuntDouble set \\
3319     & {\tt -{}-sele2=selection script} & select the second StuntDouble set \\
3320     & {\tt -{}-sele3=selection script} & select the third StuntDouble set \\
3321     & {\tt -{}-refsele=selection script} & select reference (can only be used with {\tt -{}-gxyz}) \\
3322     & {\tt -{}-molname=STRING} & molecule name \\
3323     & {\tt -{}-begin=INT} & begin internal index \\
3324     & {\tt -{}-end=INT} & end internal index \\
3325     \hline
3326     \multicolumn{3}{|l|}{One option from the following group of options is required:} \\
3327     \hline
3328     & {\tt -{}-gofr} & $g(r)$ \\
3329     & {\tt -{}-r\_theta} & $g(r, \cos(\theta))$ \\
3330     & {\tt -{}-r\_omega} & $g(r, \cos(\omega))$ \\
3331     & {\tt -{}-theta\_omega} & $g(\cos(\theta), \cos(\omega))$ \\
3332     & {\tt -{}-gxyz} & $g(x, y, z)$ \\
3333     & {\tt -{}-p2} & $P_2$ order parameter ({\tt -{}-sele1} and {\tt -{}-sele2} must be specified) \\
3334     & {\tt -{}-scd} & $S_{CD}$ order parameter(either {\tt -{}-sele1}, {\tt -{}-sele2}, {\tt -{}-sele3} are specified or {\tt -{}-molname}, {\tt -{}-begin}, {\tt -{}-end} are specified) \\
3335     & {\tt -{}-density} & density plot ({\tt -{}-sele1} must be specified) \\
3336     & {\tt -{}-slab\_density} & slab density ({\tt -{}-sele1} must be specified)
3337     \end{longtable}
3338    
3339     \subsection{\label{oopseSec:DynamicProps}DynamicProps}
3340    
3341     {\tt DynamicProps} computes time correlation functions from the
3342     configurations stored in a dump file. Typical examples of time
3343     correlation functions are the mean square displacement and the
3344     velocity autocorrelation functions. Once again, the selection syntax
3345     can be used to specify the StuntDoubles that will be used for the
3346     calculation. A general time correlation function can be thought of
3347     as:
3348     \begin{equation}
3349     C_{AB}(t) = \langle \vec{u}_A(t) \cdot \vec{v}_B(0) \rangle
3350     \end{equation}
3351     where $\vec{u}_A(t)$ is a vector property associated with an atom of
3352     type $A$ at time $t$, and $\vec{v}_B(t^{\prime})$ is a different vector
3353     property associated with an atom of type $B$ at a different time
3354     $t^{\prime}$. In most autocorrelation functions, the vector properties
3355     ($\vec{v}$ and $\vec{u}$) and the types of atoms ($A$ and $B$) are
3356     identical, and the three calculations built in to {\tt DynamicProps}
3357     make these assumptions. It is possible, however, to make simple
3358     modifications to the {\tt DynamicProps} code to allow the use of {\it
3359     cross} time correlation functions (i.e. with different vectors). The
3360     ability to use two selection scripts to select different types of
3361     atoms is already present in the code.
3362    
3363     The options available for DynamicProps are as follows:
3364     \begin{longtable}[c]{|EFG|}
3365     \caption{DynamicProps Command-line Options}
3366     \\ \hline
3367     {\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline
3368     \endhead
3369     \hline
3370     \endfoot
3371     -h& {\tt -{}-help} & Print help and exit \\
3372     -V& {\tt -{}-version} & Print version and exit \\
3373     -i& {\tt -{}-input=filename} & input dump file \\
3374     -o& {\tt -{}-output=filename} & output file name \\
3375     & {\tt -{}-sele1=selection script} & select first StuntDouble set \\
3376     & {\tt -{}-sele2=selection script} & select second StuntDouble set (if sele2 is not set, use script from sele1) \\
3377     \hline
3378     \multicolumn{3}{|l|}{One option from the following group of options is required:} \\
3379     \hline
3380     -r& {\tt -{}-rcorr} & compute mean square displacement \\
3381     -v& {\tt -{}-vcorr} & compute velocity correlation function \\
3382     -d& {\tt -{}-dcorr} & compute dipole correlation function
3383     \end{longtable}
3384    
3385     \chapter{\label{oopseSec:PreparingInput} Preparing Input Configurations}
3386    
3387     {\sc oopse} version 4 comes with a few utility programs to aid in
3388     setting up initial configuration and meta-data files. Usually, a user
3389     is interested in either importing a structure from some other format
3390     (usually XYZ or PDB), or in building an initial configuration in some
3391     perfect crystalline lattice. The programs bundled with {\sc oopse}
3392     which import coordinate files are {\tt atom2md}, {\tt xyz2md}, and
3393     {\tt pdb2md}. The programs which generate perfect crystals are called
3394     {\tt SimpleBuilder} and {\tt RandomBuilder}
3395    
3396     \section{\label{oopseSec:atom2md}atom2md, xyz2md, and pdb2md}
3397    
3398     {\tt atom2md}, {\tt xyz2md}, and {\tt pdb2md} attempt to construct
3399     {\tt .md} files from a single file containing only atomic coordinate
3400     information. To do this task, they make reasonable guesses about
3401     bonding from the distance between atoms in the coordinate, and attempt
3402     to identify other terms in the potential energy from the topology of
3403     the graph of discovered bonds. This procedure is not perfect, and the
3404     user should check the discovered bonding topology that is contained in
3405     the {\tt $<$MetaData$>$} block in the file that is generated.
3406    
3407     Typically, the user would run:
3408    
3409     {\tt atom2md $<$input spec$>$ [Options]}
3410    
3411     Here {\tt $<$input spec$>$} can be used to specify the type of file being
3412     used for configuration input. I.e. using {\tt -ipdb} specifies that the
3413     input file contains coordinate information in the PDB format.
3414    
3415     The options available for atom2md are as follows:
3416     \begin{longtable}[c]{|HI|}
3417     \caption{atom2md Command-line Options}
3418     \\ \hline
3419     {\bf option} & {\bf behavior} \\ \hline
3420     \endhead
3421     \hline
3422     \endfoot
3423     -f \# & Start import at molecule \# specified \\
3424     -l \# & End import at molecule \# specified \\
3425     -t & All input files describe a single molecule \\
3426     -e & Continue with next object after error, if possible \\
3427     -z & Compress the output with gzip \\
3428     -H & Outputs this help text \\
3429     -Hxxx & (xxx is file format ID e.g. -Hpdb) gives format info \\
3430     -Hall & Outputs details of all formats \\
3431     -V & Outputs version number \\
3432     \hline
3433     \multicolumn{2}{|l|}{The following file formats are recognized:}\\
3434     \hline
3435     ent & Protein Data Bank format \\
3436     in & {\sc oopse} cartesian coordinates format \\
3437     pdb & Protein Data Bank format \\
3438     prep & Amber Prep format \\
3439     xyz & XYZ cartesian coordinates format \\
3440     \hline
3441     \multicolumn{2}{|l|}{More specific info and options are available
3442     using -H$<$format-type$>$, e.g. -Hpdb}
3443     \end{longtable}
3444    
3445     The specific programs {\tt xyz2md} and {\tt pdb2md} are identical
3446     to {\tt atom2md}, but they use a specific input format and do not
3447     expect the the input specifier on the command line.
3448    
3449     \section{\label{oopseSec:SimpleBuilder}SimpleBuilder}
3450    
3451     {\tt SimpleBuilder} creates simple lattice structures. It requires an
3452     initial, but skeletal OOPSE file to specify the components that are to
3453     be placed on the lattice. The total number of placed molecules will
3454     be shown at the top of the configuration file that is generated, and
3455     that number may not match the original meta-data file, so a new
3456     meta-data file is also generated which matches the lattice structure.
3457    
3458     The options available for SimpleBuilder are as follows:
3459     \begin{longtable}[c]{|EFG|}
3460     \caption{SimpleBuilder Command-line Options}
3461     \\ \hline
3462     {\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline
3463     \endhead
3464     \hline
3465     \endfoot
3466     -h& {\tt -{}-help} & Print help and exit\\
3467     -V& {\tt -{}-version} & Print version and exit\\
3468     -o& {\tt -{}-output=STRING} & Output file name\\
3469     & {\tt -{}-density=DOUBLE} & density ($\mathrm{g~cm}^{-3}$)\\
3470     & {\tt -{}-nx=INT} & number of unit cells in x\\
3471     & {\tt -{}-ny=INT} & number of unit cells in y\\
3472     & {\tt -{}-nz=INT} & number of unit cells in z
3473     \end{longtable}
3474    
3475 xsun 3399 \section{\label{oopseSec:Hydro}Hydro}
3476 gezelter 3403 {\tt Hydro} generates resistance tensor ({\tt .diff}) files which are
3477     required when using the Langevin integrator using complex rigid
3478     bodies. {\tt Hydro} supports two approximate models: the {\tt
3479     BeadModel} and {\tt RoughShell}. Additionally, {\tt Hydro} can
3480     generate resistance tensor files using analytic solutions for simple
3481     shapes. To generate a {\tt }.diff file, a meta-data file is needed as
3482     the input file. Since the resistance tensor depends on these
3483     quantities, the {\tt viscosity} of the solvent and the temperature
3484     ({\tt targetTemp}) of the system must be defined in meta-data file. If
3485     the approximate model in use is the {\tt RoughShell} model the {\tt
3486     beadSize} (the diameter of the small beads used to approximate the
3487     surface of the body) must also be specified.
3488 xsun 3399
3489     The options available for Hydro are as follows:
3490     \begin{longtable}[c]{|EFG|}
3491     \caption{Hydro Command-line Options}
3492     \\ \hline
3493     {\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline
3494     \endhead
3495     \hline
3496     \endfoot
3497     -h& {\tt -{}-help} & Print help and exit\\
3498     -V& {\tt -{}-version} & Print version and exit\\
3499     -i& {\tt -{}-input=filename} & input MetaData (md) file\\
3500     -o& {\tt -{}-output=STRING} & Output file name\\
3501 gezelter 3403 & {\tt -{}-model=STRING} & hydrodynamics model (supports both
3502     {\tt RoughShell} and {\tt BeadModel})\\
3503 xsun 3399 -b& {\tt -{}-beads} & generate the beads only,
3504 gezelter 3403 hydrodynamic calculations will not be performed (default=off)\\
3505 xsun 3399 \end{longtable}
3506    
3507    
3508 gezelter 3395 \chapter{\label{oopseSec:parallelization} Parallel Simulation Implementation}
3509    
3510     Although processor power is continually improving, it is still
3511     unreasonable to simulate systems of more than 10,000 atoms on a single
3512     processor. To facilitate study of larger system sizes or smaller
3513     systems for longer time scales, parallel methods were developed to
3514     allow multiple CPU's to share the simulation workload. Three general
3515     categories of parallel decomposition methods have been developed:
3516     these are the atomic,\cite{Fox88} spatial~\cite{plimpton95} and
3517     force~\cite{Paradyn} decomposition methods.
3518    
3519     Algorithmically simplest of the three methods is atomic decomposition,
3520     where $N$ particles in a simulation are split among $P$ processors for
3521     the duration of the simulation. Computational cost scales as an
3522     optimal $\mathcal{O}(N/P)$ for atomic decomposition. Unfortunately, all
3523     processors must communicate positions and forces with all other
3524     processors at every force evaluation, leading the communication costs
3525     to scale as an unfavorable $\mathcal{O}(N)$, \emph{independent of the
3526     number of processors}. This communication bottleneck led to the
3527     development of spatial and force decomposition methods, in which
3528     communication among processors scales much more favorably. Spatial or
3529     domain decomposition divides the physical spatial domain into 3D boxes
3530     in which each processor is responsible for calculation of forces and
3531     positions of particles located in its box. Particles are reassigned to
3532     different processors as they move through simulation space. To
3533     calculate forces on a given particle, a processor must simply know the
3534     positions of particles within some cutoff radius located on nearby
3535     processors rather than the positions of particles on all
3536     processors. Both communication between processors and computation
3537     scale as $\mathcal{O}(N/P)$ in the spatial method. However, spatial
3538     decomposition adds algorithmic complexity to the simulation code and
3539     is not very efficient for small $N$, since the overall communication
3540     scales as the surface to volume ratio $\mathcal{O}(N/P)^{2/3}$ in
3541     three dimensions.
3542    
3543     The parallelization method used in {\sc oopse} is the force
3544     decomposition method.\cite{hendrickson:95} Force decomposition assigns
3545     particles to processors based on a block decomposition of the force
3546     matrix. Processors are split into an optimally square grid forming row
3547     and column processor groups. Forces are calculated on particles in a
3548     given row by particles located in that processor's column
3549     assignment. One deviation from the algorithm described by Hendrickson
3550     {\it et al.} is the use of column ordering based on the row indexes
3551     preventing the need for a transpose operation necessitating a second
3552     communication step when gathering the final force components. Force
3553     decomposition is less complex to implement than the spatial method but
3554     still scales computationally as $\mathcal{O}(N/P)$ and scales as
3555     $\mathcal{O}(N/\sqrt{P})$ in communication cost. Plimpton has also
3556     found that force decompositions scale more favorably than spatial
3557     decompositions for systems up to 10,000 atoms and favorably compete
3558     with spatial methods up to 100,000 atoms.\cite{plimpton95}
3559    
3560     \chapter{\label{oopseSec:conclusion}Conclusion}
3561    
3562     We have presented a new parallel simulation program called {\sc
3563     oopse}. This program offers some novel capabilities, but mostly makes
3564     available a library of modern object-oriented code for the scientific
3565     community to use freely. Notably, {\sc oopse} can handle symplectic
3566     integration of objects (atoms and rigid bodies) which have
3567     orientational degrees of freedom. It can also work with transition
3568     metal force fields and point-dipoles. It is capable of scaling across
3569     multiple processors through the use of force based decomposition. It
3570     also implements several advanced integrators allowing the end user
3571     control over temperature and pressure. In addition, it is capable of
3572     integrating constrained dynamics through both the {\sc rattle}
3573     algorithm and the $z$-constraint method.
3574    
3575     We encourage other researchers to download and apply this program to
3576     their own research problems. By making the code available, we hope to
3577     encourage other researchers to contribute their own code and make it a
3578     more powerful package for everyone in the molecular dynamics community
3579     to use. All source code for {\sc oopse} is available for download at
3580     {\tt http://oopse.org}.
3581    
3582     \chapter{Acknowledgments}
3583    
3584     Development of {\sc oopse} was funded by a New Faculty Award from the
3585     Camille and Henry Dreyfus Foundation and by the National Science
3586     Foundation under grant CHE-0134881. Computation time was provided by
3587     the Notre Dame Bunch-of-Boxes (B.o.B) computer cluster under NSF grant
3588     DMR-0079647.
3589    
3590    
3591     \bibliographystyle{jcc}
3592     \bibliography{oopseDoc}
3593    
3594     \end{document}