ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/brains/SimInfo.cpp
(Generate patch)

Comparing branches/development/src/brains/SimInfo.cpp (file contents):
Revision 1569 by gezelter, Thu May 26 13:55:04 2011 UTC vs.
Revision 1581 by gezelter, Mon Jun 13 22:13:12 2011 UTC

# Line 125 | Line 125 | namespace OpenMD {
125      //equal to the total number of atoms minus number of atoms belong to
126      //cutoff group defined in meta-data file plus the number of cutoff
127      //groups defined in meta-data file
128    std::cerr << "nGA = " << nGlobalAtoms_ << "\n";
129    std::cerr << "nCA = " << nCutoffAtoms << "\n";
130    std::cerr << "nG = " << nGroups << "\n";
128  
129      nGlobalCutoffGroups_ = nGlobalAtoms_ - nCutoffAtoms + nGroups;
133
134    std::cerr << "nGCG = " << nGlobalCutoffGroups_ << "\n";
130      
131      //every free atom (atom does not belong to rigid bodies) is an
132      //integrable object therefore the total number of integrable objects
# Line 274 | Line 269 | namespace OpenMD {
269   #endif
270      return fdf_;
271    }
272 +  
273 +  unsigned int SimInfo::getNLocalCutoffGroups(){
274 +    int nLocalCutoffAtoms = 0;
275 +    Molecule* mol;
276 +    MoleculeIterator mi;
277 +    CutoffGroup* cg;
278 +    Molecule::CutoffGroupIterator ci;
279      
280 +    for (mol = beginMolecule(mi); mol != NULL; mol  = nextMolecule(mi)) {
281 +      
282 +      for (cg = mol->beginCutoffGroup(ci); cg != NULL;
283 +           cg = mol->nextCutoffGroup(ci)) {
284 +        nLocalCutoffAtoms += cg->getNumAtom();
285 +        
286 +      }        
287 +    }
288 +    
289 +    return nAtoms_ - nLocalCutoffAtoms + nCutoffGroups_;
290 +  }
291 +    
292    void SimInfo::calcNdfRaw() {
293      int ndfRaw_local;
294  
# Line 824 | Line 838 | namespace OpenMD {
838      Atom* atom;
839      RealType totalMass;
840  
841 <    //to avoid memory reallocation, reserve enough space for massFactors_
841 >    /**
842 >     * The mass factor is the relative mass of an atom to the total
843 >     * mass of the cutoff group it belongs to.  By default, all atoms
844 >     * are their own cutoff groups, and therefore have mass factors of
845 >     * 1.  We need some special handling for massless atoms, which
846 >     * will be treated as carrying the entire mass of the cutoff
847 >     * group.
848 >     */
849      massFactors_.clear();
850 <    massFactors_.reserve(getNCutoffGroups());
850 >    massFactors_.resize(getNAtoms(), 1.0);
851      
852      for(mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) {        
853        for (cg = mol->beginCutoffGroup(ci); cg != NULL;
# Line 835 | Line 856 | namespace OpenMD {
856          totalMass = cg->getMass();
857          for(atom = cg->beginAtom(ai); atom != NULL; atom = cg->nextAtom(ai)) {
858            // Check for massless groups - set mfact to 1 if true
859 <          if (totalMass != 0)
860 <            massFactors_.push_back(atom->getMass()/totalMass);
859 >          if (totalMass != 0)
860 >            massFactors_[atom->getLocalIndex()] = atom->getMass()/totalMass;
861            else
862 <            massFactors_.push_back( 1.0 );
862 >            massFactors_[atom->getLocalIndex()] = 1.0;
863          }
864        }      
865      }
# Line 865 | Line 886 | namespace OpenMD {
886      int* oneThreeList = oneThreeInteractions_.getPairList();
887      int* oneFourList = oneFourInteractions_.getPairList();
888  
868    //setFortranSim( &fInfo_, &nGlobalAtoms_, &nAtoms_, &identArray_[0],
869    //               &nExclude, excludeList,
870    //               &nOneTwo, oneTwoList,
871    //               &nOneThree, oneThreeList,
872    //               &nOneFour, oneFourList,
873    //               &molMembershipArray[0], &mfact[0], &nCutoffGroups_,
874    //               &fortranGlobalGroupMembership[0], &isError);
875    
889      topologyDone_ = true;
890    }
891  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines