DensityPlot::DensityPlot(SimInfo* info, const std::string& filename, const std::string& sele, const std::string& cmSele, RealType len, int nrbins) : StaticAnalyser(info, filename), len_(len), halfLen_(len/2), nRBins_(nrbins), selectionScript_(sele), seleMan_(info), evaluator_(info), cmSelectionScript_(cmSele), cmSeleMan_(info), cmEvaluator_(info) { setOutputName(getPrefix(filename) + ".density"); deltaR_ = len_ /nRBins_; histogram_.resize(nRBins_); density_.resize(nRBins_); std::fill(histogram_.begin(), histogram_.end(), 0); evaluator_.loadScriptString(sele); if (!evaluator_.isDynamic()) { seleMan_.setSelectionSet(evaluator_.evaluate()); } cmEvaluator_.loadScriptString(cmSele); if (!cmEvaluator_.isDynamic()) { cmSeleMan_.setSelectionSet(cmEvaluator_.evaluate()); } }
TetrahedralityParam::TetrahedralityParam(SimInfo* info, const std::string& filename, const std::string& sele, double rCut, int nbins) : StaticAnalyser(info, filename, nbins), selectionScript_(sele), seleMan_(info), evaluator_(info) { setOutputName(getPrefix(filename) + ".q"); evaluator_.loadScriptString(sele); if (!evaluator_.isDynamic()) { seleMan_.setSelectionSet(evaluator_.evaluate()); } // Set up cutoff radius: rCut_ = rCut; Q_histogram_.resize(nBins_); // Q can take values from 0 to 1 MinQ_ = 0.0; MaxQ_ = 1.1; deltaQ_ = (MaxQ_ - MinQ_) / nBins_; }
HBondGeometric::HBondGeometric(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, double rCut, double thetaCut, int nbins) : StaticAnalyser(info, filename, nbins), selectionScript1_(sele1), seleMan1_(info), evaluator1_(info), selectionScript2_(sele2), seleMan2_(info), evaluator2_(info) { setOutputName(getPrefix(filename) + ".hbg"); ff_ = info_->getForceField(); evaluator1_.loadScriptString(sele1); if (!evaluator1_.isDynamic()) { seleMan1_.setSelectionSet(evaluator1_.evaluate()); } evaluator2_.loadScriptString(sele2); if (!evaluator2_.isDynamic()) { seleMan2_.setSelectionSet(evaluator2_.evaluate()); } // Set up cutoff values: rCut_ = rCut; thetaCut_ = thetaCut; nHBonds_.resize(nBins_); nDonor_.resize(nBins_); nAcceptor_.resize(nBins_); initializeHistogram(); }
ContactAngle2::ContactAngle2(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, RealType solidZ, RealType centroidX, RealType centroidY, RealType threshDens, RealType bufferLength, int nrbins, int nzbins) : SequentialAnalyzer(info, filename, sele1, sele2), solidZ_(solidZ), centroidX_(centroidX), centroidY_(centroidY), threshDens_(threshDens), bufferLength_(bufferLength), nRBins_(nrbins), nZBins_(nzbins) { setOutputName(getPrefix(filename) + ".ca2"); std::stringstream params; params << " referenceZ = " << solidZ_ << ", centroid = (" << centroidX_ << ", " << centroidY_ << ")" << ", threshDens = " << threshDens_ << ", bufferLength = " << bufferLength_ << ", nbins = " << nRBins_ << ", nbins_z = " << nZBins_; const std::string paramString = params.str(); setParameterString( paramString ); }
TetrahedralityParamZ::TetrahedralityParamZ(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, double rCut, int nzbins) : StaticAnalyser(info, filename), selectionScript1_(sele1), selectionScript2_(sele2), seleMan1_(info), seleMan2_(info), evaluator1_(info), evaluator2_(info), nZBins_(nzbins) { evaluator1_.loadScriptString(sele1); if (!evaluator1_.isDynamic()) { seleMan1_.setSelectionSet(evaluator1_.evaluate()); } evaluator2_.loadScriptString(sele2); if (!evaluator2_.isDynamic()) { seleMan2_.setSelectionSet(evaluator2_.evaluate()); } // Set up cutoff radius: rCut_ = rCut; // fixed number of bins sliceQ_.resize(nZBins_); sliceCount_.resize(nZBins_); std::fill(sliceQ_.begin(), sliceQ_.end(), 0.0); std::fill(sliceCount_.begin(), sliceCount_.end(), 0); setOutputName(getPrefix(filename) + ".Qz"); }
GCN::GCN(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, RealType rCut, int bins): StaticAnalyser(info, filename, bins), rCut_(rCut), bins_(bins), sele1_(sele1), seleMan1_(info), evaluator1_(info), sele2_(sele2), seleMan2_(info), evaluator2_(info) { setAnalysisType("Generalized Coordination Number Distribution"); setOutputName(getPrefix(filename) + ".gcn"); nnMax_ = 12; RealType binMax_ = nnMax_ * 1.5; delta_ = binMax_ / bins_; std::stringstream params; params << " rcut = " << rCut_ << ", nbins = " << bins_ << ", max neighbors = " << nnMax_; const std::string paramString = params.str(); setParameterString( paramString ); evaluator1_.loadScriptString(sele1); if (!evaluator1_.isDynamic()) { seleMan1_.setSelectionSet(evaluator1_.evaluate()); selectionCount1_ = seleMan1_.getSelectionCount(); } evaluator2_.loadScriptString(sele2); if (!evaluator2_.isDynamic()) { seleMan2_.setSelectionSet(evaluator2_.evaluate()); selectionCount2_ = seleMan2_.getSelectionCount(); } }
RCorrFunc::RCorrFunc(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, long long int memSize) : ParticleTimeCorrFunc(info, filename, sele1, sele2, DataStorage::dslPosition, memSize){ setCorrFuncType("RCorrFunc"); setOutputName(getPrefix(dumpFilename_) + ".rcorr"); }
BondAngleDistribution::BondAngleDistribution(SimInfo* info, const string& filename, const string& sele, double rCut, int nbins) : StaticAnalyser(info, filename, nbins), selectionScript_(sele), seleMan_(info), evaluator_(info) { setAnalysisType("Bond Angle Distribution"); setOutputName(getPrefix(filename) + ".bad"); evaluator_.loadScriptString(sele); if (!evaluator_.isDynamic()) { seleMan_.setSelectionSet(evaluator_.evaluate()); } // Set up cutoff radius: rCut_ = rCut; std::stringstream params; params << " rcut = " << rCut_ << ", nbins = " << nBins_; const std::string paramString = params.str(); setParameterString( paramString ); // Theta can take values from 0 to 180 deltaTheta_ = (180.0) / nBins_; histogram_.resize(nBins_); }
P2OrderParameter::P2OrderParameter(SimInfo* info, const string& filename, const string& sele1, int seleOffset) : StaticAnalyser(info, filename, 1), doVect_(false), doOffset_(true), selectionScript1_(sele1), seleMan1_(info), seleMan2_(info), evaluator1_(info), evaluator2_(info), seleOffset_(seleOffset) { setOutputName(getPrefix(filename) + ".p2"); evaluator1_.loadScriptString(sele1); }
GofR::GofR(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, RealType len, int nrbins) : RadialDistrFunc(info, filename, sele1, sele2), len_(len), nRBins_(nrbins){ deltaR_ = len_ /nRBins_; histogram_.resize(nRBins_); avgGofr_.resize(nRBins_); setOutputName(getPrefix(filename) + ".gofr"); }
RCorrFunc::RCorrFunc(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2) : AutoCorrFunc(info, filename, sele1, sele2, DataStorage::dslPosition | DataStorage::dslAmat){ setCorrFuncType("Mean Square Displacement"); setOutputName(getPrefix(dumpFilename_) + ".rcorr"); positions_.resize(nFrames_); }
RCorrFuncR::RCorrFuncR(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2) : AutoCorrFunc(info, filename, sele1, sele2, DataStorage::dslPosition | DataStorage::dslAmat){ // Turn on COM calculation in reader: bool ncp = true; reader_->setNeedCOMprops(ncp); setCorrFuncType("MSD (radial projection)"); setOutputName(getPrefix(dumpFilename_) + ".r_rcorr"); positions_.resize(nFrames_); }
ThetaCorrFunc::ThetaCorrFunc(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, long long int memSize) : ParticleTimeCorrFunc(info, filename, sele1, sele2, DataStorage::dslPosition, memSize) { setCorrFuncType("ThetaCorrFunc"); setOutputName(getPrefix(dumpFilename_) + ".tcorr"); // Turn on COM calculation in block snapshot bool ncp = true; bsMan_->needCOMprops(ncp); }
ObjectCount::ObjectCount(SimInfo* info, const std::string& filename, const std::string& sele) : StaticAnalyser(info, filename, 1), selectionScript_(sele), seleMan_(info), evaluator_(info) { setOutputName(getPrefix(filename) + ".counts"); evaluator_.loadScriptString(sele); if (!evaluator_.isDynamic()) { seleMan_.setSelectionSet(evaluator_.evaluate()); } }
// We need all of the positions, velocities, etc. so that we can // recalculate pressures and actions on the fly: MomentumCorrFunc::MomentumCorrFunc(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, long long int memSize) : FrameTimeCorrFunc(info, filename, sele1, sele2, DataStorage::dslPosition | DataStorage::dslVelocity, memSize){ setCorrFuncType("MomentumCorrFunc"); setOutputName(getPrefix(dumpFilename_) + ".momcorr"); histogram_.resize(nTimeBins_); count_.resize(nTimeBins_); }
ContactAngle1::ContactAngle1(SimInfo* info, const std::string& filename, const std::string& sele, RealType solidZ, RealType dropletRadius) : SequentialAnalyzer(info, filename), solidZ_(solidZ), dropletRadius_(dropletRadius), selectionScript_(sele), seleMan_(info), evaluator_(info) { setOutputName(getPrefix(filename) + ".ca1"); evaluator_.loadScriptString(sele); if (!evaluator_.isDynamic()) { seleMan_.setSelectionSet(evaluator_.evaluate()); } }
GofRZ::GofRZ(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, RealType len, RealType zlen, int nrbins, int nZBins) : RadialDistrFunc(info, filename, sele1, sele2), len_(len), zLen_(zlen), nRBins_(nrbins), nZBins_(nZBins){ setOutputName(getPrefix(filename) + ".gofrz"); deltaR_ = len_ / (double) nRBins_; deltaZ_ = zLen_ / (double)nZBins_; histogram_.resize(nRBins_); avgGofr_.resize(nRBins_); for (int i = 0 ; i < nRBins_; ++i) { histogram_[i].resize(nZBins_); avgGofr_[i].resize(nZBins_); } }
ContactAngle1::ContactAngle1(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, RealType solidZ, RealType dropletRadius) : SequentialAnalyzer(info, filename, sele1, sele2), solidZ_(solidZ), dropletRadius_(dropletRadius) { setOutputName(getPrefix(filename) + ".ca1"); std::stringstream params; params << " solid Z = " << solidZ_ << ", droplet radius = " << dropletRadius_; const std::string paramString = params.str(); setParameterString( paramString ); }
TetrahedralityParamXYZ::TetrahedralityParamXYZ(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, RealType rCut, RealType voxelSize, RealType gaussWidth) : StaticAnalyser(info, filename), selectionScript1_(sele1), selectionScript2_(sele2), seleMan1_(info), seleMan2_(info), evaluator1_(info), evaluator2_(info), rCut_(rCut), voxelSize_(voxelSize), gaussWidth_(gaussWidth) { evaluator1_.loadScriptString(sele1); if (!evaluator1_.isDynamic()) { seleMan1_.setSelectionSet(evaluator1_.evaluate()); } evaluator2_.loadScriptString(sele2); if (!evaluator2_.isDynamic()) { seleMan2_.setSelectionSet(evaluator2_.evaluate()); } Mat3x3d hmat = info->getSnapshotManager()->getCurrentSnapshot()->getHmat(); nBins_(0) = int(hmat(0,0) / voxelSize); nBins_(1) = int(hmat(1,1) / voxelSize); nBins_(2) = int(hmat(2,2) / voxelSize); hist_.resize(nBins_(0)); count_.resize(nBins_(0)); for (int i = 0 ; i < nBins_(0); ++i) { hist_[i].resize(nBins_(1)); count_[i].resize(nBins_(1)); for(int j = 0; j < nBins_(1); ++j) { hist_[i][j].resize(nBins_(2)); count_[i][j].resize(nBins_(2)); std::fill(hist_[i][j].begin(), hist_[i][j].end(), 0.0); std::fill(count_[i][j].begin(), count_[i][j].end(), 0.0); } } setOutputName(getPrefix(filename) + ".Qxyz"); }
PotDiff::PotDiff(SimInfo* info, const std::string& filename, const std::string& sele) : StaticAnalyser(info, filename), selectionScript_(sele), seleMan_(info), evaluator_(info) { StuntDouble* sd; int i; setOutputName(getPrefix(filename) + ".potDiff"); // The PotDiff is computed by negating the charge on the atom type // using fluctuating charge values. If we don't have any // fluctuating charges in the simulation, we need to expand // storage to hold them. int storageLayout = info_->getStorageLayout(); storageLayout |= DataStorage::dslFlucQPosition; storageLayout |= DataStorage::dslFlucQVelocity; storageLayout |= DataStorage::dslFlucQForce; info_->setStorageLayout(storageLayout); info_->setSnapshotManager(new SimSnapshotManager(info_, storageLayout)); // now we have to figure out which AtomTypes to convert to fluctuating // charges evaluator_.loadScriptString(sele); seleMan_.setSelectionSet(evaluator_.evaluate()); for (sd = seleMan_.beginSelected(i); sd != NULL; sd = seleMan_.nextSelected(i)) { AtomType* at = static_cast<Atom*>(sd)->getAtomType(); FluctuatingChargeAdapter fqa = FluctuatingChargeAdapter(at); if (fqa.isFluctuatingCharge()) { selectionWasFlucQ_.push_back(true); } else { selectionWasFlucQ_.push_back(false); // make a fictitious fluctuating charge with an unphysical // charge mass and slaterN, but we need to zero out the // electronegativity and hardness to remove the self // contribution: fqa.makeFluctuatingCharge(1.0e9, 0.0, 0.0, 1); sd->setFlucQPos(0.0); } } info_->getSnapshotManager()->advance(); }
RCorrFuncZ::RCorrFuncZ(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, int nZbins) : AutoCorrFunc(info, filename, sele1, sele2, DataStorage::dslPosition | DataStorage::dslAmat){ setCorrFuncType("Mean Square Displacement binned by Z"); setOutputName(getPrefix(dumpFilename_) + ".rcorrZ"); positions_.resize(nFrames_); zBins_.resize(nFrames_); nZBins_ = nZbins; histograms_.resize(nTimeBins_); counts_.resize(nTimeBins_); for (int i = 0; i < nTimeBins_; i++) { histograms_[i].resize(nZBins_); counts_[i].resize(nZBins_); std::fill(histograms_[i].begin(), histograms_[i].end(), 0.0); std::fill(counts_[i].begin(), counts_[i].end(), 0); } }
GofXyz::GofXyz(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, const std::string& sele3, RealType len, int nrbins) : RadialDistrFunc(info, filename, sele1, sele2, nrbins), len_(len), halfLen_(len/2), evaluator3_(info), seleMan3_(info) { setOutputName(getPrefix(filename) + ".gxyz"); evaluator3_.loadScriptString(sele3); if (!evaluator3_.isDynamic()) { seleMan3_.setSelectionSet(evaluator3_.evaluate()); } deltaR_ = len_ / nBins_; histogram_.resize(nBins_); for (int i = 0 ; i < nBins_; ++i) { histogram_[i].resize(nBins_); for(int j = 0; j < nBins_; ++j) { histogram_[i][j].resize(nBins_); } } }
// Do not modify this function unless you know // very well what you are doing void SchedTestParam::makeSchedTestParam() { // This schedtestfile is kept for reference, as the previous // one is consumed (deleted) by the schedulability tests. setOutputName("schedtestfile.stf"); schedTestPramFile = fopen(name,"w+"); if (schedTestPramFile==NULL){ perror("could not open schedtestparam file"); exit(EXIT_FAILURE); } writeSchedTestParams(); fclose(schedTestPramFile); addEndMark(); generateOutputName(); schedTestPramFile = fopen(name,"w+"); if (schedTestPramFile==NULL){ perror("could not open schedtestparam file"); exit(EXIT_FAILURE); } writeSchedTestParams(); fclose(schedTestPramFile); addEndMark(); }
BondAngleDistribution::BondAngleDistribution(SimInfo* info, const string& filename, const string& sele, double rCut, int nbins) : StaticAnalyser(info, filename), selectionScript_(sele), evaluator_(info), seleMan_(info) { setOutputName(getPrefix(filename) + ".bad"); evaluator_.loadScriptString(sele); if (!evaluator_.isDynamic()) { seleMan_.setSelectionSet(evaluator_.evaluate()); } // Set up cutoff radius and order of the Legendre Polynomial: rCut_ = rCut; nBins_ = nbins; // Theta can take values from 0 to 180 deltaTheta_ = (180.0) / nBins_; histogram_.resize(nBins_); }
bool ProjectSpec::loadFromXML(const std::string& xmlName) { logger << Logger::INFO_MSG << "Parsing project XML: " << xmlName; TiXmlDocument xml(xmlName); bool valid = xml.LoadFile(); if (!valid) { // load xml file std::cerr << "Could not load project specification xml " << xmlName << ".\n"; return false; } TiXmlElement* rootNode = xml.RootElement(); if (!rootNode) { std::cerr << "Root element does not exist\n."; return false; } if (rootNode->ValueStr() != "Project") { std::cerr << "Root element value is not 'Project'.\n"; return false; } std::string absPath; os::path::absPath(xmlName, absPath); std::string junk; os::path::split(absPath, _projPath, junk); logger.line(); logger << Logger::INFO_MSG << "Project root: " << _projPath << "\n"; // Project parameters { const char* name = rootNode->Attribute("scene"); if (name != 0x0) { std::string tmp = os::path::join(2, _projPath.c_str(), name); os::path::absPath(tmp, _sceneXML); } } { const char* name = rootNode->Attribute("behavior"); if (name != 0x0) { std::string tmp = os::path::join(2, _projPath.c_str(), name); os::path::absPath(tmp, _behaviorXML); } } { const char* name = rootNode->Attribute("model"); if (name != 0x0) { _modelName = std::string(name); } } { const char* name = rootNode->Attribute("output"); if (name != 0x0) { setOutputName(os::path::join(2, _projPath.c_str(), name)); } } { const char* name = rootNode->Attribute("scbVersion"); if (name != 0x0) { // TODO: Validate this version _scbVersion = std::string(name); } } { const char* name = rootNode->Attribute("dumpPath"); if (name != 0x0) { std::string tmp = os::path::join(2, _projPath.c_str(), name); os::path::absPath(tmp, _imgDumpPath); } } { const char* name = rootNode->Attribute("view"); if (name != 0x0) { std::string tmp = os::path::join(2, _projPath.c_str(), name); os::path::absPath(tmp, _viewConfig); } } double d; int i; if (rootNode->Attribute("duration", &d)) { _duration = (float)d; } if (rootNode->Attribute("timeStep", &d)) { _timeStep = (float)d; } if (rootNode->Attribute("random", &i)) { _seed = i; } if (rootNode->Attribute("subSteps", &i)) { _subSteps = (size_t)i; } std::cout << "Returning true\n"; return true; }