本文整理汇总了C++中StuntDouble::isAtom方法的典型用法代码示例。如果您正苦于以下问题:C++ StuntDouble::isAtom方法的具体用法?C++ StuntDouble::isAtom怎么用?C++ StuntDouble::isAtom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StuntDouble
的用法示例。
在下文中一共展示了StuntDouble::isAtom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
void DensityPlot::process() {
Molecule* mol;
RigidBody* rb;
SimInfo::MoleculeIterator mi;
Molecule::RigidBodyIterator rbIter;
DumpReader reader(info_, dumpFilename_);
int nFrames = reader.getNFrames();
for (int i = 0; i < nFrames; i += step_) {
reader.readFrame(i);
currentSnapshot_ = info_->getSnapshotManager()->getCurrentSnapshot();
for (mol = info_->beginMolecule(mi); mol != NULL;
mol = info_->nextMolecule(mi)) {
//change the positions of atoms which belong to the rigidbodies
for (rb = mol->beginRigidBody(rbIter); rb != NULL;
rb = mol->nextRigidBody(rbIter)) {
rb->updateAtoms();
}
}
if (evaluator_.isDynamic()) {
seleMan_.setSelectionSet(evaluator_.evaluate());
}
if (cmEvaluator_.isDynamic()) {
cmSeleMan_.setSelectionSet(cmEvaluator_.evaluate());
}
Vector3d origin = calcNewOrigin();
Mat3x3d hmat = currentSnapshot_->getHmat();
RealType slabVolume = deltaR_ * hmat(0, 0) * hmat(1, 1);
int k;
for (StuntDouble* sd = seleMan_.beginSelected(k); sd != NULL;
sd = seleMan_.nextSelected(k)) {
if (!sd->isAtom()) {
sprintf( painCave.errMsg,
"Can not calculate electron density if it is not atom\n");
painCave.severity = OPENMD_ERROR;
painCave.isFatal = 1;
simError();
}
Atom* atom = static_cast<Atom*>(sd);
GenericData* data = atom->getAtomType()->getPropertyByName("nelectron");
if (data == NULL) {
sprintf( painCave.errMsg, "Can not find Parameters for nelectron\n");
painCave.severity = OPENMD_ERROR;
painCave.isFatal = 1;
simError();
}
DoubleGenericData* doubleData = dynamic_cast<DoubleGenericData*>(data);
if (doubleData == NULL) {
sprintf( painCave.errMsg,
"Can not cast GenericData to DoubleGenericData\n");
painCave.severity = OPENMD_ERROR;
painCave.isFatal = 1;
simError();
}
RealType nelectron = doubleData->getData();
LennardJonesAdapter lja = LennardJonesAdapter(atom->getAtomType());
RealType sigma = lja.getSigma() * 0.5;
RealType sigma2 = sigma * sigma;
Vector3d pos = sd->getPos() - origin;
for (int j =0; j < nRBins_; ++j) {
Vector3d tmp(pos);
RealType zdist =j * deltaR_ - halfLen_;
tmp[2] += zdist;
if (usePeriodicBoundaryConditions_)
currentSnapshot_->wrapVector(tmp);
RealType wrappedZdist = tmp.z() + halfLen_;
if (wrappedZdist < 0.0 || wrappedZdist > len_) {
continue;
}
int which = int(wrappedZdist / deltaR_);
density_[which] += nelectron * exp(-zdist*zdist/(sigma2*2.0)) /(slabVolume* sqrt(2*NumericConstant::PI*sigma*sigma));
}
}
}
int nProcessed = nFrames /step_;
std::transform(density_.begin(), density_.end(), density_.begin(),
std::bind2nd(std::divides<RealType>(), nProcessed));
writeDensity();
}