ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/openmdDocs/openmdDoc.tex
Revision: 3607
Committed: Wed Jun 16 15:38:45 2010 UTC (14 years ago) by gezelter
Content type: application/x-tex
File size: 161854 byte(s)
Log Message:
new version of docs for new program

File Contents

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