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 1908 by gezelter, Fri Jul 19 21:25:45 2013 UTC vs.
Revision 1953 by gezelter, Thu Dec 5 18:19:26 2013 UTC

# 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 72 | Line 72 | namespace OpenMD {
72      forceField_(ff), simParams_(simParams),
73      ndf_(0), fdf_local(0), ndfRaw_(0), ndfTrans_(0), nZconstraint_(0),
74      nGlobalMols_(0), nGlobalAtoms_(0), nGlobalCutoffGroups_(0),
75 <    nGlobalIntegrableObjects_(0), nGlobalRigidBodies_(0), nGlobalFluctuatingCharges_(0),
76 <    nAtoms_(0), nBonds_(0),  nBends_(0), nTorsions_(0), nInversions_(0),
77 <    nRigidBodies_(0), nIntegrableObjects_(0), nCutoffGroups_(0),
78 <    nConstraints_(0), nFluctuatingCharges_(0), sman_(NULL), topologyDone_(false),
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) {    
82      
83      MoleculeStamp* molStamp;
# Line 103 | Line 105 | namespace OpenMD {
105        addMoleculeStamp(molStamp, nMolWithSameStamp);
106        
107        //calculate atoms in molecules
108 <      nGlobalAtoms_ += molStamp->getNAtoms() *nMolWithSameStamp;  
108 >      nGlobalAtoms_ += molStamp->getNAtoms() * nMolWithSameStamp;
109 >      nGlobalBonds_ += molStamp->getNBonds() * nMolWithSameStamp;
110 >      nGlobalBends_ += molStamp->getNBends() * nMolWithSameStamp;
111 >      nGlobalTorsions_ += molStamp->getNTorsions() * nMolWithSameStamp;
112 >      nGlobalInversions_ += molStamp->getNInversions() * nMolWithSameStamp;
113        
114        //calculate atoms in cutoff groups
115        int nAtomsInGroups = 0;
# Line 418 | Line 424 | namespace OpenMD {
424          atomGroups.insert(map<int, set<int> >::value_type(sd->getGlobalIndex(), oneAtomSet));        
425        }
426      }  
427 +
428            
429      for (bond= mol->beginBond(bondIter); bond != NULL;
430           bond = mol->nextBond(bondIter)) {
# Line 938 | Line 945 | namespace OpenMD {
945        }      
946      }
947  
948 <    // Build the identArray_
948 >    // Build the identArray_ and regions_
949  
950      identArray_.clear();
951 <    identArray_.reserve(getNAtoms());    
952 <    for(mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) {        
951 >    identArray_.reserve(getNAtoms());  
952 >    regions_.clear();
953 >    regions_.reserve(getNAtoms());
954 >
955 >    for(mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) {      
956 >      int reg = mol->getRegion();      
957        for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
958          identArray_.push_back(atom->getIdent());
959 +        regions_.push_back(reg);
960        }
961      }    
962 <    
962 >      
963      topologyDone_ = true;
964    }
965  
# Line 982 | Line 994 | namespace OpenMD {
994      delete sman_;
995      sman_ = sman;
996  
985    Molecule* mol;
986    RigidBody* rb;
987    Atom* atom;
988    CutoffGroup* cg;
997      SimInfo::MoleculeIterator mi;
998 +    Molecule::AtomIterator ai;
999      Molecule::RigidBodyIterator rbIter;
991    Molecule::AtomIterator atomIter;
1000      Molecule::CutoffGroupIterator cgIter;
1001 +    Molecule::BondIterator bondIter;
1002 +    Molecule::BendIterator bendIter;
1003 +    Molecule::TorsionIterator torsionIter;
1004 +    Molecule::InversionIterator inversionIter;
1005  
1006 +    Molecule* mol;
1007 +    Atom* atom;
1008 +    RigidBody* rb;
1009 +    CutoffGroup* cg;
1010 +    Bond* bond;
1011 +    Bend* bend;
1012 +    Torsion* torsion;
1013 +    Inversion* inversion;    
1014 +
1015      for (mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) {
1016          
1017 <      for (atom = mol->beginAtom(atomIter); atom != NULL;
1018 <           atom = mol->nextAtom(atomIter)) {
1017 >      for (atom = mol->beginAtom(ai); atom != NULL;
1018 >           atom = mol->nextAtom(ai)) {
1019          atom->setSnapshotManager(sman_);
1020 <      }
1000 <        
1020 >      }        
1021        for (rb = mol->beginRigidBody(rbIter); rb != NULL;
1022             rb = mol->nextRigidBody(rbIter)) {
1023          rb->setSnapshotManager(sman_);
1024        }
1005
1025        for (cg = mol->beginCutoffGroup(cgIter); cg != NULL;
1026             cg = mol->nextCutoffGroup(cgIter)) {
1027          cg->setSnapshotManager(sman_);
1028        }
1029 <    }    
1030 <    
1029 >      for (bond = mol->beginBond(bondIter); bond != NULL;
1030 >           bond = mol->nextBond(bondIter)) {
1031 >        bond->setSnapshotManager(sman_);
1032 >      }
1033 >      for (bend = mol->beginBend(bendIter); bend != NULL;
1034 >           bend = mol->nextBend(bendIter)) {
1035 >        bend->setSnapshotManager(sman_);
1036 >      }
1037 >      for (torsion = mol->beginTorsion(torsionIter); torsion != NULL;
1038 >           torsion = mol->nextTorsion(torsionIter)) {
1039 >        torsion->setSnapshotManager(sman_);
1040 >      }
1041 >      for (inversion = mol->beginInversion(inversionIter); inversion != NULL;
1042 >           inversion = mol->nextInversion(inversionIter)) {
1043 >        inversion->setSnapshotManager(sman_);
1044 >      }
1045 >    }
1046    }
1047  
1048  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines