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 1969 by gezelter, Wed Feb 26 14:14:50 2014 UTC vs.
Revision 1987 by gezelter, Thu Apr 17 19:07:31 2014 UTC

# Line 74 | Line 74 | namespace OpenMD {
74      nGlobalMols_(0), nGlobalAtoms_(0), nGlobalCutoffGroups_(0),
75      nGlobalIntegrableObjects_(0), nGlobalRigidBodies_(0),
76      nGlobalFluctuatingCharges_(0), nGlobalBonds_(0), nGlobalBends_(0),
77 <    nGlobalTorsions_(0), nGlobalInversions_(0), nAtoms_(0), nBonds_(0),
78 <    nBends_(0), nTorsions_(0), nInversions_(0), nRigidBodies_(0),
79 <    nIntegrableObjects_(0), nCutoffGroups_(0), nConstraints_(0),
80 <    nFluctuatingCharges_(0), sman_(NULL), topologyDone_(false),
81 <    calcBoxDipole_(false), useAtomicVirial_(true) {    
77 >    nGlobalTorsions_(0), nGlobalInversions_(0), nGlobalConstraints_(0),
78 >    nAtoms_(0), nBonds_(0), nBends_(0), nTorsions_(0), nInversions_(0),
79 >    nRigidBodies_(0), nIntegrableObjects_(0), nCutoffGroups_(0),
80 >    nConstraints_(0), nFluctuatingCharges_(0), sman_(NULL),
81 >    topologyDone_(false), calcBoxDipole_(false), useAtomicVirial_(true),
82 >    hasNGlobalConstraints_(false) {    
83      
84      MoleculeStamp* molStamp;
85      int nMolWithSameStamp;
# Line 284 | Line 285 | namespace OpenMD {
285      MPI_Allreduce(&ndf_local, &ndf_, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
286      MPI_Allreduce(&nfq_local, &nGlobalFluctuatingCharges_, 1,
287        MPI_INT, MPI_SUM, MPI_COMM_WORLD);
287    // MPI::COMM_WORLD.Allreduce(&ndf_local, &ndf_, 1, MPI::INT,MPI::SUM);
288    // MPI::COMM_WORLD.Allreduce(&nfq_local, &nGlobalFluctuatingCharges_, 1,
289    //                           MPI::INT, MPI::SUM);
288   #else
289      ndf_ = ndf_local;
290      nGlobalFluctuatingCharges_ = nfq_local;
# Line 301 | Line 299 | namespace OpenMD {
299    int SimInfo::getFdf() {
300   #ifdef IS_MPI
301      MPI_Allreduce(&fdf_local, &fdf_, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
304    // MPI::COMM_WORLD.Allreduce(&fdf_local, &fdf_, 1, MPI::INT, MPI::SUM);
302   #else
303      fdf_ = fdf_local;
304   #endif
# Line 358 | Line 355 | namespace OpenMD {
355      
356   #ifdef IS_MPI
357      MPI_Allreduce(&ndfRaw_local, &ndfRaw_, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
361    // MPI::COMM_WORLD.Allreduce(&ndfRaw_local, &ndfRaw_, 1, MPI::INT, MPI::SUM);
358   #else
359      ndfRaw_ = ndfRaw_local;
360   #endif
# Line 369 | Line 365 | namespace OpenMD {
365  
366      ndfTrans_local = 3 * nIntegrableObjects_ - nConstraints_;
367  
372
368   #ifdef IS_MPI
369 <    MPI_Allreduce(&ndfTrans_local, &ndfTrans_, 1,
370 <      MPI_INT, MPI_SUM, MPI_COMM_WORLD);
376 <    // MPI::COMM_WORLD.Allreduce(&ndfTrans_local, &ndfTrans_, 1,
377 <    //                           MPI::INT, MPI::SUM);
369 >    MPI_Allreduce(&ndfTrans_local, &ndfTrans_, 1, MPI_INT, MPI_SUM,
370 >                  MPI_COMM_WORLD);
371   #else
372      ndfTrans_ = ndfTrans_local;
373   #endif
374  
375      ndfTrans_ = ndfTrans_ - 3 - nZconstraint_;
383
376    }
377  
378    void SimInfo::addInteractionPairs(Molecule* mol) {
# Line 717 | Line 709 | namespace OpenMD {
709     */
710    void SimInfo::update() {  
711      setupSimVariables();
712 +    calcNConstraints();
713      calcNdf();
714      calcNdfRaw();
715      calcNdfTrans();
# Line 758 | Line 751 | namespace OpenMD {
751  
752      int nproc;
753      MPI_Comm_size( MPI_COMM_WORLD, &nproc);
761    // int nproc = MPI::COMM_WORLD.Get_size();
754  
755      // we need arrays to hold the counts and displacement vectors for
756      // all processors
# Line 768 | Line 760 | namespace OpenMD {
760      // fill the counts array
761      MPI_Allgather(&count_local, 1, MPI_INT, &counts[0],
762                    1, MPI_INT, MPI_COMM_WORLD);
771    // MPI::COMM_WORLD.Allgather(&count_local, 1, MPI::INT, &counts[0],
772    //                           1, MPI::INT);
763    
764      // use the processor counts to compute the displacement array
765      disps[0] = 0;    
# Line 786 | Line 776 | namespace OpenMD {
776      MPI_Allgatherv(&foundTypes[0], count_local, MPI_INT,
777                     &ftGlobal[0], &counts[0], &disps[0],
778                     MPI_INT, MPI_COMM_WORLD);
789    // MPI::COMM_WORLD.Allgatherv(&foundTypes[0], count_local, MPI::INT,
790    //                            &ftGlobal[0], &counts[0], &disps[0],
791    //                            MPI::INT);
779  
780      vector<int>::iterator j;
781  
# Line 857 | Line 844 | namespace OpenMD {
844      temp = usesDirectional;
845      MPI_Allreduce(MPI_IN_PLACE, &temp, 1, MPI_INT,  MPI_LOR, MPI_COMM_WORLD);
846      usesDirectionalAtoms_ = (temp == 0) ? false : true;
860
861    // MPI::COMM_WORLD.Allreduce(&temp, &usesDirectionalAtoms_, 1, MPI::BOOL,
862    //                           MPI::LOR);
847      
848      temp = usesMetallic;
849      MPI_Allreduce(MPI_IN_PLACE, &temp, 1, MPI_INT,  MPI_LOR, MPI_COMM_WORLD);
850      usesMetallicAtoms_ = (temp == 0) ? false : true;
851  
868    // MPI::COMM_WORLD.Allreduce(&temp, &usesMetallicAtoms_, 1, MPI::BOOL,
869    //                           MPI::LOR);
870    
852      temp = usesElectrostatic;
853      MPI_Allreduce(MPI_IN_PLACE, &temp, 1, MPI_INT,  MPI_LOR, MPI_COMM_WORLD);
854      usesElectrostaticAtoms_ = (temp == 0) ? false : true;
874
875    // MPI::COMM_WORLD.Allreduce(&temp, &usesElectrostaticAtoms_, 1, MPI::BOOL,
876    //                           MPI::LOR);
855  
856      temp = usesFluctuatingCharges;
857      MPI_Allreduce(MPI_IN_PLACE, &temp, 1, MPI_INT,  MPI_LOR, MPI_COMM_WORLD);
858      usesFluctuatingCharges_ = (temp == 0) ? false : true;
881
882    // MPI::COMM_WORLD.Allreduce(&temp, &usesFluctuatingCharges_, 1, MPI::BOOL,
883    //                           MPI::LOR);
884
859   #else
860  
861      usesDirectionalAtoms_ = usesDirectional;
# Line 1096 | Line 1070 | namespace OpenMD {
1070      IOIndexToIntegrableObject= v;
1071    }
1072  
1073 <  int SimInfo::getNGlobalConstraints() {
1100 <    int nGlobalConstraints;
1073 >  void SimInfo::calcNConstraints() {
1074   #ifdef IS_MPI
1075 <    MPI_Allreduce(&nConstraints_, &nGlobalConstraints, 1,  
1076 <                              MPI_INT, MPI_SUM, MPI_COMM_WORLD);
1104 <    // MPI::COMM_WORLD.Allreduce(&nConstraints_, &nGlobalConstraints, 1,
1105 <    //                           MPI::INT, MPI::SUM);
1075 >    MPI_Allreduce(&nConstraints_, &nGlobalConstraints_, 1,  
1076 >                  MPI_INT, MPI_SUM, MPI_COMM_WORLD);
1077   #else
1078 <    nGlobalConstraints =  nConstraints_;
1078 >    nGlobalConstraints_ =  nConstraints_;
1079   #endif
1109    return nGlobalConstraints;
1080    }
1081  
1082   }//end namespace OpenMD

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines