int main(int argc, char* argv[]){ gengetopt_args_info args_info; string dumpFileName; string outFileName; //parse the command line option if (cmdline_parser (argc, argv, &args_info) != 0) { exit(1) ; } //get the dumpfile name and meta-data file name if (args_info.input_given){ dumpFileName = args_info.input_arg; } else { strcpy( painCave.errMsg, "No input file name was specified.\n" ); painCave.isFatal = 1; simError(); } if (args_info.output_given){ outFileName = args_info.output_arg; } else { strcpy( painCave.errMsg, "No output file name was specified.\n" ); painCave.isFatal = 1; simError(); } Vector3i repeat = Vector3i(args_info.repeatX_arg, args_info.repeatY_arg, args_info.repeatZ_arg); Mat3x3d repeatD = Mat3x3d(0.0); repeatD(0,0) = repeat.x(); repeatD(1,1) = repeat.y(); repeatD(2,2) = repeat.z(); Vector3d translate = Vector3d(args_info.translateX_arg, args_info.translateY_arg, args_info.translateZ_arg); //parse md file and set up the system SimCreator oldCreator; SimInfo* oldInfo = oldCreator.createSim(dumpFileName, false); Globals* simParams = oldInfo->getSimParams(); std::vector<Component*> components = simParams->getComponents(); std::vector<int> nMol; for (vector<Component*>::iterator i = components.begin(); i !=components.end(); ++i) { int nMolOld = (*i)->getNMol(); int nMolNew = nMolOld * repeat.x() * repeat.y() * repeat.z(); nMol.push_back(nMolNew); } createMdFile(dumpFileName, outFileName, nMol); SimCreator newCreator; SimInfo* newInfo = newCreator.createSim(outFileName, false); DumpReader* dumpReader = new DumpReader(oldInfo, dumpFileName); int nframes = dumpReader->getNFrames(); DumpWriter* writer = new DumpWriter(newInfo, outFileName); if (writer == NULL) { sprintf(painCave.errMsg, "error in creating DumpWriter"); painCave.isFatal = 1; simError(); } SimInfo::MoleculeIterator miter; Molecule::IntegrableObjectIterator iiter; Molecule::RigidBodyIterator rbIter; Molecule* mol; StuntDouble* sd; StuntDouble* sdNew; RigidBody* rb; Mat3x3d oldHmat; Mat3x3d newHmat; Snapshot* oldSnap; Snapshot* newSnap; Vector3d oldPos; Vector3d newPos; for (int i = 0; i < nframes; i++){ cerr << "frame = " << i << "\n"; dumpReader->readFrame(i); oldSnap = oldInfo->getSnapshotManager()->getCurrentSnapshot(); newSnap = newInfo->getSnapshotManager()->getCurrentSnapshot(); newSnap->setID( oldSnap->getID() ); newSnap->setTime( oldSnap->getTime() ); oldHmat = oldSnap->getHmat(); newHmat = repeatD*oldHmat; newSnap->setHmat(newHmat); newSnap->setThermostat( oldSnap->getThermostat() ); newSnap->setBarostat( oldSnap->getBarostat() ); int newIndex = 0; for (mol = oldInfo->beginMolecule(miter); mol != NULL; mol = oldInfo->nextMolecule(miter)) { for (int ii = 0; ii < repeat.x(); ii++) { for (int jj = 0; jj < repeat.y(); jj++) { for (int kk = 0; kk < repeat.z(); kk++) { Vector3d trans = Vector3d(ii, jj, kk); for (sd = mol->beginIntegrableObject(iiter); sd != NULL; sd = mol->nextIntegrableObject(iiter)) { oldPos = sd->getPos() + translate; oldSnap->wrapVector(oldPos); newPos = oldPos + trans * oldHmat; sdNew = newInfo->getIOIndexToIntegrableObject(newIndex); sdNew->setPos( newPos ); sdNew->setVel( sd->getVel() ); if (sd->isDirectional()) { sdNew->setA( sd->getA() ); sdNew->setJ( sd->getJ() ); } newIndex++; } } } } } //update atoms of rigidbody for (mol = newInfo->beginMolecule(miter); mol != NULL; mol = newInfo->nextMolecule(miter)) { //change the positions of atoms which belong to the rigidbodies for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { rb->updateAtoms(); rb->updateAtomVel(); } } writer->writeDump(); } // deleting the writer will put the closing at the end of the dump file. delete writer; delete oldInfo; }
int main(int argc, char *argv []) { registerLattice(); gengetopt_args_info args_info; std::string latticeType; std::string inputFileName; std::string outputFileName; MoLocator* locator; int nComponents; double latticeConstant; RealType rodRadius; RealType rodLength; Mat3x3d hmat; DumpWriter *writer; // Parse Command Line Arguments if (cmdline_parser(argc, argv, &args_info) != 0) exit(1); /* get lattice type */ latticeType = "FCC"; /* get input file name */ if (args_info.inputs_num) inputFileName = args_info.inputs[0]; else { sprintf(painCave.errMsg, "No input .omd file name was specified " "on the command line"); painCave.isFatal = 1; cmdline_parser_print_help(); simError(); } /* parse md file and set up the system */ SimCreator oldCreator; SimInfo* oldInfo = oldCreator.createSim(inputFileName, false); latticeConstant = args_info.latticeConstant_arg; rodRadius = args_info.radius_arg; rodLength = args_info.length_arg; Globals* simParams = oldInfo->getSimParams(); vector<Vector3d> sites; vector<Vector3d> orientations; if (args_info.ellipsoid_flag) { shapedLatticeEllipsoid nanoEllipsoid(latticeConstant, latticeType, rodLength, rodRadius); sites = nanoEllipsoid.getSites(); orientations = nanoEllipsoid.getOrientations(); } else { /* Create nanorod */ shapedLatticeRod nanoRod(latticeConstant, latticeType, rodRadius, rodLength); /* Build a lattice and get lattice points for this lattice constant */ sites = nanoRod.getSites(); orientations = nanoRod.getOrientations(); } std::vector<std::size_t> vacancyTargets; vector<bool> isVacancy; Vector3d myLoc; RealType myR; for (std::size_t i = 0; i < sites.size(); i++) isVacancy.push_back(false); // cerr << "checking vacancyPercent" << "\n"; if (args_info.vacancyPercent_given) { // cerr << "vacancyPercent given" << "\n"; if (args_info.vacancyPercent_arg < 0.0 || args_info.vacancyPercent_arg > 100.0) { sprintf(painCave.errMsg, "vacancyPercent was set to a non-sensical value."); painCave.isFatal = 1; simError(); } else { RealType vF = args_info.vacancyPercent_arg / 100.0; // cerr << "vacancyPercent = " << vF << "\n"; RealType vIR; RealType vOR; if (args_info.vacancyInnerRadius_given) { vIR = args_info.vacancyInnerRadius_arg; } else { vIR = 0.0; } if (args_info.vacancyOuterRadius_given) { vOR = args_info.vacancyOuterRadius_arg; } else { vOR = rodRadius; } if (vIR >= 0.0 && vOR <= rodRadius && vOR >= vIR) { for (std::size_t i = 0; i < sites.size(); i++) { myLoc = sites[i]; myR = myLoc.length(); if (myR >= vIR && myR <= vOR) { vacancyTargets.push_back(i); } } std::random_shuffle(vacancyTargets.begin(), vacancyTargets.end()); std::size_t nTargets = vacancyTargets.size(); vacancyTargets.resize((int)(vF * nTargets)); sprintf(painCave.errMsg, "Removing %d atoms from randomly-selected\n" "\tsites between %lf and %lf.", (int) vacancyTargets.size(), vIR, vOR); painCave.isFatal = 0; painCave.severity = OPENMD_INFO; simError(); isVacancy.clear(); for (std::size_t i = 0; i < sites.size(); i++) { bool vac = false; for (std::size_t j = 0; j < vacancyTargets.size(); j++) { if (i == vacancyTargets[j]) vac = true; } isVacancy.push_back(vac); } } else { sprintf(painCave.errMsg, "Something is strange about the vacancy\n" "\tinner or outer radii. Check their values."); painCave.isFatal = 1; simError(); } } } /* Get number of lattice sites */ std::size_t nSites = sites.size() - vacancyTargets.size(); // cerr << "sites.size() = " << sites.size() << "\n"; // cerr << "nSites = " << nSites << "\n"; // cerr << "vacancyTargets = " << vacancyTargets.size() << "\n"; std::vector<Component*> components = simParams->getComponents(); std::vector<RealType> molFractions; std::vector<RealType> shellRadii; std::vector<int> nMol; std::map<int, int> componentFromSite; nComponents = components.size(); // cerr << "nComponents = " << nComponents << "\n"; if (args_info.molFraction_given && args_info.shellRadius_given) { sprintf(painCave.errMsg, "Specify either molFraction or shellRadius " "arguments, but not both!"); painCave.isFatal = 1; simError(); } if (nComponents == 1) { molFractions.push_back(1.0); shellRadii.push_back(rodRadius); } else if (args_info.molFraction_given) { if ((int)args_info.molFraction_given == nComponents) { for (int i = 0; i < nComponents; i++) { molFractions.push_back(args_info.molFraction_arg[i]); } } else if ((int)args_info.molFraction_given == nComponents-1) { RealType remainingFraction = 1.0; for (int i = 0; i < nComponents-1; i++) { molFractions.push_back(args_info.molFraction_arg[i]); remainingFraction -= molFractions[i]; } molFractions.push_back(remainingFraction); } else { sprintf(painCave.errMsg, "nanorodBuilder can't figure out molFractions " "for all of the components in the <MetaData> block."); painCave.isFatal = 1; simError(); } } else if ((int)args_info.shellRadius_given) { if ((int)args_info.shellRadius_given == nComponents) { for (int i = 0; i < nComponents; i++) { shellRadii.push_back(args_info.shellRadius_arg[i]); } } else if ((int)args_info.shellRadius_given == nComponents-1) { for (int i = 0; i < nComponents-1; i++) { shellRadii.push_back(args_info.shellRadius_arg[i]); } shellRadii.push_back(rodRadius); } else { sprintf(painCave.errMsg, "nanorodBuilder can't figure out the\n" "\tshell radii for all of the components in the <MetaData> block."); painCave.isFatal = 1; simError(); } } else { sprintf(painCave.errMsg, "You have a multi-component <MetaData> block,\n" "\tbut have not specified either molFraction or shellRadius arguments."); painCave.isFatal = 1; simError(); } if (args_info.molFraction_given) { RealType totalFraction = 0.0; /* Do some simple sanity checking*/ for (int i = 0; i < nComponents; i++) { if (molFractions.at(i) < 0.0) { sprintf(painCave.errMsg, "One of the requested molFractions was" " less than zero!"); painCave.isFatal = 1; simError(); } if (molFractions.at(i) > 1.0) { sprintf(painCave.errMsg, "One of the requested molFractions was" " greater than one!"); painCave.isFatal = 1; simError(); } totalFraction += molFractions.at(i); } if (abs(totalFraction - 1.0) > 1e-6) { sprintf(painCave.errMsg, "The sum of molFractions was not close enough to 1.0"); painCave.isFatal = 1; simError(); } int remaining = nSites; for (int i=0; i < nComponents-1; i++) { nMol.push_back(int((RealType)nSites * molFractions.at(i))); remaining -= nMol.at(i); } nMol.push_back(remaining); // recompute actual mol fractions and perform final sanity check: std::size_t totalMolecules = 0; for (int i=0; i < nComponents; i++) { molFractions[i] = (RealType)(nMol.at(i))/(RealType)nSites; totalMolecules += nMol.at(i); } if (totalMolecules != nSites) { sprintf(painCave.errMsg, "Computed total number of molecules is not equal " "to the number of lattice sites!"); painCave.isFatal = 1; simError(); } } else { for (unsigned int i = 0; i < shellRadii.size(); i++) { if (shellRadii.at(i) > rodRadius + 1e-6 ) { sprintf(painCave.errMsg, "One of the shellRadius values exceeds the rod Radius."); painCave.isFatal = 1; simError(); } if (shellRadii.at(i) <= 0.0 ) { sprintf(painCave.errMsg, "One of the shellRadius values is smaller than zero!"); painCave.isFatal = 1; simError(); } } } vector<int> ids; if ((int)args_info.molFraction_given){ // cerr << "molFraction given 2" << "\n"; sprintf(painCave.errMsg, "Creating a randomized spherically-capped nanorod."); painCave.isFatal = 0; painCave.severity = OPENMD_INFO; simError(); /* Random rod is the default case*/ for (std::size_t i = 0; i < sites.size(); i++) if (!isVacancy[i]) ids.push_back(i); std::random_shuffle(ids.begin(), ids.end()); } else{ sprintf(painCave.errMsg, "Creating an fcc nanorod."); painCave.isFatal = 0; painCave.severity = OPENMD_INFO; simError(); // RealType smallestSoFar; int myComponent = -1; nMol.clear(); nMol.resize(nComponents); // cerr << "shellRadii[0] " << shellRadii[0] << "\n"; // cerr << "rodRadius " << rodRadius << "\n"; for (unsigned int i = 0; i < sites.size(); i++) { myLoc = sites[i]; myR = myLoc.length(); // smallestSoFar = rodRadius; // cerr << "vac = " << isVacancy[i]<< "\n"; if (!isVacancy[i]) { // for (int j = 0; j < nComponents; j++) { // if (myR <= shellRadii[j]) { // if (shellRadii[j] <= smallestSoFar) { // smallestSoFar = shellRadii[j]; // myComponent = j; // } // } // } myComponent = 0; componentFromSite[i] = myComponent; nMol[myComponent]++; // cerr << "nMol for myComp(" << myComponent<<") = " << nMol[myComponent] << "\n"; } } } // cerr << "nMol = " << nMol.at(0) << "\n"; outputFileName = args_info.output_arg; //creat new .omd file on fly which corrects the number of molecule createMdFile(inputFileName, outputFileName, nMol); delete oldInfo; SimCreator newCreator; SimInfo* NewInfo = newCreator.createSim(outputFileName, false); // Place molecules Molecule* mol; SimInfo::MoleculeIterator mi; mol = NewInfo->beginMolecule(mi); int l = 0; for (int i = 0; i < nComponents; i++){ locator = new MoLocator(NewInfo->getMoleculeStamp(i), NewInfo->getForceField()); // cerr << "nMol = " << nMol.at(i) << "\n"; if (!args_info.molFraction_given) { for (unsigned int n = 0; n < sites.size(); n++) { if (!isVacancy[n]) { if (componentFromSite[n] == i) { mol = NewInfo->getMoleculeByGlobalIndex(l); locator->placeMol(sites[n], orientations[n], mol); l++; } } } } else { for (int n = 0; n < nMol.at(i); n++) { mol = NewInfo->getMoleculeByGlobalIndex(l); locator->placeMol(sites[ids[l]], orientations[ids[l]], mol); l++; } } } //fill Hmat hmat(0, 0)= 10.0*rodRadius; hmat(0, 1) = 0.0; hmat(0, 2) = 0.0; hmat(1, 0) = 0.0; hmat(1, 1) = 10.0*rodRadius; hmat(1, 2) = 0.0; hmat(2, 0) = 0.0; hmat(2, 1) = 0.0; hmat(2, 2) = 5.0*rodLength + 2.0*rodRadius; //set Hmat NewInfo->getSnapshotManager()->getCurrentSnapshot()->setHmat(hmat); //create dumpwriter and write out the coordinates writer = new DumpWriter(NewInfo, outputFileName); if (writer == NULL) { sprintf(painCave.errMsg, "Error in creating dumpwriter object "); painCave.isFatal = 1; simError(); } writer->writeDump(); // deleting the writer will put the closing at the end of the dump file delete writer; // cleanup a by calling sim error..... sprintf(painCave.errMsg, "A new OpenMD file called \"%s\" has been " "generated.\n", outputFileName.c_str()); painCave.isFatal = 0; painCave.severity = OPENMD_INFO; simError(); return 0; }
int main(int argc, char* argv[]){ gengetopt_args_info args_info; //parse the command line option if (cmdline_parser (argc, argv, &args_info) != 0) { exit(1) ; } //get the dumpfile name std::string dumpFileName = args_info.input_arg; std::string sele1; std::string sele2; std::string sele3; // check the first selection argument, or set it to the environment // variable, or failing that, set it to "select all" if (args_info.sele1_given) { sele1 = args_info.sele1_arg; } else { char* sele1Env= getenv("SELECTION1"); if (sele1Env) { sele1 = sele1Env; } else { sele1 = "select all"; } } // check the second selection argument, or set it to the environment // variable, or failing that, set it to the first selection if (args_info.sele2_given) { sele2 = args_info.sele2_arg; } else { char* sele2Env = getenv("SELECTION2"); if (sele2Env) { sele2 = sele2Env; } else { //If sele2 is not specified, then the default behavior //should be what is already intended for sele1 sele2 = sele1; } } // check the third selection argument, which is only set if // requested by the user if (args_info.sele3_given) sele3 = args_info.sele3_arg; bool batchMode(false); if (args_info.scd_given){ if (args_info.sele1_given && args_info.sele2_given && args_info.sele3_given) { batchMode = false; } else if (args_info.molname_given && args_info.begin_given && args_info.end_given) { if (args_info.begin_arg < 0 || args_info.end_arg < 0 || args_info.begin_arg > args_info.end_arg-2) { sprintf( painCave.errMsg, "below conditions are not satisfied:\n" "0 <= begin && 0<= end && begin <= end-2\n"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } batchMode = true; } else{ sprintf( painCave.errMsg, "either --sele1, --sele2, --sele3 are specified," " or --molname, --begin, --end are specified\n"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } } //parse md file and set up the system SimCreator creator; SimInfo* info = creator.createSim(dumpFileName); RealType maxLen; RealType zmaxLen(0.0); if (args_info.length_given) { maxLen = args_info.length_arg; if (args_info.zlength_given){ zmaxLen = args_info.zlength_arg; } } else { Mat3x3d hmat = info->getSnapshotManager()->getCurrentSnapshot()->getHmat(); maxLen = std::min(std::min(hmat(0, 0), hmat(1, 1)), hmat(2, 2)) /2.0; zmaxLen = hmat(2,2); } RealType nanglebins, nrbins; // in case we override nbins with nrbins: if (args_info.nrbins_given) { nrbins = args_info.nrbins_arg; } else { nrbins = args_info.nbins_arg; } // in case we override nbins with nrbins: if (args_info.nanglebins_given) { nanglebins = args_info.nanglebins_arg; } else { nanglebins = args_info.nbins_arg; } StaticAnalyser* analyser; if (args_info.gofr_given){ analyser= new GofR(info, dumpFileName, sele1, sele2, maxLen, nrbins); } else if (args_info.gofz_given) { analyser= new GofZ(info, dumpFileName, sele1, sele2, maxLen, args_info.nbins_arg); } else if (args_info.r_z_given) { analyser = new GofRZ(info, dumpFileName, sele1, sele2, maxLen, zmaxLen, nrbins, args_info.nbins_z_arg); } else if (args_info.r_theta_given) { if (args_info.sele3_given) analyser = new GofRTheta(info, dumpFileName, sele1, sele2, sele3, maxLen, nrbins, nanglebins); else analyser = new GofRTheta(info, dumpFileName, sele1, sele2, maxLen, nrbins, nanglebins); } else if (args_info.r_omega_given) { if (args_info.sele3_given) analyser = new GofROmega(info, dumpFileName, sele1, sele2, sele3, maxLen, nrbins, nanglebins); else analyser = new GofROmega(info, dumpFileName, sele1, sele2, maxLen, nrbins, nanglebins); } else if (args_info.theta_omega_given) { if (args_info.sele3_given) analyser = new GofAngle2(info, dumpFileName, sele1, sele2, sele3, nanglebins); else analyser = new GofAngle2(info, dumpFileName, sele1, sele2, nanglebins); } else if (args_info.gxyz_given) { if (args_info.refsele_given) { analyser= new GofXyz(info, dumpFileName, sele1, sele2, args_info.refsele_arg, maxLen, args_info.nbins_arg); } else { sprintf( painCave.errMsg, "--refsele must set when --gxyz is used"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } } else if (args_info.twodgofr_given){ if (args_info.dz_given) { analyser= new TwoDGofR(info, dumpFileName, sele1, sele2, maxLen, args_info.dz_arg, nrbins); } else { sprintf( painCave.errMsg, "A slab width (dz) must be specified when calculating TwoDGofR"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } } else if (args_info.p2_given) { if (args_info.sele1_given) { if (args_info.sele2_given) analyser = new P2OrderParameter(info, dumpFileName, sele1, sele2); else if (args_info.seleoffset_given) analyser = new P2OrderParameter(info, dumpFileName, sele1, args_info.seleoffset_arg); else analyser = new P2OrderParameter(info, dumpFileName, sele1); } else { sprintf( painCave.errMsg, "At least one selection script (--sele1) must be specified when calculating P2 order parameters"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } } else if (args_info.rp2_given){ analyser = new RippleOP(info, dumpFileName, sele1, sele2); } else if (args_info.bo_given){ if (args_info.rcut_given) { analyser = new BondOrderParameter(info, dumpFileName, sele1, args_info.rcut_arg, args_info.nbins_arg); } else { sprintf( painCave.errMsg, "A cutoff radius (rcut) must be specified when calculating Bond Order Parameters"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } } else if (args_info.multipole_given){ analyser = new MultipoleSum(info, dumpFileName, sele1, maxLen, args_info.nbins_arg); } else if (args_info.tet_param_given) { if (args_info.rcut_given) { analyser = new TetrahedralityParam(info, dumpFileName, sele1, args_info.rcut_arg, args_info.nbins_arg); } else { sprintf( painCave.errMsg, "A cutoff radius (rcut) must be specified when calculating Tetrahedrality Parameters"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } } else if (args_info.tet_param_z_given) { if (args_info.rcut_given) { analyser = new TetrahedralityParamZ(info, dumpFileName, sele1, sele2, args_info.rcut_arg, args_info.nbins_arg); } else { sprintf( painCave.errMsg, "A cutoff radius (rcut) must be specified when calculating Tetrahedrality Parameters"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } } else if (args_info.tet_param_xyz_given) { if (!args_info.rcut_given) { sprintf( painCave.errMsg, "A cutoff radius (rcut) must be specified when calculating" " Tetrahedrality Parameters"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } if (!args_info.voxelSize_given) { sprintf( painCave.errMsg, "A voxel size must be specified when calculating" " volume-resolved Tetrahedrality Parameters"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } if (!args_info.gaussWidth_given) { sprintf( painCave.errMsg, "A gaussian width must be specified when calculating" " volume-resolved Tetrahedrality Parameters"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } analyser = new TetrahedralityParamXYZ(info, dumpFileName, sele1, sele2, args_info.rcut_arg, args_info.voxelSize_arg, args_info.gaussWidth_arg); } else if (args_info.ior_given){ if (args_info.rcut_given) { analyser = new IcosahedralOfR(info, dumpFileName, sele1, args_info.rcut_arg, nrbins, maxLen); } else { sprintf( painCave.errMsg, "A cutoff radius (rcut) must be specified when calculating Bond Order Parameters"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } } else if (args_info.for_given){ if (args_info.rcut_given) { analyser = new FCCOfR(info, dumpFileName, sele1, args_info.rcut_arg, nrbins, maxLen); } else { sprintf( painCave.errMsg, "A cutoff radius (rcut) must be specified when calculating Bond Order Parameters"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } } else if (args_info.bad_given){ if (args_info.rcut_given) { analyser = new BondAngleDistribution(info, dumpFileName, sele1, args_info.rcut_arg, args_info.nbins_arg); } else { sprintf( painCave.errMsg, "A cutoff radius (rcut) must be specified when calculating Bond Angle Distributions"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } } else if (args_info.scd_given) { if (batchMode) { analyser = new SCDOrderParameter(info, dumpFileName, args_info.molname_arg, args_info.begin_arg, args_info.end_arg); } else{ analyser = new SCDOrderParameter(info, dumpFileName, sele1, sele2, sele3); } }else if (args_info.density_given) { analyser= new DensityPlot(info, dumpFileName, sele1, sele2, maxLen, args_info.nbins_arg); } else if (args_info.count_given) { analyser = new ObjectCount(info, dumpFileName, sele1 ); } else if (args_info.slab_density_given) { analyser = new RhoZ(info, dumpFileName, sele1, args_info.nbins_arg); } else if (args_info.rnemdz_given) { analyser = new RNEMDZ(info, dumpFileName, sele1, args_info.nbins_arg); } else if (args_info.rnemdr_given) { analyser = new RNEMDR(info, dumpFileName, sele1, nrbins); } else if (args_info.rnemdrt_given) { analyser = new RNEMDRTheta(info, dumpFileName, sele1, nrbins, nanglebins); } else if (args_info.nitrile_given) { analyser = new NitrileFrequencyMap(info, dumpFileName, sele1, args_info.nbins_arg); } else if (args_info.p_angle_given) { if (args_info.sele1_given) { if (args_info.sele2_given) analyser = new pAngle(info, dumpFileName, sele1, sele2, args_info.nbins_arg); else if (args_info.seleoffset_given) { if (args_info.seleoffset2_given) { analyser = new pAngle(info, dumpFileName, sele1, args_info.seleoffset_arg, args_info.seleoffset2_arg, args_info.nbins_arg); } else { analyser = new pAngle(info, dumpFileName, sele1, args_info.seleoffset_arg, args_info.nbins_arg); } } else analyser = new pAngle(info, dumpFileName, sele1, args_info.nbins_arg); } else { sprintf( painCave.errMsg, "At least one selection script (--sele1) must be specified when " "calculating P(angle) distributions"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } #if defined(HAVE_FFTW_H) || defined(HAVE_DFFTW_H) || defined(HAVE_FFTW3_H) }else if (args_info.hxy_given) { analyser = new Hxy(info, dumpFileName, sele1, args_info.nbins_x_arg, args_info.nbins_y_arg, args_info.nbins_arg); #endif }else if(args_info.gcn_given){ analyser = new GCN(info, dumpFileName, sele1, sele2, args_info.nbins_arg); } else if (args_info.surfDiffusion_given){ analyser = new SurfaceDiffusion(info, dumpFileName, sele1, maxLen); }else if (args_info.rho_r_given) { if (args_info.radius_given){ analyser = new RhoR(info, dumpFileName, sele1, maxLen, nrbins, args_info.radius_arg); }else{ sprintf( painCave.errMsg, "A particle radius (radius) must be specified when calculating Rho(r)"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } } else if (args_info.hullvol_given) { analyser = new NanoVolume(info, dumpFileName, sele1); } else if (args_info.rodlength_given) { analyser = new NanoLength(info, dumpFileName, sele1); } else if (args_info.angle_r_given) { analyser = new AngleR(info, dumpFileName, sele1, maxLen, nrbins); } else if (args_info.hbond_given){ if (args_info.rcut_given) { if (args_info.thetacut_given) { analyser = new HBondGeometric(info, dumpFileName, sele1, sele2, args_info.rcut_arg, args_info.thetacut_arg, args_info.nbins_arg); } else { sprintf( painCave.errMsg, "A cutoff angle (thetacut) must be specified when calculating Hydrogen Bonding Statistics"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } } else { sprintf( painCave.errMsg, "A cutoff radius (rcut) must be specified when calculating Hydrogen Bonding Statistics"); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } } else if (args_info.potDiff_given) { analyser = new PotDiff(info, dumpFileName, sele1); } if (args_info.output_given) { analyser->setOutputName(args_info.output_arg); } if (args_info.step_given) { analyser->setStep(args_info.step_arg); } analyser->process(); delete analyser; delete info; return 0; }