6 |
|
* redistribute this software in source and binary code form, provided |
7 |
|
* that the following conditions are met: |
8 |
|
* |
9 |
< |
* 1. Acknowledgement of the program authors must be made in any |
10 |
< |
* publication of scientific results based in part on use of the |
11 |
< |
* program. An acceptable form of acknowledgement is citation of |
12 |
< |
* the article in which the program was described (Matthew |
13 |
< |
* A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
< |
* J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
< |
* Parallel Simulation Engine for Molecular Dynamics," |
16 |
< |
* J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
< |
* |
18 |
< |
* 2. Redistributions of source code must retain the above copyright |
9 |
> |
* 1. Redistributions of source code must retain the above copyright |
10 |
|
* notice, this list of conditions and the following disclaimer. |
11 |
|
* |
12 |
< |
* 3. Redistributions in binary form must reproduce the above copyright |
12 |
> |
* 2. Redistributions in binary form must reproduce the above copyright |
13 |
|
* notice, this list of conditions and the following disclaimer in the |
14 |
|
* documentation and/or other materials provided with the |
15 |
|
* distribution. |
28 |
|
* arising out of the use of or inability to use software, even if the |
29 |
|
* University of Notre Dame has been advised of the possibility of |
30 |
|
* such damages. |
31 |
+ |
* |
32 |
+ |
* SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your |
33 |
+ |
* research, please cite the appropriate papers when you publish your |
34 |
+ |
* work. Good starting points are: |
35 |
+ |
* |
36 |
+ |
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
37 |
+ |
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
38 |
+ |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
39 |
+ |
* [4] Vardeman & Gezelter, in progress (2009). |
40 |
|
*/ |
41 |
|
|
42 |
|
#include <iostream> |
50 |
|
#include "io/DumpReader.hpp" |
51 |
|
#include "utils/simError.h" |
52 |
|
#include "visitors/AtomVisitor.hpp" |
53 |
+ |
#include "visitors/ReplacementVisitor.hpp" |
54 |
|
#include "visitors/CompositeVisitor.hpp" |
55 |
|
#include "visitors/RigidBodyVisitor.hpp" |
56 |
|
#include "visitors/OtherVisitor.hpp" |
60 |
|
#include "visitors/LipidTransVisitor.hpp" |
61 |
|
#include "visitors/AtomNameVisitor.hpp" |
62 |
|
|
63 |
< |
using namespace oopse; |
63 |
> |
using namespace OpenMD; |
64 |
|
|
65 |
|
int main(int argc, char* argv[]){ |
66 |
|
|
69 |
|
|
70 |
|
gengetopt_args_info args_info; |
71 |
|
std::string dumpFileName; |
71 |
– |
std::string mdFileName; |
72 |
|
std::string xyzFileName; |
73 |
|
|
74 |
|
//parse the command line option |
84 |
|
exit(1); |
85 |
|
} |
86 |
|
|
87 |
– |
mdFileName = dumpFileName; |
88 |
– |
mdFileName = mdFileName.substr(0, mdFileName.rfind(".")) + ".md"; |
89 |
– |
|
87 |
|
if (args_info.output_given){ |
88 |
|
xyzFileName = args_info.output_arg; |
89 |
|
} else { |
93 |
|
|
94 |
|
//parse md file and set up the system |
95 |
|
SimCreator creator; |
96 |
< |
SimInfo* info = creator.createSim(mdFileName, false); |
96 |
> |
SimInfo* info = creator.createSim(dumpFileName, false); |
97 |
|
|
101 |
– |
|
102 |
– |
|
98 |
|
//create visitor list |
99 |
|
CompositeVisitor* compositeVisitor = new CompositeVisitor(); |
100 |
< |
|
100 |
> |
|
101 |
|
//create RigidBody Visitor |
102 |
|
if(args_info.rigidbody_flag){ |
103 |
|
RBCOMVisitor* rbCOMVisitor = new RBCOMVisitor(info); |
108 |
|
SSDAtomVisitor* ssdVisitor = new SSDAtomVisitor(info); |
109 |
|
compositeVisitor->addVisitor(ssdVisitor, 800); |
110 |
|
|
116 |
– |
LinearAtomVisitor* linearVisitor = new LinearAtomVisitor(info); |
117 |
– |
compositeVisitor->addVisitor(linearVisitor, 750); |
118 |
– |
if (args_info.gb_given) { |
119 |
– |
linearVisitor->addGayBerneAtomType(args_info.gb_arg); |
120 |
– |
} |
121 |
– |
|
122 |
– |
GBLipidAtomVisitor* gbLipidVisitor = new GBLipidAtomVisitor(info); |
123 |
– |
compositeVisitor->addVisitor(gbLipidVisitor, 740); |
124 |
– |
|
111 |
|
//create default atom visitor |
112 |
|
DefaultAtomVisitor* defaultAtomVisitor = new DefaultAtomVisitor(info); |
113 |
|
compositeVisitor->addVisitor(defaultAtomVisitor, 700); |
114 |
|
|
115 |
< |
//create waterType visitor |
116 |
< |
if(args_info.watertype_flag){ |
117 |
< |
WaterTypeVisitor* waterTypeVisitor = new WaterTypeVisitor; |
118 |
< |
compositeVisitor->addVisitor(waterTypeVisitor, 600); |
119 |
< |
} |
120 |
< |
|
115 |
> |
// if we gave the -w option, we want to skip the waters: |
116 |
> |
if (!args_info.water_given) { |
117 |
> |
//create waterType visitor |
118 |
> |
if(args_info.watertype_flag){ |
119 |
> |
WaterTypeVisitor* waterTypeVisitor = new WaterTypeVisitor; |
120 |
> |
compositeVisitor->addVisitor(waterTypeVisitor, 600); |
121 |
> |
} |
122 |
> |
} |
123 |
> |
|
124 |
|
if (args_info.basetype_flag) { |
125 |
< |
AtomNameVisitor* atomNameVisitor = new AtomNameVisitor(info); |
126 |
< |
compositeVisitor->addVisitor(atomNameVisitor, 550); |
127 |
< |
|
125 |
> |
AtomNameVisitor* atomNameVisitor = new AtomNameVisitor(info); |
126 |
> |
compositeVisitor->addVisitor(atomNameVisitor, 550); |
127 |
> |
std::cout << compositeVisitor->toString(); |
128 |
|
} |
129 |
|
|
130 |
|
//create ZconsVisitor |
164 |
|
|
165 |
|
//create xyzVisitor |
166 |
|
XYZVisitor* xyzVisitor; |
167 |
+ |
|
168 |
|
if (args_info.selection_given) { |
169 |
|
xyzVisitor = new XYZVisitor(info, args_info.selection_arg); |
170 |
|
} else { |
171 |
|
xyzVisitor = new XYZVisitor(info); |
172 |
|
} |
173 |
< |
compositeVisitor->addVisitor(xyzVisitor, 200); |
173 |
> |
|
174 |
> |
if(args_info.printPosOnly_flag){ |
175 |
> |
bool posOnly = true; |
176 |
> |
xyzVisitor->setPosOnly(posOnly); |
177 |
> |
} |
178 |
> |
|
179 |
> |
compositeVisitor->addVisitor(xyzVisitor, 200); |
180 |
|
|
185 |
– |
std::cout << compositeVisitor->toString(); |
186 |
– |
|
181 |
|
//create prepareVisitor |
182 |
|
PrepareVisitor* prepareVisitor = new PrepareVisitor(); |
183 |
|
|
186 |
|
int nframes = dumpReader->getNFrames(); |
187 |
|
|
188 |
|
|
189 |
< |
std::ofstream xyzStream; |
196 |
< |
xyzStream .open(xyzFileName.c_str()); |
189 |
> |
std::ofstream xyzStream(xyzFileName.c_str()); |
190 |
|
|
198 |
– |
|
191 |
|
SimInfo::MoleculeIterator miter; |
192 |
|
Molecule::IntegrableObjectIterator iiter; |
193 |
|
Molecule::RigidBodyIterator rbIter; |
250 |
|
xyzVisitor->clear(); |
251 |
|
|
252 |
|
}//end for (int i = 0; i < nframes; i += args_info.frame_arg) |
253 |
< |
|
253 |
> |
|
254 |
|
xyzStream.close(); |
263 |
– |
|
255 |
|
delete prepareVisitor; |
256 |
|
delete compositeVisitor; |
257 |
|
delete info; |
267 |
– |
|
258 |
|
} |