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

Comparing trunk/src/brains/SimInfo.cpp (file contents):
Revision 1953 by gezelter, Thu Dec 5 18:19:26 2013 UTC vs.
Revision 2071 by gezelter, Sat Mar 7 21:41:51 2015 UTC

# Line 70 | Line 70 | namespace OpenMD {
70    
71    SimInfo::SimInfo(ForceField* ff, Globals* simParams) :
72      forceField_(ff), simParams_(simParams),
73 <    ndf_(0), fdf_local(0), ndfRaw_(0), ndfTrans_(0), nZconstraint_(0),
73 >    nAtoms_(0), nBonds_(0), nBends_(0), nTorsions_(0), nInversions_(0),
74 >    nRigidBodies_(0), nIntegrableObjects_(0), nCutoffGroups_(0),
75 >    nConstraints_(0), nFluctuatingCharges_(0),    
76      nGlobalMols_(0), nGlobalAtoms_(0), nGlobalCutoffGroups_(0),
77      nGlobalIntegrableObjects_(0), nGlobalRigidBodies_(0),
78      nGlobalFluctuatingCharges_(0), nGlobalBonds_(0), nGlobalBends_(0),
79 <    nGlobalTorsions_(0), nGlobalInversions_(0), nAtoms_(0), nBonds_(0),
80 <    nBends_(0), nTorsions_(0), nInversions_(0), nRigidBodies_(0),
81 <    nIntegrableObjects_(0), nCutoffGroups_(0), nConstraints_(0),
82 <    nFluctuatingCharges_(0), sman_(NULL), topologyDone_(false),
83 <    calcBoxDipole_(false), useAtomicVirial_(true) {    
79 >    nGlobalTorsions_(0), nGlobalInversions_(0), nGlobalConstraints_(0),
80 >    hasNGlobalConstraints_(false),
81 >    ndf_(0), fdf_local(0), ndfRaw_(0), ndfTrans_(0), nZconstraint_(0),
82 >    sman_(NULL), topologyDone_(false), calcBoxDipole_(false),
83 >    calcBoxQuadrupole_(false), useAtomicVirial_(true) {    
84      
85      MoleculeStamp* molStamp;
86      int nMolWithSameStamp;
# Line 281 | Line 283 | namespace OpenMD {
283      ndf_local -= nConstraints_;
284  
285   #ifdef IS_MPI
286 <    MPI::COMM_WORLD.Allreduce(&ndf_local, &ndf_, 1, MPI::INT,MPI::SUM);
287 <    MPI::COMM_WORLD.Allreduce(&nfq_local, &nGlobalFluctuatingCharges_, 1,
288 <                              MPI::INT, MPI::SUM);
286 >    MPI_Allreduce(&ndf_local, &ndf_, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
287 >    MPI_Allreduce(&nfq_local, &nGlobalFluctuatingCharges_, 1,
288 >      MPI_INT, MPI_SUM, MPI_COMM_WORLD);
289   #else
290      ndf_ = ndf_local;
291      nGlobalFluctuatingCharges_ = nfq_local;
# Line 297 | Line 299 | namespace OpenMD {
299  
300    int SimInfo::getFdf() {
301   #ifdef IS_MPI
302 <    MPI::COMM_WORLD.Allreduce(&fdf_local, &fdf_, 1, MPI::INT, MPI::SUM);
302 >    MPI_Allreduce(&fdf_local, &fdf_, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
303   #else
304      fdf_ = fdf_local;
305   #endif
# Line 353 | Line 355 | namespace OpenMD {
355      }
356      
357   #ifdef IS_MPI
358 <    MPI::COMM_WORLD.Allreduce(&ndfRaw_local, &ndfRaw_, 1, MPI::INT, MPI::SUM);
358 >    MPI_Allreduce(&ndfRaw_local, &ndfRaw_, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
359   #else
360      ndfRaw_ = ndfRaw_local;
361   #endif
# Line 364 | Line 366 | namespace OpenMD {
366  
367      ndfTrans_local = 3 * nIntegrableObjects_ - nConstraints_;
368  
367
369   #ifdef IS_MPI
370 <    MPI::COMM_WORLD.Allreduce(&ndfTrans_local, &ndfTrans_, 1,
371 <                              MPI::INT, MPI::SUM);
370 >    MPI_Allreduce(&ndfTrans_local, &ndfTrans_, 1, MPI_INT, MPI_SUM,
371 >                  MPI_COMM_WORLD);
372   #else
373      ndfTrans_ = ndfTrans_local;
374   #endif
375  
376      ndfTrans_ = ndfTrans_ - 3 - nZconstraint_;
376
377    }
378  
379    void SimInfo::addInteractionPairs(Molecule* mol) {
# Line 710 | Line 710 | namespace OpenMD {
710     */
711    void SimInfo::update() {  
712      setupSimVariables();
713 +    calcNConstraints();
714      calcNdf();
715      calcNdfRaw();
716      calcNdfTrans();
# Line 749 | Line 750 | namespace OpenMD {
750      // count_local holds the number of found types on this processor
751      int count_local = foundTypes.size();
752  
753 <    int nproc = MPI::COMM_WORLD.Get_size();
753 >    int nproc;
754 >    MPI_Comm_size( MPI_COMM_WORLD, &nproc);
755  
756      // we need arrays to hold the counts and displacement vectors for
757      // all processors
# Line 757 | Line 759 | namespace OpenMD {
759      vector<int> disps(nproc, 0);
760  
761      // fill the counts array
762 <    MPI::COMM_WORLD.Allgather(&count_local, 1, MPI::INT, &counts[0],
763 <                              1, MPI::INT);
762 >    MPI_Allgather(&count_local, 1, MPI_INT, &counts[0],
763 >                  1, MPI_INT, MPI_COMM_WORLD);
764    
765      // use the processor counts to compute the displacement array
766      disps[0] = 0;    
# Line 772 | Line 774 | namespace OpenMD {
774      vector<int> ftGlobal(totalCount);
775      
776      // now spray out the foundTypes to all the other processors:    
777 <    MPI::COMM_WORLD.Allgatherv(&foundTypes[0], count_local, MPI::INT,
778 <                               &ftGlobal[0], &counts[0], &disps[0],
779 <                               MPI::INT);
777 >    MPI_Allgatherv(&foundTypes[0], count_local, MPI_INT,
778 >                   &ftGlobal[0], &counts[0], &disps[0],
779 >                   MPI_INT, MPI_COMM_WORLD);
780  
781      vector<int>::iterator j;
782  
# Line 820 | Line 822 | namespace OpenMD {
822      if ( simParams_->haveAccumulateBoxDipole() )
823        if ( simParams_->getAccumulateBoxDipole() ) {
824          calcBoxDipole_ = true;      
825 +      }
826 +    // we only call setAccumulateBoxQuadrupole if the accumulateBoxQuadrupole
827 +    // parameter is true
828 +    calcBoxQuadrupole_ = false;
829 +    if ( simParams_->haveAccumulateBoxQuadrupole() )
830 +      if ( simParams_->getAccumulateBoxQuadrupole() ) {
831 +        calcBoxQuadrupole_ = true;      
832        }
833      
834      set<AtomType*>::iterator i;
# Line 838 | Line 847 | namespace OpenMD {
847      }
848  
849   #ifdef IS_MPI
850 <    bool temp;
850 >    int temp;
851 >
852      temp = usesDirectional;
853 <    MPI::COMM_WORLD.Allreduce(&temp, &usesDirectionalAtoms_, 1, MPI::BOOL,
854 <                              MPI::LOR);
845 <        
846 <    temp = usesMetallic;
847 <    MPI::COMM_WORLD.Allreduce(&temp, &usesMetallicAtoms_, 1, MPI::BOOL,
848 <                              MPI::LOR);
853 >    MPI_Allreduce(MPI_IN_PLACE, &temp, 1, MPI_INT,  MPI_LOR, MPI_COMM_WORLD);
854 >    usesDirectionalAtoms_ = (temp == 0) ? false : true;
855      
856 +    temp = usesMetallic;
857 +    MPI_Allreduce(MPI_IN_PLACE, &temp, 1, MPI_INT,  MPI_LOR, MPI_COMM_WORLD);
858 +    usesMetallicAtoms_ = (temp == 0) ? false : true;
859 +
860      temp = usesElectrostatic;
861 <    MPI::COMM_WORLD.Allreduce(&temp, &usesElectrostaticAtoms_, 1, MPI::BOOL,
862 <                              MPI::LOR);
861 >    MPI_Allreduce(MPI_IN_PLACE, &temp, 1, MPI_INT,  MPI_LOR, MPI_COMM_WORLD);
862 >    usesElectrostaticAtoms_ = (temp == 0) ? false : true;
863  
864      temp = usesFluctuatingCharges;
865 <    MPI::COMM_WORLD.Allreduce(&temp, &usesFluctuatingCharges_, 1, MPI::BOOL,
866 <                              MPI::LOR);
865 >    MPI_Allreduce(MPI_IN_PLACE, &temp, 1, MPI_INT,  MPI_LOR, MPI_COMM_WORLD);
866 >    usesFluctuatingCharges_ = (temp == 0) ? false : true;
867   #else
868  
869      usesDirectionalAtoms_ = usesDirectional;
# Line 1068 | Line 1078 | namespace OpenMD {
1078      IOIndexToIntegrableObject= v;
1079    }
1080  
1081 <  int SimInfo::getNGlobalConstraints() {
1072 <    int nGlobalConstraints;
1081 >  void SimInfo::calcNConstraints() {
1082   #ifdef IS_MPI
1083 <    MPI::COMM_WORLD.Allreduce(&nConstraints_, &nGlobalConstraints, 1,
1084 <                              MPI::INT, MPI::SUM);
1083 >    MPI_Allreduce(&nConstraints_, &nGlobalConstraints_, 1,  
1084 >                  MPI_INT, MPI_SUM, MPI_COMM_WORLD);
1085   #else
1086 <    nGlobalConstraints =  nConstraints_;
1086 >    nGlobalConstraints_ =  nConstraints_;
1087   #endif
1079    return nGlobalConstraints;
1088    }
1089  
1090   }//end namespace OpenMD

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines