/// 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 }