51#include "brains/Register.hpp"
55#include "selection/SelectionEvaluator.hpp"
56#include "selection/SelectionManager.hpp"
57#include "utils/simError.h"
58#include "visitors/AtomNameVisitor.hpp"
59#include "visitors/AtomVisitor.hpp"
60#include "visitors/CompositeVisitor.hpp"
61#include "visitors/LipidTransVisitor.hpp"
62#include "visitors/OtherVisitor.hpp"
63#include "visitors/ReplacementVisitor.hpp"
64#include "visitors/RigidBodyVisitor.hpp"
65#include "visitors/ZconsVisitor.hpp"
70int main(
int argc,
char* argv[]) {
78 bool printChrg(
false);
79 bool printField(
false);
80 bool printGlobalID(
false);
83 if (cmdline_parser(argc, argv, &args_info) != 0) { exit(1); }
86 if (args_info.input_given) {
87 dumpFileName = args_info.input_arg;
89 strcpy(painCave.errMsg,
"No input file name was specified.\n");
94 if (args_info.output_given) {
95 xyzFileName = args_info.output_arg;
97 xyzFileName = dumpFileName;
98 xyzFileName = xyzFileName.substr(0, xyzFileName.rfind(
".")) +
".xyz";
103 SimInfo* info = creator.createSim(dumpFileName,
false);
110 if (args_info.rigidbody_flag) {
112 compositeVisitor->addVisitor(rbCOMVisitor, 900);
117 compositeVisitor->addVisitor(ssdVisitor, 800);
121 compositeVisitor->addVisitor(gbtVisitor, 790);
125 compositeVisitor->addVisitor(gbhVisitor, 789);
129 compositeVisitor->addVisitor(defaultAtomVisitor, 700);
132 if (!args_info.water_given) {
134 if (args_info.watertype_flag) {
136 compositeVisitor->addVisitor(waterTypeVisitor, 600);
140 if (args_info.basetype_flag) {
142 compositeVisitor->addVisitor(atomNameVisitor, 550);
148 if (args_info.zconstraint_flag) {
151 if (zconsVisitor->haveZconsMol()) {
152 compositeVisitor->addVisitor(zconsVisitor, 500);
166 if (args_info.repeatX_given > 0 || args_info.repeatY_given > 0 ||
167 args_info.repeatZ_given > 0) {
168 Vector3i replicateOpt(args_info.repeatX_arg, args_info.repeatY_arg,
169 args_info.repeatZ_arg);
172 compositeVisitor->addVisitor(replicateVisitor, 300);
176 if (args_info.refsele_given && args_info.originsele_given) {
177 compositeVisitor->addVisitor(
179 args_info.refsele_arg),
181 }
else if (args_info.refsele_given || args_info.originsele_given) {
184 "The --refsele and --originsele arguments should appear together.\n");
185 painCave.isFatal = 1;
192 if (args_info.selection_given) {
193 xyzVisitor =
new XYZVisitor(info, args_info.selection_arg);
198 if (args_info.velocities_flag) {
200 xyzVisitor->doVelocities(printVel);
202 if (args_info.forces_flag) {
204 xyzVisitor->doForces(printFrc);
206 if (args_info.vectors_flag) {
208 xyzVisitor->doVectors(printVec);
210 if (args_info.charges_flag) {
212 xyzVisitor->doCharges(printChrg);
214 if (args_info.efield_flag) {
216 xyzVisitor->doElectricFields(printField);
218 if (args_info.globalID_flag) {
219 printGlobalID =
true;
220 xyzVisitor->doGlobalIDs(printGlobalID);
223 compositeVisitor->addVisitor(xyzVisitor, 200);
230 int nframes = dumpReader->getNFrames();
232 ofstream xyzStream(xyzFileName.c_str());
234 SimInfo::MoleculeIterator miter;
235 Molecule::IntegrableObjectIterator iiter;
236 Molecule::RigidBodyIterator rbIter;
246 for (
int i = 0; i < nframes; i += args_info.frame_arg) {
247 dumpReader->readFrame(i);
249 if (printFrc) forceMan->calcForces();
252 if (args_info.periodicBox_flag) {
258 currentSnapshot->wrapVector(newMolCom);
259 displacement = newMolCom - molCom;
261 for (sd = mol->beginIntegrableObject(iiter); sd != NULL;
262 sd = mol->nextIntegrableObject(iiter)) {
272 for (rb = mol->beginRigidBody(rbIter); rb != NULL;
273 rb = mol->nextRigidBody(rbIter)) {
275 if (printVel) rb->updateAtomVel();
282 for (sd = mol->beginIntegrableObject(iiter); sd != NULL;
283 sd = mol->nextIntegrableObject(iiter)) {
284 sd->
accept(prepareVisitor);
289 compositeVisitor->update();
294 for (sd = mol->beginIntegrableObject(iiter); sd != NULL;
295 sd = mol->nextIntegrableObject(iiter)) {
296 sd->
accept(compositeVisitor);
300 xyzVisitor->writeFrame(xyzStream);
308 delete compositeVisitor;
309 delete prepareVisitor;
The header file for the command line option parser generated by GNU Gengetopt version 2....
ForceManager is responsible for calculating both the short range (bonded) interactions and long range...
Vector3d getCom()
Returns the current center of mass position of this molecule.
The only responsibility of SimCreator is to parse the meta-data file and create a SimInfo instance ba...
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
Molecule * beginMolecule(MoleculeIterator &i)
Returns the first molecule in this SimInfo and intialize the iterator.
Molecule * nextMolecule(MoleculeIterator &i)
Returns the next avaliable Molecule based on the iterator.
SnapshotManager * getSnapshotManager()
Returns the snapshot manager.
The Snapshot class is a repository storing dynamic data during a Simulation.
Snapshot * getCurrentSnapshot()
Returns the pointer of current snapshot.
"Don't move, or you're dead! Stand up! Captain, we've got them!"
virtual void accept(BaseVisitor *v)=0
Vector3d getPos()
Returns the current position of this stuntDouble.
void setPos(const Vector3d &pos)
Sets the current position of this stuntDouble.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
Where the command line options are stored.