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 1793 by gezelter, Fri Aug 31 21:16:10 2012 UTC vs.
Revision 1940 by gezelter, Fri Nov 1 19:31:41 2013 UTC

# Line 35 | Line 35
35   *                                                                      
36   * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).            
37   * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).          
38 < * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).          
38 > * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).          
39   * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40   * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
# Line 47 | Line 47
47   * @version 1.0
48   */
49  
50 + #ifdef IS_MPI
51 + #include <mpi.h>
52 + #endif
53   #include <algorithm>
54   #include <set>
55   #include <map>
# Line 61 | Line 64
64   #include "io/ForceFieldOptions.hpp"
65   #include "brains/ForceField.hpp"
66   #include "nonbonded/SwitchingFunction.hpp"
64 #ifdef IS_MPI
65 #include <mpi.h>
66 #endif
67  
68   using namespace std;
69   namespace OpenMD {
# Line 91 | Line 91 | namespace OpenMD {
91      for (vector<Component*>::iterator i = components.begin();
92           i !=components.end(); ++i) {
93        molStamp = (*i)->getMoleculeStamp();
94 +      if ( (*i)->haveRegion() ) {        
95 +        molStamp->setRegion( (*i)->getRegion() );
96 +      } else {
97 +        // set the region to a disallowed value:
98 +        molStamp->setRegion( -1 );
99 +      }
100 +
101        nMolWithSameStamp = (*i)->getNMol();
102        
103        addMoleculeStamp(molStamp, nMolWithSameStamp);
# Line 268 | Line 275 | namespace OpenMD {
275      ndf_local -= nConstraints_;
276  
277   #ifdef IS_MPI
278 <    MPI_Allreduce(&ndf_local,&ndf_,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD);
279 <    MPI_Allreduce(&nfq_local,&nGlobalFluctuatingCharges_,1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
278 >    MPI::COMM_WORLD.Allreduce(&ndf_local, &ndf_, 1, MPI::INT,MPI::SUM);
279 >    MPI::COMM_WORLD.Allreduce(&nfq_local, &nGlobalFluctuatingCharges_, 1,
280 >                              MPI::INT, MPI::SUM);
281   #else
282      ndf_ = ndf_local;
283      nGlobalFluctuatingCharges_ = nfq_local;
# Line 283 | Line 291 | namespace OpenMD {
291  
292    int SimInfo::getFdf() {
293   #ifdef IS_MPI
294 <    MPI_Allreduce(&fdf_local,&fdf_,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD);
294 >    MPI::COMM_WORLD.Allreduce(&fdf_local, &fdf_, 1, MPI::INT, MPI::SUM);
295   #else
296      fdf_ = fdf_local;
297   #endif
# Line 339 | Line 347 | namespace OpenMD {
347      }
348      
349   #ifdef IS_MPI
350 <    MPI_Allreduce(&ndfRaw_local,&ndfRaw_,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD);
350 >    MPI::COMM_WORLD.Allreduce(&ndfRaw_local, &ndfRaw_, 1, MPI::INT, MPI::SUM);
351   #else
352      ndfRaw_ = ndfRaw_local;
353   #endif
# Line 352 | Line 360 | namespace OpenMD {
360  
361  
362   #ifdef IS_MPI
363 <    MPI_Allreduce(&ndfTrans_local,&ndfTrans_,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD);
363 >    MPI::COMM_WORLD.Allreduce(&ndfTrans_local, &ndfTrans_, 1,
364 >                              MPI::INT, MPI::SUM);
365   #else
366      ndfTrans_ = ndfTrans_local;
367   #endif
# Line 409 | Line 418 | namespace OpenMD {
418          atomGroups.insert(map<int, set<int> >::value_type(sd->getGlobalIndex(), oneAtomSet));        
419        }
420      }  
421 +
422            
423      for (bond= mol->beginBond(bondIter); bond != NULL;
424           bond = mol->nextBond(bondIter)) {
# Line 778 | Line 788 | namespace OpenMD {
788   #endif
789  
790      return atomTypes;        
791 +  }
792 +
793 +
794 +  int getGlobalCountOfType(AtomType* atype) {
795 +    /*
796 +    set<AtomType*> atypes = getSimulatedAtomTypes();
797 +    map<AtomType*, int> counts_;
798 +
799 +    for(mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) {
800 +      for(atom = mol->beginAtom(ai); atom != NULL;
801 +          atom = mol->nextAtom(ai)) {
802 +        atom->getAtomType();
803 +      }      
804 +    }    
805 +    */
806 +    return 0;
807    }
808  
809    void SimInfo::setupSimVariables() {
# Line 913 | Line 939 | namespace OpenMD {
939        }      
940      }
941  
942 <    // Build the identArray_
942 >    // Build the identArray_ and regions_
943  
944      identArray_.clear();
945 <    identArray_.reserve(getNAtoms());    
946 <    for(mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) {        
945 >    identArray_.reserve(getNAtoms());  
946 >    regions_.clear();
947 >    regions_.reserve(getNAtoms());
948 >
949 >    for(mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) {      
950 >      int reg = mol->getRegion();      
951        for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
952          identArray_.push_back(atom->getIdent());
953 +        regions_.push_back(reg);
954        }
955      }    
956 <    
926 <    //scan topology
927 <
928 <    int* excludeList = excludedInteractions_.getPairList();
929 <    int* oneTwoList = oneTwoInteractions_.getPairList();
930 <    int* oneThreeList = oneThreeInteractions_.getPairList();
931 <    int* oneFourList = oneFourInteractions_.getPairList();
932 <
956 >      
957      topologyDone_ = true;
958    }
959  
# Line 1001 | Line 1025 | namespace OpenMD {
1025    
1026    
1027    StuntDouble* SimInfo::getIOIndexToIntegrableObject(int index) {
1028 <    if (index >= IOIndexToIntegrableObject.size()) {
1028 >    if (index >= int(IOIndexToIntegrableObject.size())) {
1029        sprintf(painCave.errMsg,
1030                "SimInfo::getIOIndexToIntegrableObject Error: Integrable Object\n"
1031                "\tindex exceeds number of known objects!\n");
# Line 1019 | Line 1043 | namespace OpenMD {
1043    int SimInfo::getNGlobalConstraints() {
1044      int nGlobalConstraints;
1045   #ifdef IS_MPI
1046 <    MPI_Allreduce(&nConstraints_, &nGlobalConstraints, 1, MPI_INT, MPI_SUM,
1047 <                  MPI_COMM_WORLD);    
1046 >    MPI::COMM_WORLD.Allreduce(&nConstraints_, &nGlobalConstraints, 1,
1047 >                              MPI::INT, MPI::SUM);
1048   #else
1049      nGlobalConstraints =  nConstraints_;
1050   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines