ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/oopsePaper/oopsePaper.tex
Revision: 1168
Committed: Wed May 12 19:32:47 2004 UTC (20 years, 1 month ago) by mmeineke
Content type: application/x-tex
File size: 89020 byte(s)
Log Message:
added more revisions to the paper

File Contents

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