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 1764 by gezelter, Tue Jul 3 18:32:27 2012 UTC vs.
Revision 1769 by gezelter, Mon Jul 9 14:15:52 2012 UTC

# Line 231 | Line 231 | namespace OpenMD {
231      vector<Atom*>::iterator k;
232  
233      Molecule* mol;
234 <    StuntDouble* integrableObject;
234 >    StuntDouble* sd;
235      Atom* atom;
236  
237      ndf_local = 0;
238      nfq_local = 0;
239      
240      for (mol = beginMolecule(i); mol != NULL; mol = nextMolecule(i)) {
241      for (integrableObject = mol->beginIntegrableObject(j); integrableObject != NULL;
242           integrableObject = mol->nextIntegrableObject(j)) {
241  
242 +      for (sd = mol->beginIntegrableObject(j); sd != NULL;
243 +           sd = mol->nextIntegrableObject(j)) {
244 +
245          ndf_local += 3;
246  
247 <        if (integrableObject->isDirectional()) {
248 <          if (integrableObject->isLinear()) {
247 >        if (sd->isDirectional()) {
248 >          if (sd->isLinear()) {
249              ndf_local += 2;
250            } else {
251              ndf_local += 3;
252            }
253          }
254        }
255 +
256        for (atom = mol->beginFluctuatingCharge(k); atom != NULL;
257             atom = mol->nextFluctuatingCharge(k)) {
258          if (atom->isFluctuatingCharge()) {
# Line 312 | Line 314 | namespace OpenMD {
314      MoleculeIterator i;
315      vector<StuntDouble*>::iterator j;
316      Molecule* mol;
317 <    StuntDouble* integrableObject;
317 >    StuntDouble* sd;
318  
319      // Raw degrees of freedom that we have to set
320      ndfRaw_local = 0;
321      
322      for (mol = beginMolecule(i); mol != NULL; mol = nextMolecule(i)) {
321      for (integrableObject = mol->beginIntegrableObject(j); integrableObject != NULL;
322           integrableObject = mol->nextIntegrableObject(j)) {
323  
324 +      for (sd = mol->beginIntegrableObject(j); sd != NULL;
325 +           sd = mol->nextIntegrableObject(j)) {
326 +
327          ndfRaw_local += 3;
328  
329 <        if (integrableObject->isDirectional()) {
330 <          if (integrableObject->isLinear()) {
329 >        if (sd->isDirectional()) {
330 >          if (sd->isLinear()) {
331              ndfRaw_local += 2;
332            } else {
333              ndfRaw_local += 3;
# Line 384 | Line 387 | namespace OpenMD {
387      Molecule::RigidBodyIterator rbIter;
388      RigidBody* rb;
389      Molecule::IntegrableObjectIterator ii;
390 <    StuntDouble* integrableObject;
390 >    StuntDouble* sd;
391      
392 <    for (integrableObject = mol->beginIntegrableObject(ii);
393 <         integrableObject != NULL;
391 <         integrableObject = mol->nextIntegrableObject(ii)) {
392 >    for (sd = mol->beginIntegrableObject(ii); sd != NULL;
393 >         sd = mol->nextIntegrableObject(ii)) {
394        
395 <      if (integrableObject->isRigidBody()) {
396 <        rb = static_cast<RigidBody*>(integrableObject);
395 >      if (sd->isRigidBody()) {
396 >        rb = static_cast<RigidBody*>(sd);
397          vector<Atom*> atoms = rb->getAtoms();
398          set<int> rigidAtoms;
399          for (int i = 0; i < static_cast<int>(atoms.size()); ++i) {
# Line 402 | Line 404 | namespace OpenMD {
404          }      
405        } else {
406          set<int> oneAtomSet;
407 <        oneAtomSet.insert(integrableObject->getGlobalIndex());
408 <        atomGroups.insert(map<int, set<int> >::value_type(integrableObject->getGlobalIndex(), oneAtomSet));        
407 >        oneAtomSet.insert(sd->getGlobalIndex());
408 >        atomGroups.insert(map<int, set<int> >::value_type(sd->getGlobalIndex(), oneAtomSet));        
409        }
410      }  
411            
# Line 537 | Line 539 | namespace OpenMD {
539      Molecule::RigidBodyIterator rbIter;
540      RigidBody* rb;
541      Molecule::IntegrableObjectIterator ii;
542 <    StuntDouble* integrableObject;
543 <    
544 <    for (integrableObject = mol->beginIntegrableObject(ii);
545 <         integrableObject != NULL;
544 <         integrableObject = mol->nextIntegrableObject(ii)) {
542 >    StuntDouble* sd;
543 >    
544 >    for (sd = mol->beginIntegrableObject(ii); sd != NULL;
545 >         sd = mol->nextIntegrableObject(ii)) {
546        
547 <      if (integrableObject->isRigidBody()) {
548 <        rb = static_cast<RigidBody*>(integrableObject);
547 >      if (sd->isRigidBody()) {
548 >        rb = static_cast<RigidBody*>(sd);
549          vector<Atom*> atoms = rb->getAtoms();
550          set<int> rigidAtoms;
551          for (int i = 0; i < static_cast<int>(atoms.size()); ++i) {
# Line 555 | Line 556 | namespace OpenMD {
556          }      
557        } else {
558          set<int> oneAtomSet;
559 <        oneAtomSet.insert(integrableObject->getGlobalIndex());
560 <        atomGroups.insert(map<int, set<int> >::value_type(integrableObject->getGlobalIndex(), oneAtomSet));        
559 >        oneAtomSet.insert(sd->getGlobalIndex());
560 >        atomGroups.insert(map<int, set<int> >::value_type(sd->getGlobalIndex(), oneAtomSet));        
561        }
562      }  
563  
# Line 790 | Line 791 | namespace OpenMD {
791      set<AtomType*>::iterator i;
792      set<AtomType*> atomTypes;
793      atomTypes = getSimulatedAtomTypes();    
794 <    int usesElectrostatic = 0;
795 <    int usesMetallic = 0;
796 <    int usesDirectional = 0;
797 <    int usesFluctuatingCharges =  0;
794 >    bool usesElectrostatic = false;
795 >    bool usesMetallic = false;
796 >    bool usesDirectional = false;
797 >    bool usesFluctuatingCharges =  false;
798      //loop over all of the atom types
799      for (i = atomTypes.begin(); i != atomTypes.end(); ++i) {
800        usesElectrostatic |= (*i)->isElectrostatic();
# Line 802 | Line 803 | namespace OpenMD {
803        usesFluctuatingCharges |= (*i)->isFluctuatingCharge();
804      }
805  
806 < #ifdef IS_MPI    
807 <    int temp;
806 > #ifdef IS_MPI
807 >    bool temp;
808      temp = usesDirectional;
809 <    MPI_Allreduce(&temp, &usesDirectionalAtoms_, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
810 <    
809 >    MPI::COMM_WORLD.Allreduce(&temp, &usesDirectionalAtoms_, 1, MPI::BOOL,
810 >                              MPI::LOR);
811 >        
812      temp = usesMetallic;
813 <    MPI_Allreduce(&temp, &usesMetallicAtoms_, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
813 >    MPI::COMM_WORLD.Allreduce(&temp, &usesMetallicAtoms_, 1, MPI::BOOL,
814 >                              MPI::LOR);
815      
816      temp = usesElectrostatic;
817 <    MPI_Allreduce(&temp, &usesElectrostaticAtoms_, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);
817 >    MPI::COMM_WORLD.Allreduce(&temp, &usesElectrostaticAtoms_, 1, MPI::BOOL,
818 >                              MPI::LOR);
819  
820      temp = usesFluctuatingCharges;
821 <    MPI_Allreduce(&temp, &usesFluctuatingCharges_, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);
821 >    MPI::COMM_WORLD.Allreduce(&temp, &usesFluctuatingCharges_, 1, MPI::BOOL,
822 >                              MPI::LOR);
823   #else
824  
825      usesDirectionalAtoms_ = usesDirectional;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines