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). |
38 |
> |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). |
39 |
> |
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
40 |
> |
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
41 |
|
*/ |
42 |
|
|
43 |
|
#include <iostream> |
64 |
|
|
65 |
|
using namespace OpenMD; |
66 |
|
|
67 |
+ |
using namespace std; |
68 |
|
int main(int argc, char* argv[]){ |
69 |
|
|
68 |
– |
//register force fields |
69 |
– |
registerForceFields(); |
70 |
– |
|
70 |
|
gengetopt_args_info args_info; |
71 |
< |
std::string dumpFileName; |
72 |
< |
std::string xyzFileName; |
73 |
< |
bool printVel; |
74 |
< |
bool printFrc; |
75 |
< |
bool printVec; |
76 |
< |
bool printChrg; |
71 |
> |
string dumpFileName; |
72 |
> |
string xyzFileName; |
73 |
> |
|
74 |
> |
bool printVel(false); |
75 |
> |
bool printFrc(false); |
76 |
> |
bool printVec(false); |
77 |
> |
bool printChrg(false); |
78 |
> |
bool printField(false); |
79 |
|
|
80 |
|
//parse the command line option |
81 |
|
if (cmdline_parser (argc, argv, &args_info) != 0) { |
86 |
|
if (args_info.input_given){ |
87 |
|
dumpFileName = args_info.input_arg; |
88 |
|
} else { |
89 |
< |
std::cerr << "Does not have input file name" << std::endl; |
89 |
> |
cerr << "Does not have input file name" << endl; |
90 |
|
exit(1); |
91 |
|
} |
92 |
|
|
139 |
|
if (args_info.basetype_flag) { |
140 |
|
AtomNameVisitor* atomNameVisitor = new AtomNameVisitor(info); |
141 |
|
compositeVisitor->addVisitor(atomNameVisitor, 550); |
142 |
< |
std::cout << compositeVisitor->toString(); |
142 |
> |
cout << compositeVisitor->toString(); |
143 |
|
} |
144 |
|
|
145 |
|
//create ZconsVisitor |
164 |
|
//create replicate visitor |
165 |
|
if(args_info.repeatX_given > 0 || |
166 |
|
args_info.repeatY_given > 0 || |
167 |
< |
args_info.repeatY_given > 0) { |
167 |
> |
args_info.repeatZ_given > 0) { |
168 |
|
Vector3i replicateOpt(args_info.repeatX_arg, |
169 |
|
args_info.repeatY_arg, |
170 |
|
args_info.repeatZ_arg); |
181 |
|
args_info.refsele_arg), |
182 |
|
250); |
183 |
|
} else if (args_info.refsele_given || args_info.originsele_given) { |
184 |
< |
std::cerr << "Both of --refsele and --originsele should appear by pair" |
185 |
< |
<< std::endl; |
184 |
> |
cerr << "Both of --refsele and --originsele should appear by pair" |
185 |
> |
<< endl; |
186 |
|
exit(1); |
187 |
|
} |
188 |
|
|
211 |
|
printChrg = true; |
212 |
|
xyzVisitor->doCharges(printChrg); |
213 |
|
} |
214 |
+ |
if(args_info.efield_flag){ |
215 |
+ |
printField = true; |
216 |
+ |
xyzVisitor->doElectricFields(printField); |
217 |
+ |
} |
218 |
|
|
219 |
|
compositeVisitor->addVisitor(xyzVisitor, 200); |
220 |
|
|
225 |
|
DumpReader* dumpReader = new DumpReader(info, dumpFileName); |
226 |
|
int nframes = dumpReader->getNFrames(); |
227 |
|
|
228 |
< |
std::ofstream xyzStream(xyzFileName.c_str()); |
228 |
> |
ofstream xyzStream(xyzFileName.c_str()); |
229 |
|
|
230 |
|
SimInfo::MoleculeIterator miter; |
231 |
|
Molecule::IntegrableObjectIterator iiter; |
232 |
|
Molecule::RigidBodyIterator rbIter; |
233 |
|
Molecule* mol; |
234 |
< |
StuntDouble* integrableObject; |
234 |
> |
StuntDouble* sd; |
235 |
|
RigidBody* rb; |
236 |
|
Vector3d molCom; |
237 |
|
Vector3d newMolCom; |
249 |
|
currentSnapshot = info->getSnapshotManager()->getCurrentSnapshot(); |
250 |
|
for (mol = info->beginMolecule(miter); mol != NULL; |
251 |
|
mol = info->nextMolecule(miter)) { |
252 |
< |
molCom = mol->getCom(); |
253 |
< |
newMolCom = molCom; |
254 |
< |
currentSnapshot->wrapVector(newMolCom); |
255 |
< |
displacement = newMolCom - molCom; |
256 |
< |
for (integrableObject = mol->beginIntegrableObject(iiter); |
257 |
< |
integrableObject != NULL; |
258 |
< |
integrableObject = mol->nextIntegrableObject(iiter)) { |
259 |
< |
integrableObject->setPos(integrableObject->getPos() + displacement); |
252 |
> |
|
253 |
> |
molCom = mol->getCom(); |
254 |
> |
newMolCom = molCom; |
255 |
> |
currentSnapshot->wrapVector(newMolCom); |
256 |
> |
displacement = newMolCom - molCom; |
257 |
> |
|
258 |
> |
for (sd = mol->beginIntegrableObject(iiter); sd != NULL; |
259 |
> |
sd = mol->nextIntegrableObject(iiter)) { |
260 |
> |
|
261 |
> |
sd->setPos(sd->getPos() + displacement); |
262 |
> |
|
263 |
|
} |
264 |
|
} |
265 |
|
} |
266 |
+ |
|
267 |
|
//update atoms of rigidbody |
268 |
|
for (mol = info->beginMolecule(miter); mol != NULL; |
269 |
|
mol = info->nextMolecule(miter)) { |
271 |
|
//change the positions of atoms which belong to the rigidbodies |
272 |
|
for (rb = mol->beginRigidBody(rbIter); rb != NULL; |
273 |
|
rb = mol->nextRigidBody(rbIter)) { |
274 |
+ |
|
275 |
|
rb->updateAtoms(); |
276 |
|
if (printVel) rb->updateAtomVel(); |
277 |
+ |
|
278 |
|
} |
279 |
|
} |
280 |
|
|
281 |
|
//prepare visit |
282 |
|
for (mol = info->beginMolecule(miter); mol != NULL; |
283 |
|
mol = info->nextMolecule(miter)) { |
284 |
< |
for (integrableObject = mol->beginIntegrableObject(iiter); |
285 |
< |
integrableObject != NULL; |
286 |
< |
integrableObject = mol->nextIntegrableObject(iiter)) { |
287 |
< |
integrableObject->accept(prepareVisitor); |
284 |
> |
|
285 |
> |
for (sd = mol->beginIntegrableObject(iiter); sd != NULL; |
286 |
> |
sd = mol->nextIntegrableObject(iiter)) { |
287 |
> |
|
288 |
> |
sd->accept(prepareVisitor); |
289 |
> |
|
290 |
|
} |
291 |
|
} |
292 |
|
|
297 |
|
//visit stuntdouble |
298 |
|
for (mol = info->beginMolecule(miter); mol != NULL; |
299 |
|
mol = info->nextMolecule(miter)) { |
300 |
< |
for (integrableObject = mol->beginIntegrableObject(iiter); |
301 |
< |
integrableObject != NULL; |
302 |
< |
integrableObject = mol->nextIntegrableObject(iiter)) { |
303 |
< |
integrableObject->accept(compositeVisitor); |
300 |
> |
|
301 |
> |
for (sd = mol->beginIntegrableObject(iiter); sd != NULL; |
302 |
> |
sd = mol->nextIntegrableObject(iiter)) { |
303 |
> |
|
304 |
> |
sd->accept(compositeVisitor); |
305 |
> |
|
306 |
|
} |
307 |
|
} |
308 |
|
|