ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/tengDissertation/Appendix.tex
Revision: 2813
Committed: Wed Jun 7 02:49:09 2006 UTC (18 years ago) by tim
Content type: application/x-tex
File size: 20901 byte(s)
Log Message:
adding architecture

File Contents

# User Rev Content
1 tim 2805 \appendix
2 tim 2812 \chapter{\label{chapt:oopse}Object-Oriented Parallel Simulation Engine (OOPSE)}
3 tim 2685
4 tim 2688 Designing object-oriented software is hard, and designing reusable
5     object-oriented scientific software is even harder. Absence of
6     applying modern software development practices is the bottleneck of
7 tim 2812 Scientific Computing community\cite{Wilson2006}. For instance, in
8     the last 20 years , there are quite a few MD packages that were
9 tim 2688 developed to solve common MD problems and perform robust simulations
10     . However, many of the codes are legacy programs that are either
11     poorly organized or extremely complex. Usually, these packages were
12     contributed by scientists without official computer science
13     training. The development of most MD applications are lack of strong
14     coordination to enforce design and programming guidelines. Moreover,
15     most MD programs also suffer from missing design and implement
16     documents which is crucial to the maintenance and extensibility.
17    
18 tim 2812 \section{\label{appendixSection:architecture }Architecture}
19    
20     \begin{figure}
21     \centering
22 tim 2813 \includegraphics[width=\linewidth]{architecture.eps}
23     \caption[The architecture of {\sc oopse}-3.0] {The architecture of
24     {\sc oopse}-3.0.} \label{appendixFig:architecture}
25 tim 2812 \end{figure}
26    
27 tim 2685 \section{\label{appendixSection:desginPattern}Design Pattern}
28    
29 tim 2688 Design patterns are optimal solutions to commonly-occurring problems
30     in software design. Although originated as an architectural concept
31 tim 2807 for buildings and towns by Christopher Alexander
32     \cite{Alexander1987}, software patterns first became popular with
33     the wide acceptance of the book, Design Patterns: Elements of
34     Reusable Object-Oriented Software \cite{Gamma1994}. Patterns reflect
35     the experience, knowledge and insights of developers who have
36     successfully used these patterns in their own work. Patterns are
37     reusable. They provide a ready-made solution that can be adapted to
38     different problems as necessary. Pattern are expressive. they
39     provide a common vocabulary of solutions that can express large
40     solutions succinctly.
41 tim 2685
42 tim 2688 Patterns are usually described using a format that includes the
43     following information:
44     \begin{enumerate}
45     \item The \emph{name} that is commonly used for the pattern. Good pattern names form a vocabulary for
46     discussing conceptual abstractions. a pattern may have more than one commonly used or recognizable name
47     in the literature. In this case it is common practice to document these nicknames or synonyms under
48     the heading of \emph{Aliases} or \emph{Also Known As}.
49     \item The \emph{motivation} or \emph{context} that this pattern applies
50     to. Sometimes, it will include some prerequisites that should be satisfied before deciding to use a pattern
51     \item The \emph{solution} to the problem that the pattern
52     addresses. It describes how to construct the necessary work products. The description may include
53     pictures, diagrams and prose which identify the pattern's structure, its participants, and their
54     collaborations, to show how the problem is solved.
55     \item The \emph{consequences} of using the given solution to solve a
56     problem, both positive and negative.
57     \end{enumerate}
58 tim 2685
59 tim 2688 As one of the latest advanced techniques emerged from
60     object-oriented community, design patterns were applied in some of
61     the modern scientific software applications, such as JMol, OOPSE
62 tim 2693 \cite{Meineke05} and PROTOMOL \cite{Matthey05} \textit{etc}.
63 tim 2685
64 tim 2693 \subsection{\label{appendixSection:singleton}Singleton}
65     The Singleton pattern ensures that only one instance of a class is
66     created. All objects that use an instance of that class use the same
67     instance.
68    
69 tim 2688 \subsection{\label{appendixSection:factoryMethod}Factory Method}
70     The Factory Method pattern is a creational pattern which deals with
71     the problem of creating objects without specifying the exact class
72     of object that will be created. Factory Method solves this problem
73     by defining a separate method for creating the objects, which
74     subclasses can then override to specify the derived type of product
75     that will be created.
76 tim 2685
77    
78 tim 2688 \subsection{\label{appendixSection:visitorPattern}Visitor}
79     The purpose of the Visitor Pattern is to encapsulate an operation
80     that you want to perform on the elements of a data structure. In
81     this way, you can change the operation being performed on a
82     structure without the need of changing the classes of the elements
83     that you are operating on.
84 tim 2685
85    
86 tim 2688 \subsection{\label{appendixSection:templateMethod}Template Method}
87    
88 tim 2730 \section{\label{appendixSection:concepts}Concepts}
89 tim 2685
90 tim 2730 OOPSE manipulates both traditional atoms as well as some objects
91     that {\it behave like atoms}. These objects can be rigid
92     collections of atoms or atoms which have orientational degrees of
93     freedom. Here is a diagram of the class heirarchy:
94 tim 2688
95 tim 2806 %\begin{figure}
96     %\centering
97     %\includegraphics[width=3in]{heirarchy.eps}
98     %\caption[Class heirarchy for StuntDoubles in {\sc oopse}-3.0]{ \\
99     %The class heirarchy of StuntDoubles in {\sc oopse}-3.0. The
100     %selection syntax allows the user to select any of the objects that
101     %are descended from a StuntDouble.} \label{oopseFig:heirarchy}
102     %\end{figure}
103 tim 2688
104 tim 2730 \begin{itemize}
105     \item A {\bf StuntDouble} is {\it any} object that can be manipulated by the
106     integrators and minimizers.
107     \item An {\bf Atom} is a fundamental point-particle that can be moved around during a simulation.
108     \item A {\bf DirectionalAtom} is an atom which has {\it orientational} as well as translational degrees of freedom.
109     \item A {\bf RigidBody} is a collection of {\bf Atom}s or {\bf
110     DirectionalAtom}s which behaves as a single unit.
111     \end{itemize}
112 tim 2688
113 tim 2730 Every Molecule, Atom and DirectionalAtom in {\sc oopse} have their
114     own names which are specified in the {\tt .md} file. In contrast,
115     RigidBodies are denoted by their membership and index inside a
116     particular molecule: [MoleculeName]\_RB\_[index] (the contents
117     inside the brackets depend on the specifics of the simulation). The
118     names of rigid bodies are generated automatically. For example, the
119     name of the first rigid body in a DMPC molecule is DMPC\_RB\_0.
120    
121     \section{\label{appendixSection:syntax}Syntax of the Select Command}
122    
123     The most general form of the select command is: {\tt select {\it
124     expression}}
125    
126     This expression represents an arbitrary set of StuntDoubles (Atoms
127     or RigidBodies) in {\sc oopse}. Expressions are composed of either
128     name expressions, index expressions, predefined sets, user-defined
129     expressions, comparison operators, within expressions, or logical
130     combinations of the above expression types. Expressions can be
131     combined using parentheses and the Boolean operators.
132    
133     \subsection{\label{appendixSection:logical}Logical expressions}
134    
135     The logical operators allow complex queries to be constructed out of
136     simpler ones using the standard boolean connectives {\bf and}, {\bf
137     or}, {\bf not}. Parentheses can be used to alter the precedence of
138     the operators.
139    
140     \begin{center}
141     \begin{tabular}{|ll|}
142     \hline
143     {\bf logical operator} & {\bf equivalent operator} \\
144     \hline
145     and & ``\&'', ``\&\&'' \\
146     or & ``$|$'', ``$||$'', ``,'' \\
147     not & ``!'' \\
148     \hline
149     \end{tabular}
150     \end{center}
151    
152     \subsection{\label{appendixSection:name}Name expressions}
153    
154     \begin{center}
155 tim 2805 \begin{tabular}{|llp{2in}|}
156 tim 2730 \hline {\bf type of expression} & {\bf examples} & {\bf translation
157     of
158     examples} \\
159     \hline expression without ``.'' & select DMPC & select all
160     StuntDoubles
161     belonging to all DMPC molecules \\
162     & select C* & select all atoms which have atom types beginning with C
163     \\
164     & select DMPC\_RB\_* & select all RigidBodies in DMPC molecules (but
165     only select the rigid bodies, and not the atoms belonging to them). \\
166     \hline expression has one ``.'' & select TIP3P.O\_TIP3P & select the
167     O\_TIP3P
168     atoms belonging to TIP3P molecules \\
169     & select DMPC\_RB\_O.PO4 & select the PO4 atoms belonging to
170     the first
171     RigidBody in each DMPC molecule \\
172     & select DMPC.20 & select the twentieth StuntDouble in each DMPC
173     molecule \\
174     \hline expression has two ``.''s & select DMPC.DMPC\_RB\_?.* &
175     select all atoms
176     belonging to all rigid bodies within all DMPC molecules \\
177     \hline
178     \end{tabular}
179     \end{center}
180    
181     \subsection{\label{appendixSection:index}Index expressions}
182    
183     \begin{center}
184     \begin{tabular}{|lp{4in}|}
185     \hline
186     {\bf examples} & {\bf translation of examples} \\
187     \hline
188     select 20 & select all of the StuntDoubles belonging to Molecule 20 \\
189     select 20 to 30 & select all of the StuntDoubles belonging to
190     molecules which have global indices between 20 (inclusive) and 30
191     (exclusive) \\
192     \hline
193     \end{tabular}
194     \end{center}
195    
196     \subsection{\label{appendixSection:predefined}Predefined sets}
197    
198     \begin{center}
199     \begin{tabular}{|ll|}
200     \hline
201     {\bf keyword} & {\bf description} \\
202     \hline
203     all & select all StuntDoubles \\
204     none & select none of the StuntDoubles \\
205     \hline
206     \end{tabular}
207     \end{center}
208    
209     \subsection{\label{appendixSection:userdefined}User-defined expressions}
210    
211     Users can define arbitrary terms to represent groups of
212     StuntDoubles, and then use the define terms in select commands. The
213     general form for the define command is: {\bf define {\it term
214     expression}}
215    
216     Once defined, the user can specify such terms in boolean expressions
217    
218     {\tt define SSDWATER SSD or SSD1 or SSDRF}
219    
220     {\tt select SSDWATER}
221    
222     \subsection{\label{appendixSection:comparison}Comparison expressions}
223    
224     StuntDoubles can be selected by using comparision operators on their
225     properties. The general form for the comparison command is: a
226     property name, followed by a comparision operator and then a number.
227    
228     \begin{center}
229     \begin{tabular}{|l|l|}
230     \hline
231     {\bf property} & mass, charge \\
232     {\bf comparison operator} & ``$>$'', ``$<$'', ``$=$'', ``$>=$'',
233     ``$<=$'', ``$!=$'' \\
234     \hline
235     \end{tabular}
236     \end{center}
237    
238     For example, the phrase {\tt select mass > 16.0 and charge < -2}
239 tim 2805 would select StuntDoubles which have mass greater than 16.0 and
240 tim 2730 charges less than -2.
241    
242     \subsection{\label{appendixSection:within}Within expressions}
243    
244     The ``within'' keyword allows the user to select all StuntDoubles
245     within the specified distance (in Angstroms) from a selection,
246     including the selected atom itself. The general form for within
247     selection is: {\tt select within(distance, expression)}
248    
249     For example, the phrase {\tt select within(2.5, PO4 or NC4)} would
250     select all StuntDoubles which are within 2.5 angstroms of PO4 or NC4
251     atoms.
252    
253    
254 tim 2811 \section{\label{appendixSection:analysisFramework}Analysis Framework}
255 tim 2730
256     \subsection{\label{appendixSection:StaticProps}StaticProps}
257    
258     {\tt StaticProps} can compute properties which are averaged over
259     some or all of the configurations that are contained within a dump
260     file. The most common example of a static property that can be
261     computed is the pair distribution function between atoms of type $A$
262     and other atoms of type $B$, $g_{AB}(r)$. StaticProps can also be
263     used to compute the density distributions of other molecules in a
264     reference frame {\it fixed to the body-fixed reference frame} of a
265     selected atom or rigid body.
266    
267     There are five seperate radial distribution functions availiable in
268     OOPSE. Since every radial distrbution function invlove the
269     calculation between pairs of bodies, {\tt -{}-sele1} and {\tt
270     -{}-sele2} must be specified to tell StaticProps which bodies to
271     include in the calculation.
272    
273     \begin{description}
274     \item[{\tt -{}-gofr}] Computes the pair distribution function,
275     \begin{equation*}
276     g_{AB}(r) = \frac{1}{\rho_B}\frac{1}{N_A} \langle \sum_{i \in A}
277     \sum_{j \in B} \delta(r - r_{ij}) \rangle
278     \end{equation*}
279     \item[{\tt -{}-r\_theta}] Computes the angle-dependent pair distribution
280     function. The angle is defined by the intermolecular vector
281     $\vec{r}$ and $z$-axis of DirectionalAtom A,
282     \begin{equation*}
283     g_{AB}(r, \cos \theta) = \frac{1}{\rho_B}\frac{1}{N_A} \langle
284     \sum_{i \in A} \sum_{j \in B} \delta(r - r_{ij}) \delta(\cos
285     \theta_{ij} - \cos \theta)\rangle
286     \end{equation*}
287     \item[{\tt -{}-r\_omega}] Computes the angle-dependent pair distribution
288     function. The angle is defined by the $z$-axes of the two
289     DirectionalAtoms A and B.
290     \begin{equation*}
291     g_{AB}(r, \cos \omega) = \frac{1}{\rho_B}\frac{1}{N_A} \langle
292     \sum_{i \in A} \sum_{j \in B} \delta(r - r_{ij}) \delta(\cos
293     \omega_{ij} - \cos \omega)\rangle
294     \end{equation*}
295     \item[{\tt -{}-theta\_omega}] Computes the pair distribution in the angular
296     space $\theta, \omega$ defined by the two angles mentioned above.
297     \begin{equation*}
298     g_{AB}(\cos\theta, \cos \omega) = \frac{1}{\rho_B}\frac{1}{N_A}
299     \langle \sum_{i \in A} \sum_{j \in B} \langle \delta(\cos
300     \theta_{ij} - \cos \theta) \delta(\cos \omega_{ij} - \cos
301     \omega)\rangle
302     \end{equation*}
303     \item[{\tt -{}-gxyz}] Calculates the density distribution of particles of type
304     B in the body frame of particle A. Therefore, {\tt -{}-originsele}
305     and {\tt -{}-refsele} must be given to define A's internal
306     coordinate set as the reference frame for the calculation.
307     \end{description}
308    
309     The vectors (and angles) associated with these angular pair
310     distribution functions are most easily seen in the figure below:
311    
312     \begin{figure}
313     \centering
314 tim 2805 \includegraphics[width=3in]{definition.eps}
315 tim 2730 \caption[Definitions of the angles between directional objects]{ \\
316     Any two directional objects (DirectionalAtoms and RigidBodies) have
317     a set of two angles ($\theta$, and $\omega$) between the z-axes of
318     their body-fixed frames.} \label{oopseFig:gofr}
319     \end{figure}
320    
321     The options available for {\tt StaticProps} are as follows:
322     \begin{longtable}[c]{|EFG|}
323     \caption{StaticProps Command-line Options}
324     \\ \hline
325     {\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline
326     \endhead
327     \hline
328     \endfoot
329     -h& {\tt -{}-help} & Print help and exit \\
330     -V& {\tt -{}-version} & Print version and exit \\
331 tim 2809 -i& {\tt -{}-input} & input dump file \\
332     -o& {\tt -{}-output} & output file name \\
333     -n& {\tt -{}-step} & process every n frame (default=`1') \\
334     -r& {\tt -{}-nrbins} & number of bins for distance (default=`100') \\
335     -a& {\tt -{}-nanglebins} & number of bins for cos(angle) (default= `50') \\
336     -l& {\tt -{}-length} & maximum length (Defaults to 1/2 smallest length of first frame) \\
337     & {\tt -{}-sele1} & select the first StuntDouble set \\
338     & {\tt -{}-sele2} & select the second StuntDouble set \\
339     & {\tt -{}-sele3} & select the third StuntDouble set \\
340     & {\tt -{}-refsele} & select reference (can only be used with {\tt -{}-gxyz}) \\
341     & {\tt -{}-molname} & molecule name \\
342     & {\tt -{}-begin} & begin internal index \\
343     & {\tt -{}-end} & end internal index \\
344 tim 2730 \hline
345     \multicolumn{3}{|l|}{One option from the following group of options is required:} \\
346     \hline
347     & {\tt -{}-gofr} & $g(r)$ \\
348     & {\tt -{}-r\_theta} & $g(r, \cos(\theta))$ \\
349     & {\tt -{}-r\_omega} & $g(r, \cos(\omega))$ \\
350     & {\tt -{}-theta\_omega} & $g(\cos(\theta), \cos(\omega))$ \\
351     & {\tt -{}-gxyz} & $g(x, y, z)$ \\
352     & {\tt -{}-p2} & $P_2$ order parameter ({\tt -{}-sele1} and {\tt -{}-sele2} must be specified) \\
353     & {\tt -{}-scd} & $S_{CD}$ order parameter(either {\tt -{}-sele1}, {\tt -{}-sele2}, {\tt -{}-sele3} are specified or {\tt -{}-molname}, {\tt -{}-begin}, {\tt -{}-end} are specified) \\
354     & {\tt -{}-density} & density plot ({\tt -{}-sele1} must be specified) \\
355     & {\tt -{}-slab\_density} & slab density ({\tt -{}-sele1} must be specified)
356     \end{longtable}
357    
358     \subsection{\label{appendixSection:DynamicProps}DynamicProps}
359    
360     {\tt DynamicProps} computes time correlation functions from the
361     configurations stored in a dump file. Typical examples of time
362     correlation functions are the mean square displacement and the
363     velocity autocorrelation functions. Once again, the selection
364     syntax can be used to specify the StuntDoubles that will be used for
365     the calculation. A general time correlation function can be thought
366     of as:
367     \begin{equation}
368     C_{AB}(t) = \langle \vec{u}_A(t) \cdot \vec{v}_B(0) \rangle
369     \end{equation}
370     where $\vec{u}_A(t)$ is a vector property associated with an atom of
371     type $A$ at time $t$, and $\vec{v}_B(t^{\prime})$ is a different
372     vector property associated with an atom of type $B$ at a different
373     time $t^{\prime}$. In most autocorrelation functions, the vector
374     properties ($\vec{v}$ and $\vec{u}$) and the types of atoms ($A$ and
375     $B$) are identical, and the three calculations built in to {\tt
376     DynamicProps} make these assumptions. It is possible, however, to
377     make simple modifications to the {\tt DynamicProps} code to allow
378     the use of {\it cross} time correlation functions (i.e. with
379     different vectors). The ability to use two selection scripts to
380     select different types of atoms is already present in the code.
381    
382     The options available for DynamicProps are as follows:
383     \begin{longtable}[c]{|EFG|}
384     \caption{DynamicProps Command-line Options}
385     \\ \hline
386     {\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline
387     \endhead
388     \hline
389     \endfoot
390     -h& {\tt -{}-help} & Print help and exit \\
391     -V& {\tt -{}-version} & Print version and exit \\
392 tim 2809 -i& {\tt -{}-input} & input dump file \\
393     -o& {\tt -{}-output} & output file name \\
394     & {\tt -{}-sele1} & select first StuntDouble set \\
395     & {\tt -{}-sele2} & select second StuntDouble set (if sele2 is not set, use script from sele1) \\
396 tim 2730 \hline
397     \multicolumn{3}{|l|}{One option from the following group of options is required:} \\
398     \hline
399     -r& {\tt -{}-rcorr} & compute mean square displacement \\
400     -v& {\tt -{}-vcorr} & compute velocity correlation function \\
401     -d& {\tt -{}-dcorr} & compute dipole correlation function
402     \end{longtable}
403    
404 tim 2811 \section{\label{appendixSection:tools}Other Useful Utilities}
405    
406     \subsection{\label{appendixSection:Dump2XYZ}Dump2XYZ}
407    
408     Dump2XYZ can transform an OOPSE dump file into a xyz file which can
409     be opened by other molecular dynamics viewers such as Jmol and VMD.
410     The options available for Dump2XYZ are as follows:
411    
412    
413     \begin{longtable}[c]{|EFG|}
414     \caption{Dump2XYZ Command-line Options}
415     \\ \hline
416     {\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline
417     \endhead
418     \hline
419     \endfoot
420     -h & {\tt -{}-help} & Print help and exit \\
421     -V & {\tt -{}-version} & Print version and exit \\
422     -i & {\tt -{}-input} & input dump file \\
423     -o & {\tt -{}-output} & output file name \\
424     -n & {\tt -{}-frame} & print every n frame (default=`1') \\
425     -w & {\tt -{}-water} & skip the the waters (default=off) \\
426     -m & {\tt -{}-periodicBox} & map to the periodic box (default=off)\\
427     -z & {\tt -{}-zconstraint} & replace the atom types of zconstraint molecules (default=off) \\
428     -r & {\tt -{}-rigidbody} & add a pseudo COM atom to rigidbody (default=off) \\
429     -t & {\tt -{}-watertype} & replace the atom type of water model (default=on) \\
430     -b & {\tt -{}-basetype} & using base atom type (default=off) \\
431     & {\tt -{}-repeatX} & The number of images to repeat in the x direction (default=`0') \\
432     & {\tt -{}-repeatY} & The number of images to repeat in the y direction (default=`0') \\
433     & {\tt -{}-repeatZ} & The number of images to repeat in the z direction (default=`0') \\
434     -s & {\tt -{}-selection} & By specifying {\tt -{}-selection}=``selection command'' with Dump2XYZ, the user can select an arbitrary set of StuntDoubles to be
435     converted. \\
436     & {\tt -{}-originsele} & By specifying {\tt -{}-originsele}=``selection command'' with Dump2XYZ, the user can re-center the origin of the system around a specific StuntDouble \\
437     & {\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}.
438     \end{longtable}
439    
440 tim 2730 \subsection{\label{appendixSection:hydrodynamics}Hydrodynamics}
441 tim 2811
442     \begin{longtable}[c]{|EFG|}
443     \caption{Hydrodynamics Command-line Options}
444     \\ \hline
445     {\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline
446     \endhead
447     \hline
448     \endfoot
449     -h & {\tt -{}-help} & Print help and exit \\
450     -V & {\tt -{}-version} & Print version and exit \\
451     -i & {\tt -{}-input} & input dump file \\
452     -o & {\tt -{}-output} & output file prefix (default=`hydro') \\
453     -b & {\tt -{}-beads} & generate the beads only, hydrodynamics calculation will not be performed (default=off)\\
454     & {\tt -{}-model} & hydrodynamics model (support ``AnalyticalModel'', ``RoughShell'' and ``BeadModel'') \\
455     \end{longtable}