ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/tengDissertation/Appendix.tex
Revision: 2880
Committed: Thu Jun 22 22:19:02 2006 UTC (18 years ago) by tim
Content type: application/x-tex
File size: 31688 byte(s)
Log Message:
finish conclusion; some format checking correction

File Contents

# User Rev Content
1 tim 2805 \appendix
2 tim 2815 \chapter{\label{chapt:oopse}Object-Oriented Parallel Simulation Engine}
3 tim 2685
4 tim 2840 Absence of applying modern software development practices is the
5     bottleneck of Scientific Computing community\cite{Wilson2006}. In
6 tim 2841 the last 20 years , there are quite a few MD
7     packages\cite{Brooks1983, Vincent1995, Kale1999} that were developed
8     to solve common MD problems and perform robust simulations .
9     Unfortunately, most of them are commercial programs that are either
10     poorly written or extremely complicate. Consequently, it prevents
11     the researchers to reuse or extend those packages to do cutting-edge
12     research effectively. Along the way of studying structural and
13     dynamic processes in condensed phase systems like biological
14     membranes and nanoparticles, we developed an open source
15     Object-Oriented Parallel Simulation Engine ({\sc OOPSE}). This new
16     molecular dynamics package has some unique features
17 tim 2815 \begin{enumerate}
18     \item {\sc OOPSE} performs Molecular Dynamics (MD) simulations on non-standard
19     atom types (transition metals, point dipoles, sticky potentials,
20     Gay-Berne ellipsoids, or other "lumpy"atoms with orientational
21     degrees of freedom), as well as rigid bodies.
22     \item {\sc OOPSE} uses a force-based decomposition algorithm using MPI on cheap
23     Beowulf clusters to obtain very efficient parallelism.
24     \item {\sc OOPSE} integrates the equations of motion using advanced methods for
25     orientational dynamics in NVE, NVT, NPT, NPAT, and NP$\gamma$T
26     ensembles.
27     \item {\sc OOPSE} can carry out simulations on metallic systems using the
28     Embedded Atom Method (EAM) as well as the Sutton-Chen potential.
29     \item {\sc OOPSE} can perform simulations on Gay-Berne liquid crystals.
30     \item {\sc OOPSE} can simulate systems containing the extremely efficient
31     extended-Soft Sticky Dipole (SSD/E) model for water.
32     \end{enumerate}
33 tim 2688
34 tim 2812 \section{\label{appendixSection:architecture }Architecture}
35    
36 tim 2815 Mainly written by \texttt{C/C++} and \texttt{Fortran90}, {\sc OOPSE}
37     uses C++ Standard Template Library (STL) and fortran modules as the
38     foundation. As an extensive set of the STL and Fortran90 modules,
39     {\sc Base Classes} provide generic implementations of mathematical
40     objects (e.g., matrices, vectors, polynomials, random number
41     generators) and advanced data structures and algorithms(e.g., tuple,
42     bitset, generic data, string manipulation). The molecular data
43     structures for the representation of atoms, bonds, bends, torsions,
44     rigid bodies and molecules \textit{etc} are contained in the {\sc
45     Kernel} which is implemented with {\sc Base Classes} and are
46     carefully designed to provide maximum extensibility and flexibility.
47     The functionality required for applications is provide by the third
48     layer which contains Input/Output, Molecular Mechanics and Structure
49     modules. Input/Output module not only implements general methods for
50     file handling, but also defines a generic force field interface.
51     Another important component of Input/Output module is the meta-data
52     file parser, which is rewritten using ANother Tool for Language
53     Recognition(ANTLR)\cite{Parr1995, Schaps1999} syntax. The Molecular
54     Mechanics module consists of energy minimization and a wide
55     varieties of integration methods(see Chap.~\ref{chapt:methodology}).
56     The structure module contains a flexible and powerful selection
57     library which syntax is elaborated in
58     Sec.~\ref{appendixSection:syntax}. The top layer is made of the main
59     program of the package, \texttt{oopse} and it corresponding parallel
60     version \texttt{oopse\_MPI}, as well as other useful utilities, such
61     as \texttt{StatProps} (see Sec.~\ref{appendixSection:StaticProps}),
62 tim 2840 \texttt{DynamicProps} (see Sec.~\ref{appendixSection:DynamicProps}),
63     \texttt{Dump2XYZ} (see Sec.~\ref{appendixSection:Dump2XYZ}),
64     \texttt{Hydro} (see Sec.~\ref{appendixSection:hydrodynamics})
65 tim 2815 \textit{etc}.
66    
67 tim 2812 \begin{figure}
68     \centering
69 tim 2813 \includegraphics[width=\linewidth]{architecture.eps}
70 tim 2815 \caption[The architecture of {\sc OOPSE}] {Overview of the structure
71     of {\sc OOPSE}} \label{appendixFig:architecture}
72 tim 2812 \end{figure}
73    
74 tim 2685 \section{\label{appendixSection:desginPattern}Design Pattern}
75    
76 tim 2688 Design patterns are optimal solutions to commonly-occurring problems
77     in software design. Although originated as an architectural concept
78 tim 2807 for buildings and towns by Christopher Alexander
79     \cite{Alexander1987}, software patterns first became popular with
80     the wide acceptance of the book, Design Patterns: Elements of
81     Reusable Object-Oriented Software \cite{Gamma1994}. Patterns reflect
82     the experience, knowledge and insights of developers who have
83     successfully used these patterns in their own work. Patterns are
84     reusable. They provide a ready-made solution that can be adapted to
85     different problems as necessary. Pattern are expressive. they
86     provide a common vocabulary of solutions that can express large
87 tim 2842 solutions succinctly. As one of the latest advanced techniques
88     emerged from object-oriented community, design patterns were applied
89     in some of the modern scientific software applications, such as
90     JMol, {\sc OOPSE}\cite{Meineke2005} and PROTOMOL\cite{Matthey2004}
91 tim 2839 \textit{etc}. The following sections enumerates some of the patterns
92     used in {\sc OOPSE}.
93 tim 2685
94 tim 2693 \subsection{\label{appendixSection:singleton}Singleton}
95 tim 2836
96 tim 2821 The Singleton pattern not only provides a mechanism to restrict
97     instantiation of a class to one object, but also provides a global
98     point of access to the object. Currently implemented as a global
99     variable, the logging utility which reports error and warning
100     messages to the console in {\sc OOPSE} is a good candidate for
101     applying the Singleton pattern to avoid the global namespace
102 tim 2842 pollution. Although the singleton pattern can be implemented in
103 tim 2821 various ways to account for different aspects of the software
104     designs, such as lifespan control \textit{etc}, we only use the
105 tim 2842 static data approach in {\sc OOPSE}. The declaration and
106     implementation of IntegratorFactory class are given by declared in
107     List.~\ref{appendixScheme:singletonDeclaration} and
108 tim 2880 Scheme.~\ref{appendixScheme:singletonImplementation} respectively.
109 tim 2842 Since constructor is declared as protected, a client can not
110     instantiate IntegratorFactory directly. Moreover, since the member
111     function getInstance serves as the only entry of access to
112     IntegratorFactory, this approach fulfills the basic requirement, a
113     single instance. Another consequence of this approach is the
114     automatic destruction since static data are destroyed upon program
115     termination.
116 tim 2835 \begin{lstlisting}[float,caption={[A classic Singleton design pattern implementation(I)] The declaration of of simple Singleton pattern.},label={appendixScheme:singletonDeclaration}]
117 tim 2693
118 tim 2825 class IntegratorFactory {
119 tim 2832 public:
120     static IntegratorFactory*
121     getInstance();
122     protected:
123     IntegratorFactory();
124     private:
125     static IntegratorFactory* instance_;
126 tim 2825 };
127    
128 tim 2821 \end{lstlisting}
129 tim 2836
130 tim 2835 \begin{lstlisting}[float,caption={[A classic implementation of Singleton design pattern (II)] The implementation of simple Singleton pattern.},label={appendixScheme:singletonImplementation}]
131 tim 2821
132     IntegratorFactory::instance_ = NULL;
133    
134     IntegratorFactory* getInstance() {
135     if (instance_ == NULL){
136     instance_ = new IntegratorFactory;
137     }
138     return instance_;
139     }
140 tim 2825
141 tim 2821 \end{lstlisting}
142    
143 tim 2836
144 tim 2688 \subsection{\label{appendixSection:factoryMethod}Factory Method}
145 tim 2685
146 tim 2821 Categoried as a creational pattern, the Factory Method pattern deals
147     with the problem of creating objects without specifying the exact
148     class of object that will be created. Factory Method is typically
149     implemented by delegating the creation operation to the subclasses.
150 tim 2836 Parameterized Factory pattern where factory method (
151     createIntegrator member function) creates products based on the
152 tim 2880 identifier (see Scheme.~\ref{appendixScheme:factoryDeclaration}). If
153 tim 2836 the identifier has been already registered, the factory method will
154 tim 2842 invoke the corresponding creator (see
155 tim 2880 Scheme.~\ref{appendixScheme:integratorCreator}) which utilizes the
156 tim 2842 modern C++ template technique to avoid excess subclassing.
157 tim 2822
158 tim 2836 \begin{lstlisting}[float,caption={[The implementation of Parameterized Factory pattern (I)]Source code of IntegratorFactory class.},label={appendixScheme:factoryDeclaration}]
159    
160 tim 2825 class IntegratorFactory {
161 tim 2832 public:
162     typedef std::map<string, IntegratorCreator*> CreatorMapType;
163 tim 2821
164 tim 2832 bool registerIntegrator(IntegratorCreator* creator) {
165     return creatorMap_.insert(creator->getIdent(), creator).second;
166     }
167 tim 2821
168 tim 2832 Integrator* createIntegrator(const string& id, SimInfo* info) {
169     Integrator* result = NULL;
170     CreatorMapType::iterator i = creatorMap_.find(id);
171     if (i != creatorMap_.end()) {
172     result = (i->second)->create(info);
173 tim 2831 }
174 tim 2832 return result;
175     }
176 tim 2825
177 tim 2832 private:
178     CreatorMapType creatorMap_;
179 tim 2825 };
180 tim 2821 \end{lstlisting}
181 tim 2836
182 tim 2835 \begin{lstlisting}[float,caption={[The implementation of Parameterized Factory pattern (III)]Source code of creator classes.},label={appendixScheme:integratorCreator}]
183 tim 2821
184 tim 2825 class IntegratorCreator {
185 tim 2832 public:
186 tim 2823 IntegratorCreator(const string& ident) : ident_(ident) {}
187 tim 2822
188 tim 2823 const string& getIdent() const { return ident_; }
189 tim 2821
190     virtual Integrator* create(SimInfo* info) const = 0;
191    
192 tim 2832 private:
193 tim 2823 string ident_;
194 tim 2825 };
195 tim 2821
196 tim 2833 template<class ConcreteIntegrator>
197     class IntegratorBuilder : public IntegratorCreator {
198 tim 2832 public:
199     IntegratorBuilder(const string& ident)
200 tim 2833 : IntegratorCreator(ident) {}
201 tim 2832 virtual Integrator* create(SimInfo* info) const {
202     return new ConcreteIntegrator(info);
203     }
204 tim 2825 };
205 tim 2821 \end{lstlisting}
206    
207 tim 2688 \subsection{\label{appendixSection:visitorPattern}Visitor}
208 tim 2821
209 tim 2836 The visitor pattern is designed to decouple the data structure and
210     algorithms used upon them by collecting related operation from
211     element classes into other visitor classes, which is equivalent to
212     adding virtual functions into a set of classes without modifying
213     their interfaces. Fig.~\ref{appendixFig:visitorUML} demonstrates the
214     structure of Visitor pattern which is used extensively in {\tt
215     Dump2XYZ}. In order to convert an OOPSE dump file, a series of
216     distinct operations are performed on different StuntDoubles (See the
217     class hierarchy in Fig.~\ref{oopseFig:hierarchy} and the declaration
218 tim 2880 in Scheme.~\ref{appendixScheme:element}). Since the hierarchies
219 tim 2836 remains stable, it is easy to define a visit operation (see
220 tim 2880 Scheme.~\ref{appendixScheme:visitor}) for each class of StuntDouble.
221 tim 2836 Note that using Composite pattern\cite{Gamma1994}, CompositVisitor
222     manages a priority visitor list and handles the execution of every
223     visitor in the priority list on different StuntDoubles.
224 tim 2685
225 tim 2824 \begin{figure}
226     \centering
227 tim 2826 \includegraphics[width=\linewidth]{visitor.eps}
228 tim 2835 \caption[The UML class diagram of Visitor patten] {The UML class
229     diagram of Visitor patten.} \label{appendixFig:visitorUML}
230 tim 2824 \end{figure}
231    
232 tim 2838 \begin{figure}
233     \centering
234     \includegraphics[width=\linewidth]{hierarchy.eps}
235     \caption[Class hierarchy for ojects in {\sc OOPSE}]{ A diagram of
236     the class hierarchy. } \label{oopseFig:hierarchy}
237     \end{figure}
238 tim 2836
239     \begin{lstlisting}[float,caption={[The implementation of Visitor pattern (II)]Source code of the element classes.},label={appendixScheme:element}]
240    
241     class StuntDouble { public:
242     virtual void accept(BaseVisitor* v) = 0;
243     };
244    
245     class Atom: public StuntDouble { public:
246     virtual void accept{BaseVisitor* v*} {
247     v->visit(this);
248     }
249     };
250    
251     class DirectionalAtom: public Atom { public:
252     virtual void accept{BaseVisitor* v*} {
253     v->visit(this);
254     }
255     };
256    
257     class RigidBody: public StuntDouble { public:
258     virtual void accept{BaseVisitor* v*} {
259     v->visit(this);
260     }
261     };
262    
263     \end{lstlisting}
264    
265 tim 2824 \begin{lstlisting}[float,caption={[The implementation of Visitor pattern (I)]Source code of the visitor classes.},label={appendixScheme:visitor}]
266 tim 2825
267     class BaseVisitor{
268 tim 2832 public:
269     virtual void visit(Atom* atom);
270     virtual void visit(DirectionalAtom* datom);
271     virtual void visit(RigidBody* rb);
272 tim 2825 };
273    
274 tim 2835 class BaseAtomVisitor:public BaseVisitor{ public:
275     virtual void visit(Atom* atom);
276     virtual void visit(DirectionalAtom* datom);
277     virtual void visit(RigidBody* rb);
278     };
279    
280 tim 2836 class CompositeVisitor: public BaseVisitor {
281 tim 2832 public:
282 tim 2821
283 tim 2836 typedef list<pair<BaseVisitor*, int> > VistorListType;
284     typedef VistorListType::iterator VisitorListIterator;
285     virtual void visit(Atom* atom) {
286     VisitorListIterator i;
287     BaseVisitor* curVisitor;
288 tim 2880 for(i = visitorScheme.begin();i != visitorScheme.end();++i) {
289 tim 2836 atom->accept(*i);
290     }
291 tim 2832 }
292 tim 2821
293 tim 2836 virtual void visit(DirectionalAtom* datom) {
294     VisitorListIterator i;
295     BaseVisitor* curVisitor;
296 tim 2880 for(i = visitorScheme.begin();i != visitorScheme.end();++i) {
297 tim 2836 atom->accept(*i);
298     }
299 tim 2832 }
300 tim 2821
301 tim 2836 virtual void visit(RigidBody* rb) {
302     VisitorListIterator i;
303     std::vector<Atom*> myAtoms;
304     std::vector<Atom*>::iterator ai;
305     myAtoms = rb->getAtoms();
306 tim 2880 for(i = visitorScheme.begin();i != visitorScheme.end();++i) {{
307 tim 2836 rb->accept(*i);
308     for(ai = myAtoms.begin(); ai != myAtoms.end(); ++ai){
309     (*ai)->accept(*i);
310     }
311 tim 2832 }
312 tim 2836
313     void addVisitor(BaseVisitor* v, int priority);
314    
315     protected:
316     VistorListType visitorList;
317 tim 2825 };
318 tim 2821 \end{lstlisting}
319 tim 2829
320 tim 2730 \section{\label{appendixSection:concepts}Concepts}
321 tim 2685
322 tim 2829 OOPSE manipulates both traditional atoms as well as some objects
323     that {\it behave like atoms}. These objects can be rigid
324     collections of atoms or atoms which have orientational degrees of
325 tim 2836 freedom. A diagram of the class hierarchy is illustrated in
326     Fig.~\ref{oopseFig:hierarchy}. Every Molecule, Atom and
327 tim 2829 DirectionalAtom in {\sc OOPSE} have their own names which are
328     specified in the {\tt .md} file. In contrast, RigidBodies are
329     denoted by their membership and index inside a particular molecule:
330     [MoleculeName]\_RB\_[index] (the contents inside the brackets depend
331     on the specifics of the simulation). The names of rigid bodies are
332     generated automatically. For example, the name of the first rigid
333     body in a DMPC molecule is DMPC\_RB\_0.
334 tim 2838 \begin{itemize}
335     \item A {\bf StuntDouble} is {\it any} object that can be manipulated by the
336     integrators and minimizers.
337     \item An {\bf Atom} is a fundamental point-particle that can be moved around during a simulation.
338     \item A {\bf DirectionalAtom} is an atom which has {\it orientational} as well as translational degrees of freedom.
339     \item A {\bf RigidBody} is a collection of {\bf Atom}s or {\bf
340     DirectionalAtom}s which behaves as a single unit.
341     \end{itemize}
342 tim 2688
343 tim 2730 \section{\label{appendixSection:syntax}Syntax of the Select Command}
344    
345 tim 2837 {\sc OOPSE} provides a powerful selection utility to select
346     StuntDoubles. The most general form of the select command is:
347 tim 2730
348 tim 2837 {\tt select {\it expression}}.
349    
350     This expression represents an arbitrary set of StuntDoubles (Atoms
351     or RigidBodies) in {\sc OOPSE}. Expressions are composed of either
352     name expressions, index expressions, predefined sets, user-defined
353     expressions, comparison operators, within expressions, or logical
354     combinations of the above expression types. Expressions can be
355     combined using parentheses and the Boolean operators.
356    
357 tim 2730 \subsection{\label{appendixSection:logical}Logical expressions}
358    
359     The logical operators allow complex queries to be constructed out of
360     simpler ones using the standard boolean connectives {\bf and}, {\bf
361     or}, {\bf not}. Parentheses can be used to alter the precedence of
362     the operators.
363    
364     \begin{center}
365     \begin{tabular}{|ll|}
366     \hline
367     {\bf logical operator} & {\bf equivalent operator} \\
368     \hline
369     and & ``\&'', ``\&\&'' \\
370     or & ``$|$'', ``$||$'', ``,'' \\
371     not & ``!'' \\
372     \hline
373     \end{tabular}
374     \end{center}
375    
376     \subsection{\label{appendixSection:name}Name expressions}
377    
378     \begin{center}
379 tim 2805 \begin{tabular}{|llp{2in}|}
380 tim 2730 \hline {\bf type of expression} & {\bf examples} & {\bf translation
381     of
382     examples} \\
383     \hline expression without ``.'' & select DMPC & select all
384     StuntDoubles
385     belonging to all DMPC molecules \\
386     & select C* & select all atoms which have atom types beginning with C
387     \\
388     & select DMPC\_RB\_* & select all RigidBodies in DMPC molecules (but
389     only select the rigid bodies, and not the atoms belonging to them). \\
390     \hline expression has one ``.'' & select TIP3P.O\_TIP3P & select the
391     O\_TIP3P
392     atoms belonging to TIP3P molecules \\
393     & select DMPC\_RB\_O.PO4 & select the PO4 atoms belonging to
394     the first
395     RigidBody in each DMPC molecule \\
396     & select DMPC.20 & select the twentieth StuntDouble in each DMPC
397     molecule \\
398     \hline expression has two ``.''s & select DMPC.DMPC\_RB\_?.* &
399     select all atoms
400     belonging to all rigid bodies within all DMPC molecules \\
401     \hline
402     \end{tabular}
403     \end{center}
404    
405     \subsection{\label{appendixSection:index}Index expressions}
406    
407     \begin{center}
408     \begin{tabular}{|lp{4in}|}
409     \hline
410     {\bf examples} & {\bf translation of examples} \\
411     \hline
412     select 20 & select all of the StuntDoubles belonging to Molecule 20 \\
413     select 20 to 30 & select all of the StuntDoubles belonging to
414     molecules which have global indices between 20 (inclusive) and 30
415     (exclusive) \\
416     \hline
417     \end{tabular}
418     \end{center}
419    
420     \subsection{\label{appendixSection:predefined}Predefined sets}
421    
422     \begin{center}
423     \begin{tabular}{|ll|}
424     \hline
425     {\bf keyword} & {\bf description} \\
426     \hline
427     all & select all StuntDoubles \\
428     none & select none of the StuntDoubles \\
429     \hline
430     \end{tabular}
431     \end{center}
432    
433     \subsection{\label{appendixSection:userdefined}User-defined expressions}
434    
435     Users can define arbitrary terms to represent groups of
436     StuntDoubles, and then use the define terms in select commands. The
437     general form for the define command is: {\bf define {\it term
438 tim 2815 expression}}. Once defined, the user can specify such terms in
439     boolean expressions
440 tim 2730
441     {\tt define SSDWATER SSD or SSD1 or SSDRF}
442    
443     {\tt select SSDWATER}
444    
445     \subsection{\label{appendixSection:comparison}Comparison expressions}
446    
447     StuntDoubles can be selected by using comparision operators on their
448     properties. The general form for the comparison command is: a
449     property name, followed by a comparision operator and then a number.
450    
451     \begin{center}
452     \begin{tabular}{|l|l|}
453     \hline
454     {\bf property} & mass, charge \\
455     {\bf comparison operator} & ``$>$'', ``$<$'', ``$=$'', ``$>=$'',
456     ``$<=$'', ``$!=$'' \\
457     \hline
458     \end{tabular}
459     \end{center}
460    
461     For example, the phrase {\tt select mass > 16.0 and charge < -2}
462 tim 2805 would select StuntDoubles which have mass greater than 16.0 and
463 tim 2730 charges less than -2.
464    
465     \subsection{\label{appendixSection:within}Within expressions}
466    
467     The ``within'' keyword allows the user to select all StuntDoubles
468     within the specified distance (in Angstroms) from a selection,
469     including the selected atom itself. The general form for within
470     selection is: {\tt select within(distance, expression)}
471    
472     For example, the phrase {\tt select within(2.5, PO4 or NC4)} would
473     select all StuntDoubles which are within 2.5 angstroms of PO4 or NC4
474     atoms.
475    
476    
477 tim 2811 \section{\label{appendixSection:analysisFramework}Analysis Framework}
478 tim 2730
479     \subsection{\label{appendixSection:StaticProps}StaticProps}
480    
481     {\tt StaticProps} can compute properties which are averaged over
482     some or all of the configurations that are contained within a dump
483     file. The most common example of a static property that can be
484     computed is the pair distribution function between atoms of type $A$
485 tim 2815 and other atoms of type $B$, $g_{AB}(r)$. {\tt StaticProps} can
486     also be used to compute the density distributions of other molecules
487     in a reference frame {\it fixed to the body-fixed reference frame}
488 tim 2842 of a selected atom or rigid body. Due to the fact that the selected
489     StuntDoubles from two selections may be overlapped, {\tt
490     StaticProps} performs the calculation in three stages which are
491     illustrated in Fig.~\ref{oopseFig:staticPropsProcess}.
492 tim 2730
493 tim 2842 \begin{figure}
494     \centering
495     \includegraphics[width=\linewidth]{staticPropsProcess.eps}
496     \caption[A representation of the three-stage correlations in
497     \texttt{StaticProps}]{This diagram illustrates three-stage
498     processing used by \texttt{StaticProps}. $S_1$ and $S_2$ are the
499     numbers of selected stuntdobules from {\tt -{}-sele1} and {\tt
500     -{}-sele2} respectively, while $C$ is the number of stuntdobules
501     appearing at both sets. The first stage($S_1-C$ and $S_2$) and
502     second stages ($S_1$ and $S_2-C$) are completely non-overlapping. On
503     the contrary, the third stage($C$ and $C$) are completely
504     overlapping} \label{oopseFig:staticPropsProcess}
505     \end{figure}
506    
507 tim 2730 There are five seperate radial distribution functions availiable in
508     OOPSE. Since every radial distrbution function invlove the
509     calculation between pairs of bodies, {\tt -{}-sele1} and {\tt
510     -{}-sele2} must be specified to tell StaticProps which bodies to
511     include in the calculation.
512    
513     \begin{description}
514     \item[{\tt -{}-gofr}] Computes the pair distribution function,
515     \begin{equation*}
516     g_{AB}(r) = \frac{1}{\rho_B}\frac{1}{N_A} \langle \sum_{i \in A}
517     \sum_{j \in B} \delta(r - r_{ij}) \rangle
518     \end{equation*}
519     \item[{\tt -{}-r\_theta}] Computes the angle-dependent pair distribution
520     function. The angle is defined by the intermolecular vector
521     $\vec{r}$ and $z$-axis of DirectionalAtom A,
522     \begin{equation*}
523     g_{AB}(r, \cos \theta) = \frac{1}{\rho_B}\frac{1}{N_A} \langle
524     \sum_{i \in A} \sum_{j \in B} \delta(r - r_{ij}) \delta(\cos
525     \theta_{ij} - \cos \theta)\rangle
526     \end{equation*}
527     \item[{\tt -{}-r\_omega}] Computes the angle-dependent pair distribution
528     function. The angle is defined by the $z$-axes of the two
529     DirectionalAtoms A and B.
530     \begin{equation*}
531     g_{AB}(r, \cos \omega) = \frac{1}{\rho_B}\frac{1}{N_A} \langle
532     \sum_{i \in A} \sum_{j \in B} \delta(r - r_{ij}) \delta(\cos
533     \omega_{ij} - \cos \omega)\rangle
534     \end{equation*}
535     \item[{\tt -{}-theta\_omega}] Computes the pair distribution in the angular
536     space $\theta, \omega$ defined by the two angles mentioned above.
537     \begin{equation*}
538     g_{AB}(\cos\theta, \cos \omega) = \frac{1}{\rho_B}\frac{1}{N_A}
539     \langle \sum_{i \in A} \sum_{j \in B} \langle \delta(\cos
540     \theta_{ij} - \cos \theta) \delta(\cos \omega_{ij} - \cos
541     \omega)\rangle
542     \end{equation*}
543     \item[{\tt -{}-gxyz}] Calculates the density distribution of particles of type
544     B in the body frame of particle A. Therefore, {\tt -{}-originsele}
545     and {\tt -{}-refsele} must be given to define A's internal
546     coordinate set as the reference frame for the calculation.
547     \end{description}
548    
549     The vectors (and angles) associated with these angular pair
550 tim 2842 distribution functions are most easily seen in
551     Fig.~\ref{oopseFig:gofr}
552 tim 2730
553     \begin{figure}
554     \centering
555 tim 2805 \includegraphics[width=3in]{definition.eps}
556 tim 2730 \caption[Definitions of the angles between directional objects]{ \\
557     Any two directional objects (DirectionalAtoms and RigidBodies) have
558     a set of two angles ($\theta$, and $\omega$) between the z-axes of
559     their body-fixed frames.} \label{oopseFig:gofr}
560     \end{figure}
561    
562     The options available for {\tt StaticProps} are as follows:
563     \begin{longtable}[c]{|EFG|}
564     \caption{StaticProps Command-line Options}
565     \\ \hline
566     {\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline
567     \endhead
568     \hline
569     \endfoot
570     -h& {\tt -{}-help} & Print help and exit \\
571     -V& {\tt -{}-version} & Print version and exit \\
572 tim 2809 -i& {\tt -{}-input} & input dump file \\
573     -o& {\tt -{}-output} & output file name \\
574     -n& {\tt -{}-step} & process every n frame (default=`1') \\
575     -r& {\tt -{}-nrbins} & number of bins for distance (default=`100') \\
576     -a& {\tt -{}-nanglebins} & number of bins for cos(angle) (default= `50') \\
577     -l& {\tt -{}-length} & maximum length (Defaults to 1/2 smallest length of first frame) \\
578     & {\tt -{}-sele1} & select the first StuntDouble set \\
579     & {\tt -{}-sele2} & select the second StuntDouble set \\
580     & {\tt -{}-sele3} & select the third StuntDouble set \\
581     & {\tt -{}-refsele} & select reference (can only be used with {\tt -{}-gxyz}) \\
582     & {\tt -{}-molname} & molecule name \\
583     & {\tt -{}-begin} & begin internal index \\
584     & {\tt -{}-end} & end internal index \\
585 tim 2730 \hline
586     \multicolumn{3}{|l|}{One option from the following group of options is required:} \\
587     \hline
588     & {\tt -{}-gofr} & $g(r)$ \\
589     & {\tt -{}-r\_theta} & $g(r, \cos(\theta))$ \\
590     & {\tt -{}-r\_omega} & $g(r, \cos(\omega))$ \\
591     & {\tt -{}-theta\_omega} & $g(\cos(\theta), \cos(\omega))$ \\
592     & {\tt -{}-gxyz} & $g(x, y, z)$ \\
593     & {\tt -{}-p2} & $P_2$ order parameter ({\tt -{}-sele1} and {\tt -{}-sele2} must be specified) \\
594     & {\tt -{}-scd} & $S_{CD}$ order parameter(either {\tt -{}-sele1}, {\tt -{}-sele2}, {\tt -{}-sele3} are specified or {\tt -{}-molname}, {\tt -{}-begin}, {\tt -{}-end} are specified) \\
595     & {\tt -{}-density} & density plot ({\tt -{}-sele1} must be specified) \\
596     & {\tt -{}-slab\_density} & slab density ({\tt -{}-sele1} must be specified)
597     \end{longtable}
598    
599     \subsection{\label{appendixSection:DynamicProps}DynamicProps}
600    
601     {\tt DynamicProps} computes time correlation functions from the
602     configurations stored in a dump file. Typical examples of time
603     correlation functions are the mean square displacement and the
604     velocity autocorrelation functions. Once again, the selection
605     syntax can be used to specify the StuntDoubles that will be used for
606     the calculation. A general time correlation function can be thought
607     of as:
608     \begin{equation}
609     C_{AB}(t) = \langle \vec{u}_A(t) \cdot \vec{v}_B(0) \rangle
610     \end{equation}
611     where $\vec{u}_A(t)$ is a vector property associated with an atom of
612     type $A$ at time $t$, and $\vec{v}_B(t^{\prime})$ is a different
613     vector property associated with an atom of type $B$ at a different
614     time $t^{\prime}$. In most autocorrelation functions, the vector
615     properties ($\vec{v}$ and $\vec{u}$) and the types of atoms ($A$ and
616     $B$) are identical, and the three calculations built in to {\tt
617     DynamicProps} make these assumptions. It is possible, however, to
618     make simple modifications to the {\tt DynamicProps} code to allow
619     the use of {\it cross} time correlation functions (i.e. with
620     different vectors). The ability to use two selection scripts to
621     select different types of atoms is already present in the code.
622    
623 tim 2815 For large simulations, the trajectory files can sometimes reach
624 tim 2842 sizes in excess of several gigabytes. In order to prevent a
625     situation where the program runs out of memory due to large
626     trajectories, \texttt{dynamicProps} will estimate the size of free
627     memory at first, and determine the number of frames in each block,
628     which allows the operating system to load two blocks of data
629 tim 2815 simultaneously without swapping. Upon reading two blocks of the
630     trajectory, \texttt{dynamicProps} will calculate the time
631     correlation within the first block and the cross correlations
632     between the two blocks. This second block is then freed and then
633     incremented and the process repeated until the end of the
634     trajectory. Once the end is reached, the first block is freed then
635     incremented, until all frame pairs have been correlated in time.
636 tim 2816 This process is illustrated in
637     Fig.~\ref{oopseFig:dynamicPropsProcess}.
638 tim 2815
639 tim 2816 \begin{figure}
640     \centering
641     \includegraphics[width=\linewidth]{dynamicPropsProcess.eps}
642     \caption[A representation of the block correlations in
643     \texttt{dynamicProps}]{This diagram illustrates block correlations
644     processing in \texttt{dynamicProps}. The shaded region represents
645     the self correlation of the block, and the open blocks are read one
646     at a time and the cross correlations between blocks are calculated.}
647     \label{oopseFig:dynamicPropsProcess}
648     \end{figure}
649    
650 tim 2730 The options available for DynamicProps are as follows:
651     \begin{longtable}[c]{|EFG|}
652     \caption{DynamicProps Command-line Options}
653     \\ \hline
654     {\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline
655     \endhead
656     \hline
657     \endfoot
658     -h& {\tt -{}-help} & Print help and exit \\
659     -V& {\tt -{}-version} & Print version and exit \\
660 tim 2809 -i& {\tt -{}-input} & input dump file \\
661     -o& {\tt -{}-output} & output file name \\
662     & {\tt -{}-sele1} & select first StuntDouble set \\
663     & {\tt -{}-sele2} & select second StuntDouble set (if sele2 is not set, use script from sele1) \\
664 tim 2730 \hline
665     \multicolumn{3}{|l|}{One option from the following group of options is required:} \\
666     \hline
667     -r& {\tt -{}-rcorr} & compute mean square displacement \\
668     -v& {\tt -{}-vcorr} & compute velocity correlation function \\
669     -d& {\tt -{}-dcorr} & compute dipole correlation function
670     \end{longtable}
671    
672 tim 2811 \section{\label{appendixSection:tools}Other Useful Utilities}
673    
674     \subsection{\label{appendixSection:Dump2XYZ}Dump2XYZ}
675    
676 tim 2821 {\tt Dump2XYZ} can transform an OOPSE dump file into a xyz file
677     which can be opened by other molecular dynamics viewers such as Jmol
678     and VMD\cite{Humphrey1996}. The options available for Dump2XYZ are
679     as follows:
680 tim 2811
681    
682     \begin{longtable}[c]{|EFG|}
683     \caption{Dump2XYZ Command-line Options}
684     \\ \hline
685     {\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline
686     \endhead
687     \hline
688     \endfoot
689     -h & {\tt -{}-help} & Print help and exit \\
690     -V & {\tt -{}-version} & Print version and exit \\
691     -i & {\tt -{}-input} & input dump file \\
692     -o & {\tt -{}-output} & output file name \\
693     -n & {\tt -{}-frame} & print every n frame (default=`1') \\
694     -w & {\tt -{}-water} & skip the the waters (default=off) \\
695     -m & {\tt -{}-periodicBox} & map to the periodic box (default=off)\\
696     -z & {\tt -{}-zconstraint} & replace the atom types of zconstraint molecules (default=off) \\
697     -r & {\tt -{}-rigidbody} & add a pseudo COM atom to rigidbody (default=off) \\
698     -t & {\tt -{}-watertype} & replace the atom type of water model (default=on) \\
699     -b & {\tt -{}-basetype} & using base atom type (default=off) \\
700     & {\tt -{}-repeatX} & The number of images to repeat in the x direction (default=`0') \\
701     & {\tt -{}-repeatY} & The number of images to repeat in the y direction (default=`0') \\
702     & {\tt -{}-repeatZ} & The number of images to repeat in the z direction (default=`0') \\
703     -s & {\tt -{}-selection} & By specifying {\tt -{}-selection}=``selection command'' with Dump2XYZ, the user can select an arbitrary set of StuntDoubles to be
704     converted. \\
705     & {\tt -{}-originsele} & By specifying {\tt -{}-originsele}=``selection command'' with Dump2XYZ, the user can re-center the origin of the system around a specific StuntDouble \\
706     & {\tt -{}-refsele} & In order to rotate the system, {\tt -{}-originsele} and {\tt -{}-refsele} must be given to define the new coordinate set. A StuntDouble which contains a dipole (the direction of the dipole is always (0, 0, 1) in body frame) is specified by {\tt -{}-originsele}. The new x-z plane is defined by the direction of the dipole and the StuntDouble is specified by {\tt -{}-refsele}.
707     \end{longtable}
708    
709 tim 2815 \subsection{\label{appendixSection:hydrodynamics}Hydro}
710 tim 2821
711     {\tt Hydro} can calculate resistance and diffusion tensors at the
712     center of resistance. Both tensors at the center of diffusion can
713     also be reported from the program, as well as the coordinates for
714     the beads which are used to approximate the arbitrary shapes. The
715     options available for Hydro are as follows:
716 tim 2811 \begin{longtable}[c]{|EFG|}
717     \caption{Hydrodynamics Command-line Options}
718     \\ \hline
719     {\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline
720     \endhead
721     \hline
722     \endfoot
723     -h & {\tt -{}-help} & Print help and exit \\
724     -V & {\tt -{}-version} & Print version and exit \\
725     -i & {\tt -{}-input} & input dump file \\
726     -o & {\tt -{}-output} & output file prefix (default=`hydro') \\
727     -b & {\tt -{}-beads} & generate the beads only, hydrodynamics calculation will not be performed (default=off)\\
728 tim 2815 & {\tt -{}-model} & hydrodynamics model (supports ``AnalyticalModel'', ``RoughShell'' and ``BeadModel'') \\
729 tim 2811 \end{longtable}