ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/mattDisertation/oopse.tex
Revision: 1054
Committed: Mon Feb 16 20:35:58 2004 UTC (20 years, 5 months ago) by mmeineke
Content type: application/x-tex
File size: 57434 byte(s)
Log Message:
started some cleanup on oopse. added a conclusion, finished the foreword, and found all the undefined citations

File Contents

# Content
1 \chapter{\label{chapt:oopse}OOPSE: AN OPEN SOURCE OBJECT-ORIENTED PARALLEL SIMULATION ENGINE FOR MOLECULAR DYNAMICS}
2
3
4
5 %% \begin{abstract}
6 %% We detail the capabilities of a new open-source parallel simulation
7 %% package ({\sc oopse}) that can perform molecular dynamics simulations
8 %% on atom types that are missing from other popular packages. In
9 %% particular, {\sc oopse} is capable of performing orientational
10 %% dynamics on dipolar systems, and it can handle simulations of metallic
11 %% systems using the embedded atom method ({\sc eam}).
12 %% \end{abstract}
13
14 \lstset{language=C,frame=TB,basicstyle=\small,basicstyle=\ttfamily, %
15 xleftmargin=0.5in, xrightmargin=0.5in,captionpos=b, %
16 abovecaptionskip=0.5cm, belowcaptionskip=0.5cm}
17
18 \section{\label{oopseSec:foreword}Foreword}
19
20 In this chapter, I present and detail the capabilities of the open
21 source simulation package {\sc oopse}. It is important to note, that a
22 simulation package of this size and scope would not have been possible
23 without the collaborative efforts of my colleagues: Charles
24 F.~Vardeman II, Teng Lin, Christopher J.~Fennell and J.~Daniel
25 Gezelter. Although my contributions to {\sc oopse} are significant,
26 consideration of my work apart from the others, would not give a
27 complete description to the package's capabilities. As such, all
28 contributions to {\sc oopse} to date are presented in this chapter.
29
30 Charles Vardeman is responsible for the parallelization of {\sc oopse}
31 (Sec.~\ref{oopseSec:parallelization}) as well as the inclusion of the
32 embedded-atom potential (Sec.~\ref{oopseSec:eam}). Teng Lin's
33 contributions include refinement of the periodic boundary conditions
34 (Sec.~\ref{oopseSec:pbc}), the z-constraint method
35 (Sec.~\ref{oopseSec:zcons}), refinement of the property analysis
36 programs (Sec.~\ref{oopseSec:props}), and development in the extended
37 state integrators (Sec.~\ref{oopseSec:noseHooverThermo}). Christopher
38 Fennell worked on the symplectic integrator
39 (Sec.~\ref{oopseSec:integrate}) and the refinement of the {\sc ssd}
40 water model (Sec.~\ref{oopseSec:SSD}). Daniel Gezelter lent his
41 talents in the development of the extended system integrators
42 (Sec.~\ref{oopseSec:noseHooverThermo}) as well as giving general
43 direction and oversight to the entire project. My responsibilities
44 covered the creation and specification of {\sc bass}
45 (Sec.~\ref{oopseSec:IOfiles}), the original development of the single
46 processor version of {\sc oopse}, contributions to the extended state
47 integrators (Sec.~\ref{oopseSec:noseHooverThermo}), the implementation
48 of the Lennard-Jones (Sec.~\ref{sec:LJPot}) and {\sc duff}
49 (Sec.~\ref{oopseSec:DUFF}) force fields, and initial implementation of
50 the property analysis (Sec.~\ref{oopseSec:props}) and system
51 initialization (Sec.~\ref{oopseSec:initCoords}) utility programs.
52
53 \section{\label{sec:intro}Introduction}
54
55 When choosing to simulate a chemical system with molecular dynamics,
56 there are a variety of options available. For simple systems, one
57 might consider writing one's own programming code. However, as systems
58 grow larger and more complex, building and maintaining code for the
59 simulations becomes a time consuming task. In such cases it is usually
60 more convenient for a researcher to turn to pre-existing simulation
61 packages. These packages, such as {\sc amber}\cite{pearlman:1995} and
62 {\sc charmm}\cite{Brooks83}, provide powerful tools for researchers to
63 conduct simulations of their systems without spending their time
64 developing a code base to conduct their research. This then frees them
65 to perhaps explore experimental analogues to their models.
66
67 Despite their utility, problems with these packages arise when
68 researchers try to develop techniques or energetic models that the
69 code was not originally designed to do. Examples of uncommonly
70 implemented techniques and energetics include; dipole-dipole
71 interactions, rigid body dynamics, and metallic embedded
72 potentials. When faced with these obstacles, a researcher must either
73 develop their own code or license and extend one of the commercial
74 packages. What we have elected to do, is develop a package of
75 simulation code capable of implementing the types of models upon which
76 our research is based.
77
78 Having written {\sc oopse} we are implementing the concept of Open
79 Source development, and releasing our source code into the public
80 domain. It is our intent that by doing so, other researchers might
81 benefit from our work, and add their own contributions to the
82 package. The license under which {\sc oopse} is distributed allows any
83 researcher to download and modify the source code for their own
84 use. In this way further development of {\sc oopse} is not limited to
85 only the models of interest to ourselves, but also those of the
86 community of scientists who contribute back to the project.
87
88 We have structured this chapter to first discuss the empirical energy
89 functions that {\sc oopse } implements in
90 Sec.~\ref{oopseSec:empiricalEnergy}. Following that is a discussion of
91 the various input and output files associated with the package
92 (Sec.~\ref{oopseSec:IOfiles}). In Sec.~\ref{oopseSec:mechanics}
93 elucidates the various Molecular Dynamics algorithms {\sc oopse}
94 implements in the integration of the Newtonian equations of
95 motion. Basic analysis of the trajectories obtained from the
96 simulation is discussed in Sec.~\ref{oopseSec:props}. Program design
97 considerations as well as the software distribution license is
98 presented in Sec.~\ref{oopseSec:design}. And lastly,
99 Sec.~\ref{oopseSec:conclusion} concludes the chapter.
100
101 \section{\label{oopseSec:empiricalEnergy}The Empirical Energy Functions}
102
103 \subsection{\label{oopseSec:atomsMolecules}Atoms, Molecules and Rigid Bodies}
104
105 The basic unit of an {\sc oopse} simulation is the atom. The
106 parameters describing the atom are generalized to make the atom as
107 flexible a representation as possible. They may represent specific
108 atoms of an element, or be used for collections of atoms such as
109 methyl and carbonyl groups. The atoms are also capable of having
110 directional components associated with them (\emph{e.g.}~permanent
111 dipoles). Charges, permanent dipoles, and Lennard-Jones parameters for
112 a given atom type are set in the force field parameter files
113
114 \begin{lstlisting}[float,caption={[Specifier for molecules and atoms] A sample specification of an Ar molecule},label=sch:AtmMole]
115 molecule{
116 name = "Ar";
117 nAtoms = 1;
118 atom[0]{
119 type="Ar";
120 position( 0.0, 0.0, 0.0 );
121 }
122 }
123 \end{lstlisting}
124
125
126 Atoms can be collected into secondary structures such as rigid bodies
127 or molecules. The molecule is a way for {\sc oopse} to keep track of
128 the atoms in a simulation in logical manner. Molecular units store the
129 identities of all the atoms and rigid bodies associated with
130 themselves, and are responsible for the evaluation of their own
131 internal interactions (\emph{i.e.}~bonds, bends, and torsions). Scheme
132 \ref{sch:AtmMole} shows how one creates a molecule in a
133 \texttt{.mdl} file. The position of the atoms given in the
134 declaration are relative to the origin of the molecule, and is used
135 when creating a system containing the molecule.
136
137 As stated previously, one of the features that sets {\sc oopse} apart
138 from most of the current molecular simulation packages is the ability
139 to handle rigid body dynamics. Rigid bodies are non-spherical
140 particles or collections of particles that have a constant internal
141 potential and move collectively.\cite{Goldstein01} They are not
142 included in most simulation packages because of the requirement to
143 propagate the orientational degrees of freedom. Until recently,
144 integrators which propagate orientational motion have been lacking.
145
146 Moving a rigid body involves determination of both the force and
147 torque applied by the surroundings, which directly affect the
148 translational and rotational motion in turn. In order to accumulate
149 the total force on a rigid body, the external forces and torques must
150 first be calculated for all the internal particles. The total force on
151 the rigid body is simply the sum of these external forces.
152 Accumulation of the total torque on the rigid body is more complex
153 than the force in that it is the torque applied on the center of mass
154 that dictates rotational motion. The torque on rigid body {\it i} is
155 \begin{equation}
156 \boldsymbol{\tau}_i=
157 \sum_{a}(\mathbf{r}_{ia}-\mathbf{r}_i)\times \mathbf{f}_{ia}
158 + \boldsymbol{\tau}_{ia},
159 \label{eq:torqueAccumulate}
160 \end{equation}
161 where $\boldsymbol{\tau}_i$ and $\mathbf{r}_i$ are the torque on and
162 position of the center of mass respectively, while $\mathbf{f}_{ia}$,
163 $\mathbf{r}_{ia}$, and $\boldsymbol{\tau}_{ia}$ are the force on,
164 position of, and torque on the component particles of the rigid body.
165
166 The summation of the total torque is done in the body fixed axis of
167 the rigid body. In order to move between the space fixed and body
168 fixed coordinate axes, parameters describing the orientation must be
169 maintained for each rigid body. At a minimum, the rotation matrix
170 (\textbf{A}) can be described by the three Euler angles ($\phi,
171 \theta,$ and $\psi$), where the elements of \textbf{A} are composed of
172 trigonometric operations involving $\phi, \theta,$ and
173 $\psi$.\cite{Goldstein01} In order to avoid numerical instabilities
174 inherent in using the Euler angles, the four parameter ``quaternion''
175 scheme is often used. The elements of \textbf{A} can be expressed as
176 arithmetic operations involving the four quaternions ($q_0, q_1, q_2,$
177 and $q_3$).\cite{allen87:csl} Use of quaternions also leads to
178 performance enhancements, particularly for very small
179 systems.\cite{Evans77}
180
181 {\sc oopse} utilizes a relatively new scheme that propagates the
182 entire nine parameter rotation matrix internally. Further discussion
183 on this choice can be found in Sec.~\ref{oopseSec:integrate}. An example
184 definition of a rigid body can be seen in Scheme
185 \ref{sch:rigidBody}. The positions in the atom definitions are the
186 placements of the atoms relative to the origin of the rigid body,
187 which itself has a position relative to the origin of the molecule.
188
189 \begin{lstlisting}[float,caption={[Defining rigid bodies]A sample definition of a rigid body},label={sch:rigidBody}]
190 molecule{
191 name = "TIP3P_water";
192 nRigidBodies = 1;
193 rigidBody[0]{
194 nAtoms = 3;
195 atom[0]{
196 type = "O_TIP3P";
197 position( 0.0, 0.0, -0.06556 );
198 }
199 atom[1]{
200 type = "H_TIP3P";
201 position( 0.0, 0.75695, 0.52032 );
202 }
203 atom[2]{
204 type = "H_TIP3P";
205 position( 0.0, -0.75695, 0.52032 );
206 }
207 position( 0.0, 0.0, 0.0 );
208 orientation( 0.0, 0.0, 1.0 );
209 }
210 }
211 \end{lstlisting}
212
213 \subsection{\label{sec:LJPot}The Lennard Jones Force Field}
214
215 The most basic force field implemented in {\sc oopse} is the
216 Lennard-Jones force field, which mimics the van der Waals interaction at
217 long distances, and uses an empirical repulsion at short
218 distances. The Lennard-Jones potential is given by:
219 \begin{equation}
220 V_{\text{LJ}}(r_{ij}) =
221 4\epsilon_{ij} \biggl[
222 \biggl(\frac{\sigma_{ij}}{r_{ij}}\biggr)^{12}
223 - \biggl(\frac{\sigma_{ij}}{r_{ij}}\biggr)^{6}
224 \biggr]
225 \label{eq:lennardJonesPot}
226 \end{equation}
227 Where $r_{ij}$ is the distance between particles $i$ and $j$,
228 $\sigma_{ij}$ scales the length of the interaction, and
229 $\epsilon_{ij}$ scales the well depth of the potential. Scheme
230 \ref{sch:LJFF} gives and example \texttt{.bass} file that
231 sets up a system of 108 Ar particles to be simulated using the
232 Lennard-Jones force field.
233
234 \begin{lstlisting}[float,caption={[Invocation of the Lennard-Jones force field] A sample system using the Lennard-Jones force field.},label={sch:LJFF}]
235
236 /*
237 * The Ar molecule is specified
238 * external to the.bass file
239 */
240
241 #include "argon.mdl"
242
243 nComponents = 1;
244 component{
245 type = "Ar";
246 nMol = 108;
247 }
248
249 /*
250 * The initial configuration is generated
251 * before the simulation is invoked.
252 */
253
254 initialConfig = "./argon.init";
255
256 forceField = "LJ";
257 \end{lstlisting}
258
259 Because this potential is calculated between all pairs, the force
260 evaluation can become computationally expensive for large systems. To
261 keep the pair evaluations to a manageable number, {\sc oopse} employs
262 a cut-off radius.\cite{allen87:csl} The cutoff radius is set to be
263 $2.5\sigma_{ii}$, where $\sigma_{ii}$ is the largest Lennard-Jones
264 length parameter present in the simulation. Truncating the calculation
265 at $r_{\text{cut}}$ introduces a discontinuity into the potential
266 energy. To offset this discontinuity, the energy value at
267 $r_{\text{cut}}$ is subtracted from the potential. This causes the
268 potential to go to zero smoothly at the cut-off radius.
269
270 Interactions between dissimilar particles requires the generation of
271 cross term parameters for $\sigma$ and $\epsilon$. These are
272 calculated through the Lorentz-Berthelot mixing
273 rules:\cite{allen87:csl}
274 \begin{equation}
275 \sigma_{ij} = \frac{1}{2}[\sigma_{ii} + \sigma_{jj}]
276 \label{eq:sigmaMix}
277 \end{equation}
278 and
279 \begin{equation}
280 \epsilon_{ij} = \sqrt{\epsilon_{ii} \epsilon_{jj}}
281 \label{eq:epsilonMix}
282 \end{equation}
283
284
285
286 \subsection{\label{oopseSec:DUFF}Dipolar Unified-Atom Force Field}
287
288 The dipolar unified-atom force field ({\sc duff}) was developed to
289 simulate lipid bilayers. The simulations require a model capable of
290 forming bilayers, while still being sufficiently computationally
291 efficient to allow large systems ($\sim$100's of phospholipids,
292 $\sim$1000's of waters) to be simulated for long times
293 ($\sim$10's of nanoseconds).
294
295 With this goal in mind, {\sc duff} has no point
296 charges. Charge-neutral distributions were replaced with dipoles,
297 while most atoms and groups of atoms were reduced to Lennard-Jones
298 interaction sites. This simplification cuts the length scale of long
299 range interactions from $\frac{1}{r}$ to $\frac{1}{r^3}$, allowing us
300 to avoid the computationally expensive Ewald sum. Instead, we can use
301 neighbor-lists, reaction field, and cutoff radii for the dipolar
302 interactions.
303
304 As an example, lipid head-groups in {\sc duff} are represented as
305 point dipole interaction sites. By placing a dipole of 20.6~Debye at
306 the head group center of mass, our model mimics the head group of
307 phosphatidylcholine.\cite{Cevc87} Additionally, a large Lennard-Jones
308 site is located at the pseudoatom's center of mass. The model is
309 illustrated by the dark grey atom in Fig.~\ref{oopseFig:lipidModel}. The
310 water model we use to complement the dipoles of the lipids is our
311 reparameterization of the soft sticky dipole (SSD) model of Ichiye
312 \emph{et al.}\cite{liu96:new_model}
313
314 \begin{figure}
315 \centering
316 \includegraphics[width=\linewidth]{lipidModel.eps}
317 \caption{A representation of the lipid model. $\phi$ is the torsion angle, $\theta$ %
318 is the bend angle, $\mu$ is the dipole moment of the head group, and n
319 is the chain length.}
320 \label{oopseFig:lipidModel}
321 \end{figure}
322
323 We have used a set of scalable parameters to model the alkyl groups
324 with Lennard-Jones sites. For this, we have borrowed parameters from
325 the TraPPE force field of Siepmann
326 \emph{et al}.\cite{Siepmann1998} TraPPE is a unified-atom
327 representation of n-alkanes, which is parametrized against phase
328 equilibria using Gibbs ensemble Monte Carlo simulation
329 techniques.\cite{Siepmann1998} One of the advantages of TraPPE is that
330 it generalizes the types of atoms in an alkyl chain to keep the number
331 of pseudoatoms to a minimum; the parameters for an atom such as
332 $\text{CH}_2$ do not change depending on what species are bonded to
333 it.
334
335 TraPPE also constrains all bonds to be of fixed length. Typically,
336 bond vibrations are the fastest motions in a molecular dynamic
337 simulation. Small time steps between force evaluations must be used to
338 ensure adequate sampling of the bond potential to ensure conservation
339 of energy. By constraining the bond lengths, larger time steps may be
340 used when integrating the equations of motion. A simulation using {\sc
341 duff} is illustrated in Scheme \ref{sch:DUFF}.
342
343 \begin{lstlisting}[float,caption={[Invocation of {\sc duff}]Sample \texttt{.bass} file showing a simulation utilizing {\sc duff}},label={sch:DUFF}]
344
345 #include "water.mdl"
346 #include "lipid.mdl"
347
348 nComponents = 2;
349 component{
350 type = "simpleLipid_16";
351 nMol = 60;
352 }
353
354 component{
355 type = "SSD_water";
356 nMol = 1936;
357 }
358
359 initialConfig = "bilayer.init";
360
361 forceField = "DUFF";
362
363 \end{lstlisting}
364
365 \subsection{\label{oopseSec:energyFunctions}{\sc duff} Energy Functions}
366
367 The total potential energy function in {\sc duff} is
368 \begin{equation}
369 V = \sum^{N}_{I=1} V^{I}_{\text{Internal}}
370 + \sum^{N-1}_{I=1} \sum_{J>I} V^{IJ}_{\text{Cross}}
371 \label{eq:totalPotential}
372 \end{equation}
373 Where $V^{I}_{\text{Internal}}$ is the internal potential of molecule $I$:
374 \begin{equation}
375 V^{I}_{\text{Internal}} =
376 \sum_{\theta_{ijk} \in I} V_{\text{bend}}(\theta_{ijk})
377 + \sum_{\phi_{ijkl} \in I} V_{\text{torsion}}(\phi_{ijkl})
378 + \sum_{i \in I} \sum_{(j>i+4) \in I}
379 \biggl[ V_{\text{LJ}}(r_{ij}) + V_{\text{dipole}}
380 (\mathbf{r}_{ij},\boldsymbol{\Omega}_{i},\boldsymbol{\Omega}_{j})
381 \biggr]
382 \label{eq:internalPotential}
383 \end{equation}
384 Here $V_{\text{bend}}$ is the bend potential for all 1, 3 bonded pairs
385 within the molecule $I$, and $V_{\text{torsion}}$ is the torsion potential
386 for all 1, 4 bonded pairs. The pairwise portions of the internal
387 potential are excluded for pairs that are closer than three bonds,
388 i.e.~atom pairs farther away than a torsion are included in the
389 pair-wise loop.
390
391
392 The bend potential of a molecule is represented by the following function:
393 \begin{equation}
394 V_{\text{bend}}(\theta_{ijk}) = k_{\theta}( \theta_{ijk} - \theta_0 )^2 \label{eq:bendPot}
395 \end{equation}
396 Where $\theta_{ijk}$ is the angle defined by atoms $i$, $j$, and $k$
397 (see Fig.~\ref{oopseFig:lipidModel}), $\theta_0$ is the equilibrium
398 bond angle, and $k_{\theta}$ is the force constant which determines the
399 strength of the harmonic bend. The parameters for $k_{\theta}$ and
400 $\theta_0$ are borrowed from those in TraPPE.\cite{Siepmann1998}
401
402 The torsion potential and parameters are also borrowed from TraPPE. It is
403 of the form:
404 \begin{equation}
405 V_{\text{torsion}}(\phi) = c_1[1 + \cos \phi]
406 + c_2[1 + \cos(2\phi)]
407 + c_3[1 + \cos(3\phi)]
408 \label{eq:origTorsionPot}
409 \end{equation}
410 Here $\phi$ is the angle defined by four bonded neighbors $i$,
411 $j$, $k$, and $l$ (again, see Fig.~\ref{oopseFig:lipidModel}). For
412 computational efficiency, the torsion potential has been recast after
413 the method of {\sc charmm},\cite{Brooks83} in which the angle series is
414 converted to a power series of the form:
415 \begin{equation}
416 V_{\text{torsion}}(\phi) =
417 k_3 \cos^3 \phi + k_2 \cos^2 \phi + k_1 \cos \phi + k_0
418 \label{eq:torsionPot}
419 \end{equation}
420 Where:
421 \begin{align*}
422 k_0 &= c_1 + c_3 \\
423 k_1 &= c_1 - 3c_3 \\
424 k_2 &= 2 c_2 \\
425 k_3 &= 4c_3
426 \end{align*}
427 By recasting the potential as a power series, repeated trigonometric
428 evaluations are avoided during the calculation of the potential energy.
429
430
431 The cross potential between molecules $I$ and $J$, $V^{IJ}_{\text{Cross}}$, is
432 as follows:
433 \begin{equation}
434 V^{IJ}_{\text{Cross}} =
435 \sum_{i \in I} \sum_{j \in J}
436 \biggl[ V_{\text{LJ}}(r_{ij}) + V_{\text{dipole}}
437 (\mathbf{r}_{ij},\boldsymbol{\Omega}_{i},\boldsymbol{\Omega}_{j})
438 + V_{\text{sticky}}
439 (\mathbf{r}_{ij},\boldsymbol{\Omega}_{i},\boldsymbol{\Omega}_{j})
440 \biggr]
441 \label{eq:crossPotentail}
442 \end{equation}
443 Where $V_{\text{LJ}}$ is the Lennard Jones potential,
444 $V_{\text{dipole}}$ is the dipole dipole potential, and
445 $V_{\text{sticky}}$ is the sticky potential defined by the SSD model
446 (Sec.~\ref{oopseSec:SSD}). Note that not all atom types include all
447 interactions.
448
449 The dipole-dipole potential has the following form:
450 \begin{equation}
451 V_{\text{dipole}}(\mathbf{r}_{ij},\boldsymbol{\Omega}_{i},
452 \boldsymbol{\Omega}_{j}) = \frac{|\mu_i||\mu_j|}{4\pi\epsilon_{0}r_{ij}^{3}} \biggl[
453 \boldsymbol{\hat{u}}_{i} \cdot \boldsymbol{\hat{u}}_{j}
454 -
455 \frac{3(\boldsymbol{\hat{u}}_i \cdot \mathbf{r}_{ij}) %
456 (\boldsymbol{\hat{u}}_j \cdot \mathbf{r}_{ij}) }
457 {r^{2}_{ij}} \biggr]
458 \label{eq:dipolePot}
459 \end{equation}
460 Here $\mathbf{r}_{ij}$ is the vector starting at atom $i$ pointing
461 towards $j$, and $\boldsymbol{\Omega}_i$ and $\boldsymbol{\Omega}_j$
462 are the orientational degrees of freedom for atoms $i$ and $j$
463 respectively. $|\mu_i|$ is the magnitude of the dipole moment of atom
464 $i$, $\boldsymbol{\hat{u}}_i$ is the standard unit orientation vector
465 of $\boldsymbol{\Omega}_i$, and $\boldsymbol{\hat{r}}_{ij}$ is the
466 unit vector pointing along $\mathbf{r}_{ij}$
467 ($\boldsymbol{\hat{r}}_{ij}=\mathbf{r}_{ij}/|\mathbf{r}_{ij}|$).
468
469
470 \subsubsection{\label{oopseSec:SSD}The {\sc duff} Water Models: SSD/E and SSD/RF}
471
472 In the interest of computational efficiency, the default solvent used
473 by {\sc oopse} is the extended Soft Sticky Dipole (SSD/E) water
474 model.\cite{Gezelter04} The original SSD was developed by Ichiye
475 \emph{et al.}\cite{liu96:new_model} as a modified form of the hard-sphere
476 water model proposed by Bratko, Blum, and
477 Luzar.\cite{Bratko85,Bratko95} It consists of a single point dipole
478 with a Lennard-Jones core and a sticky potential that directs the
479 particles to assume the proper hydrogen bond orientation in the first
480 solvation shell. Thus, the interaction between two SSD water molecules
481 \emph{i} and \emph{j} is given by the potential
482 \begin{equation}
483 V_{ij} =
484 V_{ij}^{LJ} (r_{ij})\ + V_{ij}^{dp}
485 (\mathbf{r}_{ij},\boldsymbol{\Omega}_i,\boldsymbol{\Omega}_j)\ +
486 V_{ij}^{sp}
487 (\mathbf{r}_{ij},\boldsymbol{\Omega}_i,\boldsymbol{\Omega}_j),
488 \label{eq:ssdPot}
489 \end{equation}
490 where the $\mathbf{r}_{ij}$ is the position vector between molecules
491 \emph{i} and \emph{j} with magnitude equal to the distance $r_{ij}$, and
492 $\boldsymbol{\Omega}_i$ and $\boldsymbol{\Omega}_j$ represent the
493 orientations of the respective molecules. The Lennard-Jones and dipole
494 parts of the potential are given by equations \ref{eq:lennardJonesPot}
495 and \ref{eq:dipolePot} respectively. The sticky part is described by
496 the following,
497 \begin{equation}
498 u_{ij}^{sp}(\mathbf{r}_{ij},\boldsymbol{\Omega}_i,\boldsymbol{\Omega}_j)=
499 \frac{\nu_0}{2}[s(r_{ij})w(\mathbf{r}_{ij},
500 \boldsymbol{\Omega}_i,\boldsymbol{\Omega}_j) +
501 s^\prime(r_{ij})w^\prime(\mathbf{r}_{ij},
502 \boldsymbol{\Omega}_i,\boldsymbol{\Omega}_j)]\ ,
503 \label{eq:stickyPot}
504 \end{equation}
505 where $\nu_0$ is a strength parameter for the sticky potential, and
506 $s$ and $s^\prime$ are cubic switching functions which turn off the
507 sticky interaction beyond the first solvation shell. The $w$ function
508 can be thought of as an attractive potential with tetrahedral
509 geometry:
510 \begin{equation}
511 w({\bf r}_{ij},{\bf \Omega}_i,{\bf \Omega}_j)=
512 \sin\theta_{ij}\sin2\theta_{ij}\cos2\phi_{ij},
513 \label{eq:stickyW}
514 \end{equation}
515 while the $w^\prime$ function counters the normal aligned and
516 anti-aligned structures favored by point dipoles:
517 \begin{equation}
518 w^\prime({\bf r}_{ij},{\bf \Omega}_i,{\bf \Omega}_j)=
519 (\cos\theta_{ij}-0.6)^2(\cos\theta_{ij}+0.8)^2-w^0,
520 \label{eq:stickyWprime}
521 \end{equation}
522 It should be noted that $w$ is proportional to the sum of the $Y_3^2$
523 and $Y_3^{-2}$ spherical harmonics (a linear combination which
524 enhances the tetrahedral geometry for hydrogen bonded structures),
525 while $w^\prime$ is a purely empirical function. A more detailed
526 description of the functional parts and variables in this potential
527 can be found in the original SSD
528 articles.\cite{liu96:new_model,liu96:monte_carlo,chandra99:ssd_md,Ichiye03}
529
530 Since SSD is a single-point {\it dipolar} model, the force
531 calculations are simplified significantly relative to the standard
532 {\it charged} multi-point models. In the original Monte Carlo
533 simulations using this model, Ichiye {\it et al.} reported that using
534 SSD decreased computer time by a factor of 6-7 compared to other
535 models.\cite{liu96:new_model} What is most impressive is that these savings
536 did not come at the expense of accurate depiction of the liquid state
537 properties. Indeed, SSD maintains reasonable agreement with the Soper
538 diffraction data for the structural features of liquid
539 water.\cite{Soper86,liu96:new_model} Additionally, the dynamical properties
540 exhibited by SSD agree with experiment better than those of more
541 computationally expensive models (like TIP3P and
542 SPC/E).\cite{chandra99:ssd_md} The combination of speed and accurate depiction
543 of solvent properties makes SSD a very attractive model for the
544 simulation of large scale biochemical simulations.
545
546 Recent constant pressure simulations revealed issues in the original
547 SSD model that led to lower than expected densities at all target
548 pressures.\cite{Ichiye03,Gezelter04} The default model in {\sc oopse}
549 is therefore SSD/E, a density corrected derivative of SSD that
550 exhibits improved liquid structure and transport behavior. If the use
551 of a reaction field long-range interaction correction is desired, it
552 is recommended that the parameters be modified to those of the SSD/RF
553 model. Solvent parameters can be easily modified in an accompanying
554 {\sc BASS} file as illustrated in the scheme below. A table of the
555 parameter values and the drawbacks and benefits of the different
556 density corrected SSD models can be found in
557 reference~\cite{Gezelter04}.
558
559 \begin{lstlisting}[float,caption={[A simulation of {\sc ssd} water]An example file showing a simulation including {\sc ssd} water.},label={sch:ssd}]
560
561 #include "water.mdl"
562
563 nComponents = 1;
564 component{
565 type = "SSD_water";
566 nMol = 864;
567 }
568
569 initialConfig = "liquidWater.init";
570
571 forceField = "DUFF";
572
573 /*
574 * The reactionField flag toggles reaction
575 * field corrections.
576 */
577
578 reactionField = false; // defaults to false
579 dielectric = 80.0; // dielectric for reaction field
580
581 /*
582 * The following two flags set the cutoff
583 * radius for the electrostatic forces
584 * as well as the skin thickness of the switching
585 * function.
586 */
587
588 electrostaticCutoffRadius = 9.2;
589 electrostaticSkinThickness = 1.38;
590
591 \end{lstlisting}
592
593
594 \subsection{\label{oopseSec:eam}Embedded Atom Method}
595
596 There are Molecular Dynamics packages which have the
597 capacity to simulate metallic systems, including some that have
598 parallel computational abilities\cite{plimpton93}. Potentials that
599 describe bonding transition metal
600 systems\cite{Finnis84,Ercolessi88,Chen90,Qi99,Ercolessi02} have a
601 attractive interaction which models ``Embedding''
602 a positively charged metal ion in the electron density due to the
603 free valance ``sea'' of electrons created by the surrounding atoms in
604 the system. A mostly repulsive pairwise part of the potential
605 describes the interaction of the positively charged metal core ions
606 with one another. A particular potential description called the
607 Embedded Atom Method\cite{Daw84,FBD86,johnson89,Lu97}({\sc eam}) that has
608 particularly wide adoption has been selected for inclusion in {\sc oopse}. A
609 good review of {\sc eam} and other metallic potential formulations was done
610 by Voter.\cite{voter}
611
612 The {\sc eam} potential has the form:
613 \begin{eqnarray}
614 V & = & \sum_{i} F_{i}\left[\rho_{i}\right] + \sum_{i} \sum_{j \neq i}
615 \phi_{ij}({\bf r}_{ij}) \\
616 \rho_{i} & = & \sum_{j \neq i} f_{j}({\bf r}_{ij})
617 \end{eqnarray}S
618
619 where $F_{i} $ is the embedding function that equates the energy required to embed a
620 positively-charged core ion $i$ into a linear superposition of
621 spherically averaged atomic electron densities given by
622 $\rho_{i}$. $\phi_{ij}$ is a primarily repulsive pairwise interaction
623 between atoms $i$ and $j$. In the original formulation of
624 {\sc eam}\cite{Daw84}, $\phi_{ij}$ was an entirely repulsive term, however
625 in later refinements to EAM have shown that non-uniqueness between $F$
626 and $\phi$ allow for more general forms for $\phi$.\cite{Daw89}
627 There is a cutoff distance, $r_{cut}$, which limits the
628 summations in the {\sc eam} equation to the few dozen atoms
629 surrounding atom $i$ for both the density $\rho$ and pairwise $\phi$
630 interactions. Foiles et al. fit EAM potentials for fcc metals Cu, Ag, Au, Ni, Pd, Pt and alloys of these metals\cite{FBD86}. These potential fits are in the DYNAMO 86 format and are included with {\sc oopse}.
631
632
633 \subsection{\label{oopseSec:pbc}Periodic Boundary Conditions}
634
635 \newcommand{\roundme}{\operatorname{round}}
636
637 \textit{Periodic boundary conditions} are widely used to simulate truly
638 macroscopic systems with a relatively small number of particles. The
639 simulation box is replicated throughout space to form an infinite lattice.
640 During the simulation, when a particle moves in the primary cell, its image in
641 other boxes move in exactly the same direction with exactly the same
642 orientation.Thus, as a particle leaves the primary cell, one of its images
643 will enter through the opposite face.If the simulation box is large enough to
644 avoid \textquotedblleft feeling\textquotedblright\ the symmetries of the
645 periodic lattice, surface effects can be ignored. Cubic, orthorhombic and
646 parallelepiped are the available periodic cells In OOPSE. We use a matrix to
647 describe the property of the simulation box. Therefore, both the size and
648 shape of the simulation box can be changed during the simulation. The
649 transformation from box space vector $\mathbf{s}$ to its corresponding real
650 space vector $\mathbf{r}$ is defined by
651 \begin{equation}
652 \mathbf{r}=\underline{\mathbf{H}}\cdot\mathbf{s}%
653 \end{equation}
654
655
656 where $H=(h_{x},h_{y},h_{z})$ is a transformation matrix made up of the three
657 box axis vectors. $h_{x},h_{y}$ and $h_{z}$ represent the three sides of the
658 simulation box respectively.
659
660 To find the minimum image of a vector $\mathbf{r}$, we convert the real vector
661 to its corresponding vector in box space first, \bigskip%
662 \begin{equation}
663 \mathbf{s}=\underline{\mathbf{H}}^{-1}\cdot\mathbf{r}%
664 \end{equation}
665 And then, each element of $\mathbf{s}$ is wrapped to lie between -0.5 to 0.5,
666 \begin{equation}
667 s_{i}^{\prime}=s_{i}-\roundme(s_{i})
668 \end{equation}
669 where
670
671 %
672
673 \begin{equation}
674 \roundme(x)=\left\{
675 \begin{array}{cc}%
676 \lfloor{x+0.5}\rfloor & \text{if \ }x\geqslant 0 \\
677 \lceil{x-0.5}\rceil & \text{otherwise}%
678 \end{array}
679 \right.
680 \end{equation}
681
682
683 For example, $\roundme(3.6)=4$,$\roundme(3.1)=3$, $\roundme(-3.6)=-4$, $\roundme(-3.1)=-3$.
684
685 Finally, we obtain the minimum image coordinates $\mathbf{r}^{\prime}$ by
686 transforming back to real space,%
687
688 \begin{equation}
689 \mathbf{r}^{\prime}=\underline{\mathbf{H}}^{-1}\cdot\mathbf{s}^{\prime}%
690 \end{equation}
691
692
693 \section{\label{oopseSec:IOfiles}Input and Output Files}
694
695 \subsection{{\sc bass} and Model Files}
696
697 Every {\sc oopse} simulation begins with a {\sc bass} file. {\sc bass}
698 (\underline{B}izarre \underline{A}tom \underline{S}imulation
699 \underline{S}yntax) is a script syntax that is parsed by {\sc oopse} at
700 runtime. The {\sc bass} file allows for the user to completely describe the
701 system they are to simulate, as well as tailor {\sc oopse}'s behavior during
702 the simulation. {\sc bass} files are denoted with the extension
703 \texttt{.bass}, an example file is shown in
704 Fig.~\ref{fig:bassExample}.
705
706 \begin{figure}
707 \centering
708 \framebox[\linewidth]{\rule{0cm}{0.75\linewidth}I'm a {\sc bass} file!}
709 \caption{Here is an example \texttt{.bass} file}
710 \label{fig:bassExample}
711 \end{figure}
712
713 Within the \texttt{.bass} file it is necessary to provide a complete
714 description of the molecule before it is actually placed in the
715 simulation. The {\sc bass} syntax was originally developed with this goal in
716 mind, and allows for the specification of all the atoms in a molecular
717 prototype, as well as any bonds, bends, or torsions. These
718 descriptions can become lengthy for complex molecules, and it would be
719 inconvenient to duplicate the simulation at the beginning of each {\sc bass}
720 script. Addressing this issue {\sc bass} allows for the inclusion of model
721 files at the top of a \texttt{.bass} file. These model files, denoted
722 with the \texttt{.mdl} extension, allow the user to describe a
723 molecular prototype once, then simply include it into each simulation
724 containing that molecule.
725
726 \subsection{\label{oopseSec:coordFiles}Coordinate Files}
727
728 The standard format for storage of a systems coordinates is a modified
729 xyz-file syntax, the exact details of which can be seen in
730 App.~\ref{appCoordFormat}. As all bonding and molecular information is
731 stored in the \texttt{.bass} and \texttt{.mdl} files, the coordinate
732 files are simply the complete set of coordinates for each atom at a
733 given simulation time.
734
735 There are three major files used by {\sc oopse} written in the coordinate
736 format, they are as follows: the initialization file, the simulation
737 trajectory file, and the final coordinates of the simulation. The
738 initialization file is necessary for {\sc oopse} to start the simulation
739 with the proper coordinates. It is typically denoted with the
740 extension \texttt{.init}. The trajectory file is created at the
741 beginning of the simulation, and is used to store snapshots of the
742 simulation at regular intervals. The first frame is a duplication of
743 the \texttt{.init} file, and each subsequent frame is appended to the
744 file at an interval specified in the \texttt{.bass} file. The
745 trajectory file is given the extension \texttt{.dump}. The final
746 coordinate file is the end of run or \texttt{.eor} file. The
747 \texttt{.eor} file stores the final configuration of the system for a
748 given simulation. The file is updated at the same time as the
749 \texttt{.dump} file. However, it only contains the most recent
750 frame. In this way, an \texttt{.eor} file may be used as the
751 initialization file to a second simulation in order to continue or
752 recover the previous simulation.
753
754 \subsection{\label{oopseSec:initCoords}Generation of Initial Coordinates}
755
756 As was stated in Sec.~\ref{oopseSec:coordFiles}, an initialization file
757 is needed to provide the starting coordinates for a simulation. The
758 {\sc oopse} package provides a program called \texttt{sysBuilder} to aid in
759 the creation of the \texttt{.init} file. \texttt{sysBuilder} is {\sc bass}
760 aware, and will recognize arguments and parameters in the
761 \texttt{.bass} file that would otherwise be ignored by the
762 simulation. The program itself is under continual development, and is
763 offered here as a helper tool only.
764
765 \subsection{The Statistics File}
766
767 The last output file generated by {\sc oopse} is the statistics file. This
768 file records such statistical quantities as the instantaneous
769 temperature, volume, pressure, etc. It is written out with the
770 frequency specified in the \texttt{.bass} file. The file allows the
771 user to observe the system variables as a function of simulation time
772 while the simulation is in progress. One useful function the
773 statistics file serves is to monitor the conserved quantity of a given
774 simulation ensemble, this allows the user to observe the stability of
775 the integrator. The statistics file is denoted with the \texttt{.stat}
776 file extension.
777
778 \section{\label{oopseSec:mechanics}Mechanics}
779
780 \subsection{\label{oopseSec:integrate}Integrating the Equations of Motion: the Symplectic Step Integrator}
781
782 Integration of the equations of motion was carried out using the
783 symplectic splitting method proposed by Dullweber \emph{et
784 al.}.\cite{Dullweber1997} The reason for this integrator selection
785 deals with poor energy conservation of rigid body systems using
786 quaternions. While quaternions work well for orientational motion in
787 alternate ensembles, the microcanonical ensemble has a constant energy
788 requirement that is quite sensitive to errors in the equations of
789 motion. The original implementation of this code utilized quaternions
790 for rotational motion propagation; however, a detailed investigation
791 showed that they resulted in a steady drift in the total energy,
792 something that has been observed by others.\cite{Laird97}
793
794 The key difference in the integration method proposed by Dullweber
795 \emph{et al.} is that the entire rotation matrix is propagated from
796 one time step to the next. In the past, this would not have been as
797 feasible a option, being that the rotation matrix for a single body is
798 nine elements long as opposed to 3 or 4 elements for Euler angles and
799 quaternions respectively. System memory has become much less of an
800 issue in recent times, and this has resulted in substantial benefits
801 in energy conservation. There is still the issue of 5 or 6 additional
802 elements for describing the orientation of each particle, which will
803 increase dump files substantially. Simply translating the rotation
804 matrix into its component Euler angles or quaternions for storage
805 purposes relieves this burden.
806
807 The symplectic splitting method allows for Verlet style integration of
808 both linear and angular motion of rigid bodies. In the integration
809 method, the orientational propagation involves a sequence of matrix
810 evaluations to update the rotation matrix.\cite{Dullweber1997} These
811 matrix rotations end up being more costly computationally than the
812 simpler arithmetic quaternion propagation. With the same time step, a
813 1000 SSD particle simulation shows an average 7\% increase in
814 computation time using the symplectic step method in place of
815 quaternions. This cost is more than justified when comparing the
816 energy conservation of the two methods as illustrated in figure
817 \ref{timestep}.
818
819 \begin{figure}
820 \centering
821 \includegraphics[width=\linewidth]{timeStep.eps}
822 \caption{Energy conservation using quaternion based integration versus
823 the symplectic step method proposed by Dullweber \emph{et al.} with
824 increasing time step. For each time step, the dotted line is total
825 energy using the symplectic step integrator, and the solid line comes
826 from the quaternion integrator. The larger time step plots are shifted
827 up from the true energy baseline for clarity.}
828 \label{timestep}
829 \end{figure}
830
831 In figure \ref{timestep}, the resulting energy drift at various time
832 steps for both the symplectic step and quaternion integration schemes
833 is compared. All of the 1000 SSD particle simulations started with the
834 same configuration, and the only difference was the method for
835 handling rotational motion. At time steps of 0.1 and 0.5 fs, both
836 methods for propagating particle rotation conserve energy fairly well,
837 with the quaternion method showing a slight energy drift over time in
838 the 0.5 fs time step simulation. At time steps of 1 and 2 fs, the
839 energy conservation benefits of the symplectic step method are clearly
840 demonstrated. Thus, while maintaining the same degree of energy
841 conservation, one can take considerably longer time steps, leading to
842 an overall reduction in computation time.
843
844 Energy drift in these SSD particle simulations was unnoticeable for
845 time steps up to three femtoseconds. A slight energy drift on the
846 order of 0.012 kcal/mol per nanosecond was observed at a time step of
847 four femtoseconds, and as expected, this drift increases dramatically
848 with increasing time step. To insure accuracy in the constant energy
849 simulations, time steps were set at 2 fs and kept at this value for
850 constant pressure simulations as well.
851
852
853 \subsection{\label{sec:extended}Extended Systems for other Ensembles}
854
855
856 {\sc oopse} implements a
857
858
859 \subsubsection{\label{oopseSec:noseHooverThermo}Nose-Hoover Thermostatting}
860
861 To mimic the effects of being in a constant temperature ({\sc nvt})
862 ensemble, {\sc oopse} uses the Nose-Hoover extended system
863 approach.\cite{Hoover85} In this method, the equations of motion for
864 the particle positions and velocities are
865 \begin{eqnarray}
866 \dot{{\bf r}} & = & {\bf v} \\
867 \dot{{\bf v}} & = & \frac{{\bf f}}{m} - \chi {\bf v}
868 \label{eq:nosehoovereom}
869 \end{eqnarray}
870
871 $\chi$ is an ``extra'' variable included in the extended system, and
872 it is propagated using the first order equation of motion
873 \begin{equation}
874 \dot{\chi} = \frac{1}{\tau_{T}} \left( \frac{T}{T_{target}} - 1 \right)
875 \label{eq:nosehooverext}
876 \end{equation}
877 where $T_{target}$ is the target temperature for the simulation, and
878 $\tau_{T}$ is a time constant for the thermostat.
879
880 To select the Nose-Hoover {\sc nvt} ensemble, the {\tt ensemble = NVT;}
881 command would be used in the simulation's {\sc bass} file. There is
882 some subtlety in choosing values for $\tau_{T}$, and it is usually set
883 to values of a few ps. Within a {\sc bass} file, $\tau_{T}$ could be
884 set to 1 ps using the {\tt tauThermostat = 1000; } command.
885
886
887 \subsection{\label{oopseSec:zcons}Z-Constraint Method}
888
889 Based on fluctuation-dissipation theorem,\bigskip\ force auto-correlation
890 method was developed to investigate the dynamics of ions inside the ion
891 channels.\cite{Roux91} Time-dependent friction coefficient can be calculated
892 from the deviation of the instantaneous force from its mean force.
893
894 %
895
896 \begin{equation}
897 \xi(z,t)=\langle\delta F(z,t)\delta F(z,0)\rangle/k_{B}T
898 \end{equation}
899 where%
900 \begin{equation}
901 \delta F(z,t)=F(z,t)-\langle F(z,t)\rangle
902 \end{equation}
903
904
905 If the time-dependent friction decay rapidly, static friction coefficient can
906 be approximated by%
907
908 \begin{equation}
909 \xi^{static}(z)=\int_{0}^{\infty}\langle\delta F(z,t)\delta F(z,0)\rangle dt
910 \end{equation}
911
912
913 Hence, diffusion constant can be estimated by
914 \begin{equation}
915 D(z)=\frac{k_{B}T}{\xi^{static}(z)}=\frac{(k_{B}T)^{2}}{\int_{0}^{\infty
916 }\langle\delta F(z,t)\delta F(z,0)\rangle dt}%
917 \end{equation}
918
919
920 \bigskip Z-Constraint method, which fixed the z coordinates of the molecules
921 with respect to the center of the mass of the system, was proposed to obtain
922 the forces required in force auto-correlation method.\cite{Marrink94} However,
923 simply resetting the coordinate will move the center of the mass of the whole
924 system. To avoid this problem, a new method was used at {\sc oopse}. Instead of
925 resetting the coordinate, we reset the forces of z-constraint molecules as
926 well as subtract the total constraint forces from the rest of the system after
927 force calculation at each time step.
928 \begin{align}
929 F_{\alpha i}&=0\\
930 V_{\alpha i}&=V_{\alpha i}-\frac{\sum\limits_{i}M_{_{\alpha i}}V_{\alpha i}}{\sum\limits_{i}M_{_{\alpha i}}}\\
931 F_{\alpha i}&=F_{\alpha i}-\frac{M_{_{\alpha i}}}{\sum\limits_{\alpha}\sum\limits_{i}M_{_{\alpha i}}}\sum\limits_{\beta}F_{\beta}\\
932 V_{\alpha i}&=V_{\alpha i}-\frac{\sum\limits_{\alpha}\sum\limits_{i}M_{_{\alpha i}}V_{\alpha i}}{\sum\limits_{\alpha}\sum\limits_{i}M_{_{\alpha i}}}
933 \end{align}
934
935 At the very beginning of the simulation, the molecules may not be at its
936 constraint position. To move the z-constraint molecule to the specified
937 position, a simple harmonic potential is used%
938
939 \begin{equation}
940 U(t)=\frac{1}{2}k_{Harmonic}(z(t)-z_{cons})^{2}%
941 \end{equation}
942 where $k_{Harmonic}$\bigskip\ is the harmonic force constant, $z(t)$ is
943 current z coordinate of the center of mass of the z-constraint molecule, and
944 $z_{cons}$ is the restraint position. Therefore, the harmonic force operated
945 on the z-constraint molecule at time $t$ can be calculated by%
946 \begin{equation}
947 F_{z_{Harmonic}}(t)=-\frac{\partial U(t)}{\partial z(t)}=-k_{Harmonic}%
948 (z(t)-z_{cons})
949 \end{equation}
950 Worthy of mention, other kinds of potential functions can also be used to
951 drive the z-constraint molecule.
952
953 \section{\label{oopseSec:props}Trajectory Analysis}
954
955 \subsection{\label{oopseSec:staticProps}Static Property Analysis}
956
957 The static properties of the trajectories are analyzed with the
958 program \texttt{staticProps}. The code is capable of calculating the following
959 pair correlations between species A and B:
960 \begin{itemize}
961 \item $g_{\text{AB}}(r)$: Eq.~\ref{eq:gofr}
962 \item $g_{\text{AB}}(r, \cos \theta)$: Eq.~\ref{eq:gofrCosTheta}
963 \item $g_{\text{AB}}(r, \cos \omega)$: Eq.~\ref{eq:gofrCosOmega}
964 \item $g_{\text{AB}}(x, y, z)$: Eq.~\ref{eq:gofrXYZ}
965 \item $\langle \cos \omega \rangle_{\text{AB}}(r)$:
966 Eq.~\ref{eq:cosOmegaOfR}
967 \end{itemize}
968
969 The first pair correlation, $g_{\text{AB}}(r)$, is defined as follows:
970 \begin{equation}
971 g_{\text{AB}}(r) = \frac{V}{N_{\text{A}}N_{\text{B}}}\langle %%
972 \sum_{i \in \text{A}} \sum_{j \in \text{B}} %%
973 \delta( r - |\mathbf{r}_{ij}|) \rangle \label{eq:gofr}
974 \end{equation}
975 Where $\mathbf{r}_{ij}$ is the vector
976 \begin{equation*}
977 \mathbf{r}_{ij} = \mathbf{r}_j - \mathbf{r}_i \notag
978 \end{equation*}
979 and $\frac{V}{N_{\text{A}}N_{\text{B}}}$ normalizes the average over
980 the expected pair density at a given $r$.
981
982 The next two pair correlations, $g_{\text{AB}}(r, \cos \theta)$ and
983 $g_{\text{AB}}(r, \cos \omega)$, are similar in that they are both two
984 dimensional histograms. Both use $r$ for the primary axis then a
985 $\cos$ for the secondary axis ($\cos \theta$ for
986 Eq.~\ref{eq:gofrCosTheta} and $\cos \omega$ for
987 Eq.~\ref{eq:gofrCosOmega}). This allows for the investigator to
988 correlate alignment on directional entities. $g_{\text{AB}}(r, \cos
989 \theta)$ is defined as follows:
990 \begin{equation}
991 g_{\text{AB}}(r, \cos \theta) = \frac{V}{N_{\text{A}}N_{\text{B}}}\langle
992 \sum_{i \in \text{A}} \sum_{j \in \text{B}}
993 \delta( \cos \theta - \cos \theta_{ij})
994 \delta( r - |\mathbf{r}_{ij}|) \rangle
995 \label{eq:gofrCosTheta}
996 \end{equation}
997 Where
998 \begin{equation*}
999 \cos \theta_{ij} = \mathbf{\hat{i}} \cdot \mathbf{\hat{r}}_{ij}
1000 \end{equation*}
1001 Here $\mathbf{\hat{i}}$ is the unit directional vector of species $i$
1002 and $\mathbf{\hat{r}}_{ij}$ is the unit vector associated with vector
1003 $\mathbf{r}_{ij}$.
1004
1005 The second two dimensional histogram is of the form:
1006 \begin{equation}
1007 g_{\text{AB}}(r, \cos \omega) =
1008 \frac{V}{N_{\text{A}}N_{\text{B}}}\langle
1009 \sum_{i \in \text{A}} \sum_{j \in \text{B}}
1010 \delta( \cos \omega - \cos \omega_{ij})
1011 \delta( r - |\mathbf{r}_{ij}|) \rangle \label{eq:gofrCosOmega}
1012 \end{equation}
1013 Here
1014 \begin{equation*}
1015 \cos \omega_{ij} = \mathbf{\hat{i}} \cdot \mathbf{\hat{j}}
1016 \end{equation*}
1017 Again, $\mathbf{\hat{i}}$ and $\mathbf{\hat{j}}$ are the unit
1018 directional vectors of species $i$ and $j$.
1019
1020 The static analysis code is also cable of calculating a three
1021 dimensional pair correlation of the form:
1022 \begin{equation}\label{eq:gofrXYZ}
1023 g_{\text{AB}}(x, y, z) =
1024 \frac{V}{N_{\text{A}}N_{\text{B}}}\langle
1025 \sum_{i \in \text{A}} \sum_{j \in \text{B}}
1026 \delta( x - x_{ij})
1027 \delta( y - y_{ij})
1028 \delta( z - z_{ij}) \rangle
1029 \end{equation}
1030 Where $x_{ij}$, $y_{ij}$, and $z_{ij}$ are the $x$, $y$, and $z$
1031 components respectively of vector $\mathbf{r}_{ij}$.
1032
1033 The final pair correlation is similar to
1034 Eq.~\ref{eq:gofrCosOmega}. $\langle \cos \omega
1035 \rangle_{\text{AB}}(r)$ is calculated in the following way:
1036 \begin{equation}\label{eq:cosOmegaOfR}
1037 \langle \cos \omega \rangle_{\text{AB}}(r) =
1038 \langle \sum_{i \in \text{A}} \sum_{j \in \text{B}}
1039 (\cos \omega_{ij}) \delta( r - |\mathbf{r}_{ij}|) \rangle
1040 \end{equation}
1041 Here $\cos \omega_{ij}$ is defined in the same way as in
1042 Eq.~\ref{eq:gofrCosOmega}. This equation is a single dimensional pair
1043 correlation that gives the average correlation of two directional
1044 entities as a function of their distance from each other.
1045
1046 All static properties are calculated on a frame by frame basis. The
1047 trajectory is read a single frame at a time, and the appropriate
1048 calculations are done on each frame. Once one frame is finished, the
1049 next frame is read in, and a running average of the property being
1050 calculated is accumulated in each frame. The program allows for the
1051 user to specify more than one property be calculated in single run,
1052 preventing the need to read a file multiple times.
1053
1054 \subsection{\label{dynamicProps}Dynamic Property Analysis}
1055
1056 The dynamic properties of a trajectory are calculated with the program
1057 \texttt{dynamicProps}. The program will calculate the following properties:
1058 \begin{gather}
1059 \langle | \mathbf{r}(t) - \mathbf{r}(0) |^2 \rangle \label{eq:rms}\\
1060 \langle \mathbf{v}(t) \cdot \mathbf{v}(0) \rangle \label{eq:velCorr} \\
1061 \langle \mathbf{j}(t) \cdot \mathbf{j}(0) \rangle \label{eq:angularVelCorr}
1062 \end{gather}
1063
1064 Eq.~\ref{eq:rms} is the root mean square displacement
1065 function. Eq.~\ref{eq:velCorr} and Eq.~\ref{eq:angularVelCorr} are the
1066 velocity and angular velocity correlation functions respectively. The
1067 latter is only applicable to directional species in the simulation.
1068
1069 The \texttt{dynamicProps} program handles he file in a manner different from
1070 \texttt{staticProps}. As the properties calculated by this program are time
1071 dependent, multiple frames must be read in simultaneously by the
1072 program. For small trajectories this is no problem, and the entire
1073 trajectory is read into memory. However, for long trajectories of
1074 large systems, the files can be quite large. In order to accommodate
1075 large files, \texttt{dynamicProps} adopts a scheme whereby two blocks of memory
1076 are allocated to read in several frames each.
1077
1078 In this two block scheme, the correlation functions are first
1079 calculated within each memory block, then the cross correlations
1080 between the frames contained within the two blocks are
1081 calculated. Once completed, the memory blocks are incremented, and the
1082 process is repeated. A diagram illustrating the process is shown in
1083 Fig.~\ref{oopseFig:dynamicPropsMemory}. As was the case with
1084 \texttt{staticProps}, multiple properties may be calculated in a
1085 single run to avoid multiple reads on the same file.
1086
1087
1088
1089 \section{\label{oopseSec:design}Program Design}
1090
1091 \subsection{\label{sec:architecture} {\sc oopse} Architecture}
1092
1093 The core of OOPSE is divided into two main object libraries:
1094 \texttt{libBASS} and \texttt{libmdtools}. \texttt{libBASS} is the
1095 library developed around the parsing engine and \texttt{libmdtools}
1096 is the software library developed around the simulation engine. These
1097 two libraries are designed to encompass all the basic functions and
1098 tools that {\sc oopse} provides. Utility programs, such as the
1099 property analyzers, need only link against the software libraries to
1100 gain access to parsing, force evaluation, and input / output
1101 routines.
1102
1103 Contained in \texttt{libBASS} are all the routines associated with
1104 reading and parsing the \texttt{.bass} input files. Given a
1105 \texttt{.bass} file, \texttt{libBASS} will open it and any associated
1106 \texttt{.mdl} files; then create structures in memory that are
1107 templates of all the molecules specified in the input files. In
1108 addition, any simulation parameters set in the \texttt{.bass} file
1109 will be placed in a structure for later query by the controlling
1110 program.
1111
1112 Located in \texttt{libmdtools} are all other routines necessary to a
1113 Molecular Dynamics simulation. The library uses the main data
1114 structures returned by \texttt{libBASS} to initialize the various
1115 parts of the simulation: the atom structures and positions, the force
1116 field, the integrator, \emph{et cetera}. After initialization, the
1117 library can be used to perform a variety of tasks: integrate a
1118 Molecular Dynamics trajectory, query phase space information from a
1119 specific frame of a completed trajectory, or even recalculate force or
1120 energetic information about specific frames from a completed
1121 trajectory.
1122
1123 With these core libraries in place, several programs have been
1124 developed to utilize the routines provided by \texttt{libBASS} and
1125 \texttt{libmdtools}. The main program of the package is \texttt{oopse}
1126 and the corresponding parallel version \texttt{oopse\_MPI}. These two
1127 programs will take the \texttt{.bass} file, and create then integrate
1128 the simulation specified in the script. The two analysis programs
1129 \texttt{staticProps} and \texttt{dynamicProps} utilize the core
1130 libraries to initialize and read in trajectories from previously
1131 completed simulations, in addition to the ability to use functionality
1132 from \texttt{libmdtools} to recalculate forces and energies at key
1133 frames in the trajectories. Lastly, the family of system building
1134 programs (Sec.~\ref{oopseSec:initCoords}) also use the libraries to
1135 store and output the system configurations they create.
1136
1137 \subsection{\label{oopseSec:parallelization} Parallelization of {\sc oopse}}
1138
1139 Although processor power is continually growing month by month, it is
1140 still unreasonable to simulate systems of more then a 1000 atoms on a
1141 single processor. To facilitate study of larger system sizes or
1142 smaller systems on long time scales in a reasonable period of time,
1143 parallel methods were developed allowing multiple CPU's to share the
1144 simulation workload. Three general categories of parallel
1145 decomposition method's have been developed including atomic, spatial
1146 and force decomposition methods.
1147
1148 Algorithmically simplest of the three method's is atomic decomposition
1149 where N particles in a simulation are split among P processors for the
1150 duration of the simulation. Computational cost scales as an optimal
1151 $O(N/P)$ for atomic decomposition. Unfortunately all processors must
1152 communicate positions and forces with all other processors leading
1153 communication to scale as an unfavorable $O(N)$ independent of the
1154 number of processors. This communication bottleneck led to the
1155 development of spatial and force decomposition methods in which
1156 communication among processors scales much more favorably. Spatial or
1157 domain decomposition divides the physical spatial domain into 3D boxes
1158 in which each processor is responsible for calculation of forces and
1159 positions of particles located in its box. Particles are reassigned to
1160 different processors as they move through simulation space. To
1161 calculate forces on a given particle, a processor must know the
1162 positions of particles within some cutoff radius located on nearby
1163 processors instead of the positions of particles on all
1164 processors. Both communication between processors and computation
1165 scale as $O(N/P)$ in the spatial method. However, spatial
1166 decomposition adds algorithmic complexity to the simulation code and
1167 is not very efficient for small N since the overall communication
1168 scales as the surface to volume ratio $(N/P)^{2/3}$ in three
1169 dimensions.
1170
1171 Force decomposition assigns particles to processors based on a block
1172 decomposition of the force matrix. Processors are split into a
1173 optimally square grid forming row and column processor groups. Forces
1174 are calculated on particles in a given row by particles located in
1175 that processors column assignment. Force decomposition is less complex
1176 to implement then the spatial method but still scales computationally
1177 as $O(N/P)$ and scales as $(N/\sqrt{p})$ in communication
1178 cost. Plimpton also found that force decompositions scales more
1179 favorably then spatial decomposition up to 10,000 atoms and favorably
1180 competes with spatial methods for up to 100,000 atoms.
1181
1182 \subsection{\label{oopseSec:memAlloc}Memory Issues in Trajectory Analysis}
1183
1184 For large simulations, the trajectory files can sometimes reach sizes
1185 in excess of several gigabytes. In order to effectively analyze that
1186 amount of data+, two memory management schemes have been devised for
1187 \texttt{staticProps} and for \texttt{dynamicProps}. The first scheme,
1188 developed for \texttt{staticProps}, is the simplest. As each frame's
1189 statistics are calculated independent of each other, memory is
1190 allocated for each frame, then freed once correlation calculations are
1191 complete for the snapshot. To prevent multiple passes through a
1192 potentially large file, \texttt{staticProps} is capable of calculating
1193 all requested correlations per frame with only a single pair loop in
1194 each frame and a single read through of the file.
1195
1196 The second, more advanced memory scheme, is used by
1197 \texttt{dynamicProps}. Here, the program must have multiple frames in
1198 memory to calculate time dependent correlations. In order to prevent a
1199 situation where the program runs out of memory due to large
1200 trajectories, the user is able to specify that the trajectory be read
1201 in blocks. The number of frames in each block is specified by the
1202 user, and upon reading a block of the trajectory,
1203 \texttt{dynamicProps} will calculate all of the time correlation frame
1204 pairs within the block. After in block correlations are complete, a
1205 second block of the trajectory is read, and the cross correlations are
1206 calculated between the two blocks. this second block is then freed and
1207 then incremented and the process repeated until the end of the
1208 trajectory. Once the end is reached, the first block is freed then
1209 incremented, and the again the internal time correlations are
1210 calculated. The algorithm with the second block is then repeated with
1211 the new origin block, until all frame pairs have been correlated in
1212 time. This process is illustrated in
1213 Fig.~\ref{oopseFig:dynamicPropsMemory}.
1214
1215 \begin{figure}
1216 \centering
1217 \includegraphics[width=\linewidth]{dynamicPropsMem.eps}
1218 \caption[A representation of the block correlations in \texttt{dynamicProps}]{This diagram illustrates the memory management used by \texttt{dynamicProps}, which follows the scheme: $\sum^{N_{\text{memory blocks}}}_{i=1}[ \operatorname{self}(i) + \sum^{N_{\text{memory blocks}}}_{j>i} \operatorname{cross}(i,j)]$. The shaded region represents the self correlation of the memory block, and the open blocks are read one at a time and the cross correlations between blocks are calculated.}
1219 \label{oopseFig:dynamicPropsMemory}
1220 \end{figure}
1221
1222 \subsection{\label{openSource}Open Source and Distribution License}
1223
1224 \section{\label{oopseSec:conclusion}Conclusion}
1225
1226 We have presented the design and implementation of our open source
1227 simulation package {\sc oopse}. The package offers novel
1228 capabilities to the field of Molecular Dynamics simulation packages in
1229 the form of dipolar force fields, and symplectic integration of rigid
1230 body dynamics. It is capable of scaling across multiple processors
1231 through the use of MPI. It also implements several integration
1232 ensembles allowing the end user control over temperature and
1233 pressure. In addition, it is capable of integrating constrained
1234 dynamics through both the {\sc rattle} algorithm and the z-constraint
1235 method.
1236
1237 These features are all brought together in a single open-source
1238 development package. This allows researchers to not only benefit from
1239 {\sc oopse}, but also contribute to {\sc oopse}'s development as
1240 well.Documentation and source code for {\sc oopse} can be downloaded
1241 from \texttt{http://www.openscience.org/oopse/}.
1242