本文整理汇总了C++中Boundary::volume方法的典型用法代码示例。如果您正苦于以下问题:C++ Boundary::volume方法的具体用法?C++ Boundary::volume怎么用?C++ Boundary::volume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boundary
的用法示例。
在下文中一共展示了Boundary::volume方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sample
/// Add particle pairs to RDF histogram.
void RDF::sample(long iStep)
{
if (isAtInterval(iStep)) {
accumulator_.beginSnapshot();
System::ConstMoleculeIterator molIter1, molIter2;
Molecule::ConstAtomIterator atomIter1, atomIter2;
Vector r1, r2;
double dRsq, dR;
Boundary* boundaryPtr;
int iSpecies1, iSpecies2, nSpecies, i;
for (i = 0; i < nAtomType_; ++i) {
typeNumbers_[i] = 0;
}
boundaryPtr = &system().boundary();
nSpecies = system().simulation().nSpecies();
// Loop over atom 1
for (iSpecies1 = 0; iSpecies1 < nSpecies; ++iSpecies1) {
system().begin(iSpecies1, molIter1);
for ( ; molIter1.notEnd(); ++molIter1) {
molIter1->begin(atomIter1);
for ( ; atomIter1.notEnd(); ++atomIter1) {
r1 = atomIter1->position();
++typeNumbers_[atomIter1->typeId()];
// Loop over atom 2
for (iSpecies2 = 0; iSpecies2 < nSpecies; ++iSpecies2) {
system().begin(iSpecies2, molIter2);
for ( ; molIter2.notEnd(); ++molIter2) {
//Check if molecules are the same
//if ( &(*molIter2) != &(*molIter1)) {
molIter2->begin(atomIter2);
for ( ; atomIter2.notEnd(); ++atomIter2) {
if (selector_.match(*atomIter1, *atomIter2)) {
r2 = atomIter2->position();
dRsq = boundaryPtr->distanceSq(r1, r2);
dR = sqrt(dRsq);
accumulator_.sample(dR);
}
}
//}
}
} // for iSpecies2
}
}
} // for iSpecies1
// Increment normSum_
double number = 0;
for (i = 0; i < nAtomType_; ++i) {
number += typeNumbers_[i];
}
normSum_ += number*number/boundaryPtr->volume();
} // if isAtInterval
}