1 |
|
\appendix |
2 |
|
\chapter{\label{chapt:oopse}Object-Oriented Parallel Simulation Engine} |
3 |
|
|
4 |
< |
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 |
< |
Scientific Computing community\cite{Wilson2006}. For instance, in |
8 |
< |
the last 20 years , there are quite a few MD packages that were |
4 |
> |
The absence of modern software development practices has been a |
5 |
> |
bottleneck limiting progress in the Scientific Computing |
6 |
> |
community\cite{Wilson2006}. In the last 20 years , a large number of |
7 |
> |
few MD packages\cite{Brooks1983, Vincent1995, Kale1999} were |
8 |
|
developed to solve common MD problems and perform robust simulations |
9 |
< |
. However, many of the codes are legacy programs that are either |
10 |
< |
poorly organized or extremely complex. Usually, these packages were |
11 |
< |
contributed by scientists without official computer science |
12 |
< |
training. The development of most MD applications are lack of strong |
13 |
< |
coordination to enforce design and programming guidelines. Moreover, |
14 |
< |
most MD programs also suffer from missing design and implement |
15 |
< |
documents which is crucial to the maintenance and extensibility. |
16 |
< |
Along the way of studying structural and dynamic processes in |
18 |
< |
condensed phase systems like biological membranes and nanoparticles, |
19 |
< |
we developed and maintained an Object-Oriented Parallel Simulation |
20 |
< |
Engine ({\sc OOPSE}). This new molecular dynamics package has some |
21 |
< |
unique features |
9 |
> |
. Most of these are commercial programs that are either poorly |
10 |
> |
written or extremely complicated to use correctly. This situation |
11 |
> |
prevents researchers from reusing or extending those packages to do |
12 |
> |
cutting-edge research effectively. In the process of studying |
13 |
> |
structural and dynamic processes in condensed phase systems like |
14 |
> |
biological 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 |
|
\begin{enumerate} |
18 |
|
\item {\sc OOPSE} performs Molecular Dynamics (MD) simulations on non-standard |
19 |
|
atom types (transition metals, point dipoles, sticky potentials, |
33 |
|
|
34 |
|
\section{\label{appendixSection:architecture }Architecture} |
35 |
|
|
36 |
< |
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 |
< |
\texttt{DynamicProps} (see |
63 |
< |
Sec.~\ref{appendixSection:appendixSection:DynamicProps}), |
64 |
< |
\texttt{Dump2XYZ} (see |
65 |
< |
Sec.~\ref{appendixSection:appendixSection:Dump2XYZ}), \texttt{Hydro} |
71 |
< |
(see Sec.~\ref{appendixSection:appendixSection:hydrodynamics}) |
72 |
< |
\textit{etc}. |
36 |
> |
Mainly written by C++ and Fortran90, {\sc OOPSE} uses C++ Standard |
37 |
> |
Template Library (STL) and fortran modules as a foundation. As an |
38 |
> |
extensive set of the STL and Fortran90 modules, {\sc Base Classes} |
39 |
> |
provide generic implementations of mathematical objects (e.g., |
40 |
> |
matrices, vectors, polynomials, random number generators) and |
41 |
> |
advanced data structures and algorithms(e.g., tuple, bitset, generic |
42 |
> |
data and string manipulation). The molecular data structures for the |
43 |
> |
representation of atoms, bonds, bends, torsions, rigid bodies and |
44 |
> |
molecules \textit{etc} are contained in the {\sc Kernel} which is |
45 |
> |
implemented with {\sc Base Classes} and are carefully designed to |
46 |
> |
provide maximum extensibility and flexibility. The functionality |
47 |
> |
required for applications is provided by the third layer which |
48 |
> |
contains Input/Output, Molecular Mechanics and Structure modules. |
49 |
> |
The Input/Output module not only implements general methods for file |
50 |
> |
handling, but also defines a generic force field interface. Another |
51 |
> |
important component of Input/Output module is the parser for |
52 |
> |
meta-data files, which has been implemented using the ANother Tool |
53 |
> |
for Language Recognition(ANTLR)\cite{Parr1995, Schaps1999} syntax. |
54 |
> |
The Molecular Mechanics module consists of energy minimization and a |
55 |
> |
wide varieties of integration methods(see |
56 |
> |
Chap.~\ref{chapt:methodology}). The structure module contains a |
57 |
> |
flexible and powerful selection library which syntax is elaborated |
58 |
> |
in Sec.~\ref{appendixSection:syntax}. The top layer is made of the |
59 |
> |
main program of the package, \texttt{oopse} and it corresponding |
60 |
> |
parallel version \texttt{oopse\_MPI}, as well as other useful |
61 |
> |
utilities, such as \texttt{StatProps} (see |
62 |
> |
Sec.~\ref{appendixSection:StaticProps}), \texttt{DynamicProps} (see |
63 |
> |
Sec.~\ref{appendixSection:DynamicProps}), \texttt{Dump2XYZ} (see |
64 |
> |
Sec.~\ref{appendixSection:Dump2XYZ}), \texttt{Hydro} (see |
65 |
> |
Sec.~\ref{appendixSection:hydrodynamics}) \textit{etc}. |
66 |
|
|
67 |
|
\begin{figure} |
68 |
|
\centering |
71 |
|
of {\sc OOPSE}} \label{appendixFig:architecture} |
72 |
|
\end{figure} |
73 |
|
|
74 |
< |
\section{\label{appendixSection:desginPattern}Design Pattern} |
74 |
> |
\section{\label{appendixSection:desginPattern}Design Patterns} |
75 |
|
|
76 |
|
Design patterns are optimal solutions to commonly-occurring problems |
77 |
|
in software design. Although originated as an architectural concept |
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 |
< |
solutions succinctly. |
85 |
> |
different problems as necessary. As one of the latest advanced |
86 |
> |
techniques to emerge from object-oriented community, design patterns |
87 |
> |
were applied in some of the modern scientific software applications, |
88 |
> |
such as JMol, {\sc OOPSE}\cite{Meineke2005} and |
89 |
> |
PROTOMOL\cite{Matthey2004} \textit{etc}. The following sections |
90 |
> |
enumerates some of the patterns used in {\sc OOPSE}. |
91 |
|
|
92 |
< |
Patterns are usually described using a format that includes the |
97 |
< |
following information: |
98 |
< |
\begin{enumerate} |
99 |
< |
\item The \emph{name} that is commonly used for the pattern. Good pattern names form a vocabulary for |
100 |
< |
discussing conceptual abstractions. a pattern may have more than one commonly used or recognizable name |
101 |
< |
in the literature. In this case it is common practice to document these nicknames or synonyms under |
102 |
< |
the heading of \emph{Aliases} or \emph{Also Known As}. |
103 |
< |
\item The \emph{motivation} or \emph{context} that this pattern applies |
104 |
< |
to. Sometimes, it will include some prerequisites that should be satisfied before deciding to use a pattern |
105 |
< |
\item The \emph{solution} to the problem that the pattern |
106 |
< |
addresses. It describes how to construct the necessary work products. The description may include |
107 |
< |
pictures, diagrams and prose which identify the pattern's structure, its participants, and their |
108 |
< |
collaborations, to show how the problem is solved. |
109 |
< |
\item The \emph{consequences} of using the given solution to solve a |
110 |
< |
problem, both positive and negative. |
111 |
< |
\end{enumerate} |
92 |
> |
\subsection{\label{appendixSection:singleton}Singletons} |
93 |
|
|
113 |
– |
As one of the latest advanced techniques emerged from |
114 |
– |
object-oriented community, design patterns were applied in some of |
115 |
– |
the modern scientific software applications, such as JMol, {\sc |
116 |
– |
OOPSE}\cite{Meineke05} and PROTOMOL\cite{Matthey05} \textit{etc}. |
117 |
– |
The following sections enumerates some of the patterns used in {\sc |
118 |
– |
OOPSE}. |
119 |
– |
|
120 |
– |
\subsection{\label{appendixSection:singleton}Singleton} |
94 |
|
The Singleton pattern not only provides a mechanism to restrict |
95 |
|
instantiation of a class to one object, but also provides a global |
96 |
< |
point of access to the object. Currently implemented as a global |
97 |
< |
variable, the logging utility which reports error and warning |
98 |
< |
messages to the console in {\sc OOPSE} is a good candidate for |
99 |
< |
applying the Singleton pattern to avoid the global namespace |
100 |
< |
pollution.Although the singleton pattern can be implemented in |
101 |
< |
various ways to account for different aspects of the software |
102 |
< |
designs, such as lifespan control \textit{etc}, we only use the |
103 |
< |
static data approach in {\sc OOPSE}. {\tt IntegratorFactory} class |
104 |
< |
is declared as |
105 |
< |
\begin{lstlisting}[float,caption={[A classic Singleton design pattern implementation(I)] Declaration of {\tt IntegratorFactory} class.},label={appendixScheme:singletonDeclaration}] |
96 |
> |
point of access to the object. Although the singleton pattern can be |
97 |
> |
implemented in various ways to account for different aspects of the |
98 |
> |
software designs, such as lifespan control \textit{etc}, we only use |
99 |
> |
the static data approach in {\sc OOPSE}. The declaration and |
100 |
> |
implementation of IntegratorFactory class are given by declared in |
101 |
> |
List.~\ref{appendixScheme:singletonDeclaration} and |
102 |
> |
Scheme.~\ref{appendixScheme:singletonImplementation} respectively. |
103 |
> |
Since the constructor is declared as protected, a client can not |
104 |
> |
instantiate IntegratorFactory directly. Moreover, since the member |
105 |
> |
function getInstance serves as the only entry of access to |
106 |
> |
IntegratorFactory, this approach fulfills the basic requirement, a |
107 |
> |
single instance. Another consequence of this approach is the |
108 |
> |
automatic destruction since static data are destroyed upon program |
109 |
> |
termination. |
110 |
|
|
111 |
< |
class IntegratorFactory { |
112 |
< |
public: |
113 |
< |
static IntegratorFactory* getInstance(); |
114 |
< |
protected: |
115 |
< |
IntegratorFactory(); |
116 |
< |
private: |
117 |
< |
static IntegratorFactory* instance_; |
111 |
> |
\subsection{\label{appendixSection:factoryMethod}Factory Methods} |
112 |
> |
|
113 |
> |
The Factory Method pattern is a creational pattern and deals with |
114 |
> |
the problem of creating objects without specifying the exact class |
115 |
> |
of object that will be created. Factory method is typically |
116 |
> |
implemented by delegating the creation operation to the subclasses. |
117 |
> |
One of the most popular Factory pattern is Parameterized Factory |
118 |
> |
pattern which creates products based on their identifiers (see |
119 |
> |
Scheme.~\ref{appendixScheme:factoryDeclaration}). If the identifier |
120 |
> |
has been already registered, the factory method will invoke the |
121 |
> |
corresponding creator (see |
122 |
> |
Scheme.~\ref{appendixScheme:integratorCreator}) which utilizes the |
123 |
> |
modern C++ template technique to avoid excess subclassing. |
124 |
> |
|
125 |
> |
\subsection{\label{appendixSection:visitorPattern}Visitor} |
126 |
> |
|
127 |
> |
The visitor pattern is designed to decouple the data structure and |
128 |
> |
algorithms used upon them by collecting related operation from |
129 |
> |
element classes into other visitor classes, which is equivalent to |
130 |
> |
adding virtual functions into a set of classes without modifying |
131 |
> |
their interfaces. Fig.~\ref{appendixFig:visitorUML} demonstrates the |
132 |
> |
structure of a Visitor pattern which is used extensively in {\tt |
133 |
> |
Dump2XYZ}. In order to convert an OOPSE dump file, a series of |
134 |
> |
distinct operations are performed on different StuntDoubles (See the |
135 |
> |
class hierarchy in Fig.~\ref{oopseFig:hierarchy} and the declaration |
136 |
> |
in Scheme.~\ref{appendixScheme:element}). Since the hierarchies |
137 |
> |
remain stable, it is easy to define a visit operation (see |
138 |
> |
Scheme.~\ref{appendixScheme:visitor}) for each class of StuntDouble. |
139 |
> |
Note that using Composite pattern\cite{Gamma1994}, CompositeVisitor |
140 |
> |
manages a priority visitor list and handles the execution of every |
141 |
> |
visitor in the priority list on different StuntDoubles. |
142 |
> |
|
143 |
> |
\begin{lstlisting}[float,caption={[A classic Singleton design pattern implementation(I)] The declaration of of simple Singleton pattern.},label={appendixScheme:singletonDeclaration}] |
144 |
> |
|
145 |
> |
class IntegratorFactory { public: |
146 |
> |
static IntegratorFactory* getInstance(); protected: |
147 |
> |
IntegratorFactory(); |
148 |
> |
private: |
149 |
> |
static IntegratorFactory* instance_; |
150 |
|
}; |
151 |
|
|
152 |
|
\end{lstlisting} |
144 |
– |
The corresponding implementation is |
145 |
– |
\begin{lstlisting}[float,caption={[A classic implementation of Singleton design pattern (II)] Implementation of {\tt IntegratorFactory} class.},label={appendixScheme:singletonImplementation}] |
153 |
|
|
154 |
+ |
\begin{lstlisting}[float,caption={[A classic implementation of Singleton design pattern (II)] The implementation of simple Singleton pattern.},label={appendixScheme:singletonImplementation}] |
155 |
+ |
|
156 |
|
IntegratorFactory::instance_ = NULL; |
157 |
|
|
158 |
|
IntegratorFactory* getInstance() { |
163 |
|
} |
164 |
|
|
165 |
|
\end{lstlisting} |
157 |
– |
Since constructor is declared as {\tt protected}, a client can not |
158 |
– |
instantiate {\tt IntegratorFactory} directly. Moreover, since the |
159 |
– |
member function {\tt getInstance} serves as the only entry of access |
160 |
– |
to {\tt IntegratorFactory}, this approach fulfills the basic |
161 |
– |
requirement, a single instance. Another consequence of this approach |
162 |
– |
is the automatic destruction since static data are destroyed upon |
163 |
– |
program termination. |
166 |
|
|
167 |
< |
\subsection{\label{appendixSection:factoryMethod}Factory Method} |
167 |
> |
\begin{lstlisting}[float,caption={[The implementation of Parameterized Factory pattern (I)]Source code of IntegratorFactory class.},label={appendixScheme:factoryDeclaration}] |
168 |
|
|
169 |
< |
Categoried as a creational pattern, the Factory Method pattern deals |
170 |
< |
with the problem of creating objects without specifying the exact |
169 |
< |
class of object that will be created. Factory Method is typically |
170 |
< |
implemented by delegating the creation operation to the subclasses. |
169 |
> |
class IntegratorFactory { public: |
170 |
> |
typedef std::map<string, IntegratorCreator*> CreatorMapType; |
171 |
|
|
172 |
< |
Registers a creator with a type identifier. Looks up the type |
173 |
< |
identifier in the internal map. If it is found, it invokes the |
174 |
< |
corresponding creator for the type identifier and returns its |
175 |
< |
result. |
176 |
< |
\begin{lstlisting}[float,caption={[The implementation of Factory pattern (I)].},label={appendixScheme:factoryDeclaration}] |
172 |
> |
bool registerIntegrator(IntegratorCreator* creator) { |
173 |
> |
return creatorMap_.insert(creator->getIdent(), creator).second; |
174 |
> |
} |
175 |
|
|
176 |
< |
class IntegratorFactory { |
177 |
< |
public: |
178 |
< |
typedef std::map<string, IntegratorCreator*> CreatorMapType; |
176 |
> |
Integrator* createIntegrator(const string& id, SimInfo* info) { |
177 |
> |
Integrator* result = NULL; |
178 |
> |
CreatorMapType::iterator i = creatorMap_.find(id); |
179 |
> |
if (i != creatorMap_.end()) { |
180 |
> |
result = (i->second)->create(info); |
181 |
> |
} |
182 |
> |
return result; |
183 |
> |
} |
184 |
|
|
185 |
< |
bool registerIntegrator(IntegratorCreator* creator); |
186 |
< |
|
184 |
< |
Integrator* createIntegrator(const string& id, SimInfo* info); |
185 |
< |
|
186 |
< |
private: |
187 |
< |
CreatorMapType creatorMap_; |
185 |
> |
private: |
186 |
> |
CreatorMapType creatorMap_; |
187 |
|
}; |
189 |
– |
|
190 |
– |
\end{lstlisting} |
191 |
– |
|
192 |
– |
\begin{lstlisting}[float,caption={[The implementation of Factory pattern (II)].},label={appendixScheme:factoryDeclarationImplementation}] |
193 |
– |
|
194 |
– |
bool IntegratorFactory::unregisterIntegrator(const string& id) { |
195 |
– |
return creatorMap_.erase(id) == 1; |
196 |
– |
} |
197 |
– |
|
198 |
– |
Integrator* IntegratorFactory::createIntegrator(const string& id, |
199 |
– |
SimInfo* info) { |
200 |
– |
CreatorMapType::iterator i = creatorMap_.find(id); |
201 |
– |
if (i != creatorMap_.end()) { |
202 |
– |
return (i->second)->create(info); |
203 |
– |
} else { |
204 |
– |
return NULL; |
205 |
– |
} |
206 |
– |
} |
207 |
– |
|
188 |
|
\end{lstlisting} |
189 |
|
|
190 |
< |
\begin{lstlisting}[float,caption={[The implementation of Factory pattern (III)].},label={appendixScheme:integratorCreator}] |
190 |
> |
\begin{lstlisting}[float,caption={[The implementation of Parameterized Factory pattern (III)]Source code of creator classes.},label={appendixScheme:integratorCreator}] |
191 |
|
|
192 |
|
class IntegratorCreator { |
193 |
|
public: |
197 |
|
|
198 |
|
virtual Integrator* create(SimInfo* info) const = 0; |
199 |
|
|
200 |
< |
private: |
200 |
> |
private: |
201 |
|
string ident_; |
202 |
|
}; |
203 |
|
|
204 |
< |
template<class ConcreteIntegrator> |
205 |
< |
class IntegratorBuilder : public IntegratorCreator { |
204 |
> |
template<class ConcreteIntegrator> class IntegratorBuilder : public |
205 |
> |
IntegratorCreator { |
206 |
|
public: |
207 |
< |
IntegratorBuilder(const string& ident) : IntegratorCreator(ident) {} |
207 |
> |
IntegratorBuilder(const string& ident) |
208 |
> |
: IntegratorCreator(ident) {} |
209 |
|
virtual Integrator* create(SimInfo* info) const { |
210 |
|
return new ConcreteIntegrator(info); |
211 |
|
} |
212 |
|
}; |
213 |
|
\end{lstlisting} |
214 |
|
|
234 |
– |
\subsection{\label{appendixSection:visitorPattern}Visitor} |
235 |
– |
|
236 |
– |
The purpose of the Visitor Pattern is to encapsulate an operation |
237 |
– |
that you want to perform on the elements. The operation being |
238 |
– |
performed on a structure can be switched without changing the |
239 |
– |
interfaces of the elements. In other words, one can add virtual |
240 |
– |
functions into a set of classes without modifying their interfaces. |
241 |
– |
The UML class diagram of Visitor patten is shown in |
242 |
– |
Fig.~\ref{appendixFig:visitorUML}. {\tt Dump2XYZ} program in |
243 |
– |
Sec.~\ref{appendixSection:Dump2XYZ} uses Visitor pattern |
244 |
– |
extensively. |
245 |
– |
|
246 |
– |
\begin{figure} |
247 |
– |
\centering |
248 |
– |
\includegraphics[width=\linewidth]{visitor.eps} |
249 |
– |
\caption[The architecture of {\sc OOPSE}] {Overview of the structure |
250 |
– |
of {\sc OOPSE}} \label{appendixFig:visitorUML} |
251 |
– |
\end{figure} |
252 |
– |
|
253 |
– |
\begin{lstlisting}[float,caption={[The implementation of Visitor pattern (I)]Source code of the visitor classes.},label={appendixScheme:visitor}] |
254 |
– |
|
255 |
– |
class BaseVisitor{ |
256 |
– |
public: |
257 |
– |
virtual void visit(Atom* atom); |
258 |
– |
virtual void visit(DirectionalAtom* datom); |
259 |
– |
virtual void visit(RigidBody* rb); |
260 |
– |
}; |
261 |
– |
|
262 |
– |
\end{lstlisting} |
263 |
– |
|
215 |
|
\begin{lstlisting}[float,caption={[The implementation of Visitor pattern (II)]Source code of the element classes.},label={appendixScheme:element}] |
216 |
|
|
217 |
|
class StuntDouble { |
242 |
|
|
243 |
|
\end{lstlisting} |
244 |
|
|
245 |
+ |
\begin{lstlisting}[float,caption={[The implementation of Visitor pattern (I)]Source code of the visitor classes.},label={appendixScheme:visitor}] |
246 |
+ |
|
247 |
+ |
class BaseVisitor{ |
248 |
+ |
public: |
249 |
+ |
virtual void visit(Atom* atom); |
250 |
+ |
virtual void visit(DirectionalAtom* datom); |
251 |
+ |
virtual void visit(RigidBody* rb); |
252 |
+ |
}; |
253 |
+ |
|
254 |
+ |
class BaseAtomVisitor:public BaseVisitor{ |
255 |
+ |
public: |
256 |
+ |
virtual void visit(Atom* atom); |
257 |
+ |
virtual void visit(DirectionalAtom* datom); |
258 |
+ |
virtual void visit(RigidBody* rb); |
259 |
+ |
}; |
260 |
+ |
|
261 |
+ |
class CompositeVisitor: public BaseVisitor { |
262 |
+ |
public: |
263 |
+ |
typedef list<pair<BaseVisitor*, int> > VistorListType; |
264 |
+ |
typedef VistorListType::iterator VisitorListIterator; |
265 |
+ |
virtual void visit(Atom* atom) { |
266 |
+ |
VisitorListIterator i; |
267 |
+ |
BaseVisitor* curVisitor; |
268 |
+ |
for(i = visitorScheme.begin();i != visitorScheme.end();++i) { |
269 |
+ |
atom->accept(*i); |
270 |
+ |
} |
271 |
+ |
} |
272 |
+ |
|
273 |
+ |
virtual void visit(DirectionalAtom* datom) { |
274 |
+ |
VisitorListIterator i; |
275 |
+ |
BaseVisitor* curVisitor; |
276 |
+ |
for(i = visitorScheme.begin();i != visitorScheme.end();++i) { |
277 |
+ |
atom->accept(*i); |
278 |
+ |
} |
279 |
+ |
} |
280 |
+ |
|
281 |
+ |
virtual void visit(RigidBody* rb) { |
282 |
+ |
VisitorListIterator i; |
283 |
+ |
std::vector<Atom*> myAtoms; |
284 |
+ |
std::vector<Atom*>::iterator ai; |
285 |
+ |
myAtoms = rb->getAtoms(); |
286 |
+ |
for(i = visitorScheme.begin();i != visitorScheme.end();++i) { |
287 |
+ |
rb->accept(*i); |
288 |
+ |
for(ai = myAtoms.begin(); ai != myAtoms.end(); ++ai){ |
289 |
+ |
(*ai)->accept(*i); |
290 |
+ |
} |
291 |
+ |
} |
292 |
+ |
|
293 |
+ |
void addVisitor(BaseVisitor* v, int priority); |
294 |
+ |
protected: |
295 |
+ |
VistorListType visitorList; |
296 |
+ |
}; |
297 |
+ |
\end{lstlisting} |
298 |
+ |
|
299 |
+ |
\begin{figure} |
300 |
+ |
\centering |
301 |
+ |
\includegraphics[width=\linewidth]{visitor.eps} |
302 |
+ |
\caption[The UML class diagram of Visitor patten] {The UML class |
303 |
+ |
diagram of Visitor patten.} \label{appendixFig:visitorUML} |
304 |
+ |
\end{figure} |
305 |
+ |
|
306 |
+ |
\begin{figure} |
307 |
+ |
\centering |
308 |
+ |
\includegraphics[width=\linewidth]{hierarchy.eps} |
309 |
+ |
\caption[Class hierarchy for ojects in {\sc OOPSE}]{ A diagram of |
310 |
+ |
the class hierarchy. Objects below others on the diagram inherit |
311 |
+ |
data structures and functions from their parent classes above them.} |
312 |
+ |
\label{oopseFig:hierarchy} |
313 |
+ |
\end{figure} |
314 |
+ |
|
315 |
|
\section{\label{appendixSection:concepts}Concepts} |
316 |
|
|
317 |
|
OOPSE manipulates both traditional atoms as well as some objects |
318 |
|
that {\it behave like atoms}. These objects can be rigid |
319 |
|
collections of atoms or atoms which have orientational degrees of |
320 |
< |
freedom. A diagram of the class heirarchy is illustrated in |
321 |
< |
Fig.~\ref{oopseFig:heirarchy}. Every Molecule, Atom and |
320 |
> |
freedom. A diagram of the class hierarchy is illustrated in |
321 |
> |
Fig.~\ref{oopseFig:hierarchy}. Every Molecule, Atom and |
322 |
|
DirectionalAtom in {\sc OOPSE} have their own names which are |
323 |
< |
specified in the {\tt .md} file. In contrast, RigidBodies are |
323 |
> |
specified in the meta data file. In contrast, RigidBodies are |
324 |
|
denoted by their membership and index inside a particular molecule: |
325 |
|
[MoleculeName]\_RB\_[index] (the contents inside the brackets depend |
326 |
|
on the specifics of the simulation). The names of rigid bodies are |
327 |
|
generated automatically. For example, the name of the first rigid |
328 |
|
body in a DMPC molecule is DMPC\_RB\_0. |
308 |
– |
\begin{figure} |
309 |
– |
\centering |
310 |
– |
\includegraphics[width=\linewidth]{heirarchy.eps} |
311 |
– |
\caption[Class heirarchy for StuntDoubles in {\sc OOPSE}]{ The class |
312 |
– |
heirarchy of StuntDoubles in {\sc OOPSE}. |
329 |
|
\begin{itemize} |
330 |
|
\item A {\bf StuntDouble} is {\it any} object that can be manipulated by the |
331 |
|
integrators and minimizers. |
334 |
|
\item A {\bf RigidBody} is a collection of {\bf Atom}s or {\bf |
335 |
|
DirectionalAtom}s which behaves as a single unit. |
336 |
|
\end{itemize} |
321 |
– |
} \label{oopseFig:heirarchy} |
322 |
– |
\end{figure} |
337 |
|
|
338 |
|
\section{\label{appendixSection:syntax}Syntax of the Select Command} |
339 |
|
|
340 |
< |
The most general form of the select command is: {\tt select {\it |
341 |
< |
expression}}. This expression represents an arbitrary set of |
328 |
< |
StuntDoubles (Atoms or RigidBodies) in {\sc OOPSE}. Expressions are |
329 |
< |
composed of either name expressions, index expressions, predefined |
330 |
< |
sets, user-defined expressions, comparison operators, within |
331 |
< |
expressions, or logical combinations of the above expression types. |
332 |
< |
Expressions can be combined using parentheses and the Boolean |
333 |
< |
operators. |
340 |
> |
{\sc OOPSE} provides a powerful selection utility to select |
341 |
> |
StuntDoubles. The most general form of the select command is: |
342 |
|
|
343 |
+ |
{\tt select {\it expression}}. |
344 |
+ |
|
345 |
+ |
This expression represents an arbitrary set of StuntDoubles (Atoms |
346 |
+ |
or RigidBodies) in {\sc OOPSE}. Expressions are composed of either |
347 |
+ |
name expressions, index expressions, predefined sets, user-defined |
348 |
+ |
expressions, comparison operators, within expressions, or logical |
349 |
+ |
combinations of the above expression types. Expressions can be |
350 |
+ |
combined using parentheses and the Boolean operators. |
351 |
+ |
|
352 |
|
\subsection{\label{appendixSection:logical}Logical expressions} |
353 |
|
|
354 |
|
The logical operators allow complex queries to be constructed out of |
480 |
|
and other atoms of type $B$, $g_{AB}(r)$. {\tt StaticProps} can |
481 |
|
also be used to compute the density distributions of other molecules |
482 |
|
in a reference frame {\it fixed to the body-fixed reference frame} |
483 |
< |
of a selected atom or rigid body. |
483 |
> |
of a selected atom or rigid body. Due to the fact that the selected |
484 |
> |
StuntDoubles from two selections may be overlapped, {\tt |
485 |
> |
StaticProps} performs the calculation in three stages which are |
486 |
> |
illustrated in Fig.~\ref{oopseFig:staticPropsProcess}. |
487 |
> |
|
488 |
> |
\begin{figure} |
489 |
> |
\centering |
490 |
> |
\includegraphics[width=\linewidth]{staticPropsProcess.eps} |
491 |
> |
\caption[A representation of the three-stage correlations in |
492 |
> |
\texttt{StaticProps}]{This diagram illustrates three-stage |
493 |
> |
processing used by \texttt{StaticProps}. $S_1$ and $S_2$ are the |
494 |
> |
numbers of selected StuntDobules from {\tt -{}-sele1} and {\tt |
495 |
> |
-{}-sele2} respectively, while $C$ is the number of StuntDobules |
496 |
> |
appearing at both sets. The first stage($S_1-C$ and $S_2$) and |
497 |
> |
second stages ($S_1$ and $S_2-C$) are completely non-overlapping. On |
498 |
> |
the contrary, the third stage($C$ and $C$) are completely |
499 |
> |
overlapping} \label{oopseFig:staticPropsProcess} |
500 |
> |
\end{figure} |
501 |
> |
|
502 |
> |
\begin{figure} |
503 |
> |
\centering |
504 |
> |
\includegraphics[width=3in]{definition.eps} |
505 |
> |
\caption[Definitions of the angles between directional objects]{Any |
506 |
> |
two directional objects (DirectionalAtoms and RigidBodies) have a |
507 |
> |
set of two angles ($\theta$, and $\omega$) between the z-axes of |
508 |
> |
their body-fixed frames.} \label{oopseFig:gofr} |
509 |
> |
\end{figure} |
510 |
|
|
511 |
|
There are five seperate radial distribution functions availiable in |
512 |
|
OOPSE. Since every radial distrbution function invlove the |
551 |
|
\end{description} |
552 |
|
|
553 |
|
The vectors (and angles) associated with these angular pair |
554 |
< |
distribution functions are most easily seen in the figure below: |
554 |
> |
distribution functions are most easily seen in |
555 |
> |
Fig.~\ref{oopseFig:gofr}. |
556 |
|
|
513 |
– |
\begin{figure} |
514 |
– |
\centering |
515 |
– |
\includegraphics[width=3in]{definition.eps} |
516 |
– |
\caption[Definitions of the angles between directional objects]{ \\ |
517 |
– |
Any two directional objects (DirectionalAtoms and RigidBodies) have |
518 |
– |
a set of two angles ($\theta$, and $\omega$) between the z-axes of |
519 |
– |
their body-fixed frames.} \label{oopseFig:gofr} |
520 |
– |
\end{figure} |
521 |
– |
|
522 |
– |
Due to the fact that the selected StuntDoubles from two selections |
523 |
– |
may be overlapped, {\tt StaticProps} performs the calculation in |
524 |
– |
three stages which are illustrated in |
525 |
– |
Fig.~\ref{oopseFig:staticPropsProcess}. |
526 |
– |
|
527 |
– |
\begin{figure} |
528 |
– |
\centering |
529 |
– |
\includegraphics[width=\linewidth]{staticPropsProcess.eps} |
530 |
– |
\caption[A representation of the three-stage correlations in |
531 |
– |
\texttt{StaticProps}]{This diagram illustrates three-stage |
532 |
– |
processing used by \texttt{StaticProps}. $S_1$ and $S_2$ are the |
533 |
– |
numbers of selected stuntdobules from {\tt -{}-sele1} and {\tt |
534 |
– |
-{}-sele2} respectively, while $C$ is the number of stuntdobules |
535 |
– |
appearing at both sets. The first stage($S_1-C$ and $S_2$) and |
536 |
– |
second stages ($S_1$ and $S_2-C$) are completely non-overlapping. On |
537 |
– |
the contrary, the third stage($C$ and $C$) are completely |
538 |
– |
overlapping} \label{oopseFig:staticPropsProcess} |
539 |
– |
\end{figure} |
540 |
– |
|
557 |
|
The options available for {\tt StaticProps} are as follows: |
558 |
|
\begin{longtable}[c]{|EFG|} |
559 |
< |
\caption{StaticProps Command-line Options} |
559 |
> |
\caption{STATICPROPS COMMAND-LINE OPTIONS} |
560 |
|
\\ \hline |
561 |
|
{\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline |
562 |
|
\endhead |
616 |
|
select different types of atoms is already present in the code. |
617 |
|
|
618 |
|
For large simulations, the trajectory files can sometimes reach |
619 |
< |
sizes in excess of several gigabytes. In order to effectively |
620 |
< |
analyze that amount of data. In order to prevent a situation where |
621 |
< |
the program runs out of memory due to large trajectories, |
622 |
< |
\texttt{dynamicProps} will estimate the size of free memory at |
623 |
< |
first, and determine the number of frames in each block, which |
608 |
< |
allows the operating system to load two blocks of data |
619 |
> |
sizes in excess of several gigabytes. In order to prevent a |
620 |
> |
situation where the program runs out of memory due to large |
621 |
> |
trajectories, \texttt{dynamicProps} will first estimate the size of |
622 |
> |
free memory, and determine the number of frames in each block, which |
623 |
> |
will allow the operating system to load two blocks of data |
624 |
|
simultaneously without swapping. Upon reading two blocks of the |
625 |
|
trajectory, \texttt{dynamicProps} will calculate the time |
626 |
|
correlation within the first block and the cross correlations |
644 |
|
|
645 |
|
The options available for DynamicProps are as follows: |
646 |
|
\begin{longtable}[c]{|EFG|} |
647 |
< |
\caption{DynamicProps Command-line Options} |
647 |
> |
\caption{DYNAMICPROPS COMMAND-LINE OPTIONS} |
648 |
|
\\ \hline |
649 |
|
{\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline |
650 |
|
\endhead |
673 |
|
and VMD\cite{Humphrey1996}. The options available for Dump2XYZ are |
674 |
|
as follows: |
675 |
|
|
661 |
– |
|
676 |
|
\begin{longtable}[c]{|EFG|} |
677 |
< |
\caption{Dump2XYZ Command-line Options} |
677 |
> |
\caption{DUMP2XYZ COMMAND-LINE OPTIONS} |
678 |
|
\\ \hline |
679 |
|
{\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline |
680 |
|
\endhead |
708 |
|
the beads which are used to approximate the arbitrary shapes. The |
709 |
|
options available for Hydro are as follows: |
710 |
|
\begin{longtable}[c]{|EFG|} |
711 |
< |
\caption{Hydrodynamics Command-line Options} |
711 |
> |
\caption{HYDRODYNAMICS COMMAND-LINE OPTIONS} |
712 |
|
\\ \hline |
713 |
|
{\bf option} & {\bf verbose option} & {\bf behavior} \\ \hline |
714 |
|
\endhead |