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

Comparing:
trunk/src/brains/SimInfo.cpp (file contents), Revision 1126 by gezelter, Fri Apr 6 21:53:43 2007 UTC vs.
branches/development/src/brains/SimInfo.cpp (file contents), Revision 1550 by gezelter, Wed Apr 27 21:49:59 2011 UTC

# Line 6 | Line 6
6   * redistribute this software in source and binary code form, provided
7   * that the following conditions are met:
8   *
9 < * 1. Acknowledgement of the program authors must be made in any
10 < *    publication of scientific results based in part on use of the
11 < *    program.  An acceptable form of acknowledgement is citation of
12 < *    the article in which the program was described (Matthew
13 < *    A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher
14 < *    J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented
15 < *    Parallel Simulation Engine for Molecular Dynamics,"
16 < *    J. Comput. Chem. 26, pp. 252-271 (2005))
17 < *
18 < * 2. Redistributions of source code must retain the above copyright
9 > * 1. Redistributions of source code must retain the above copyright
10   *    notice, this list of conditions and the following disclaimer.
11   *
12 < * 3. Redistributions in binary form must reproduce the above copyright
12 > * 2. Redistributions in binary form must reproduce the above copyright
13   *    notice, this list of conditions and the following disclaimer in the
14   *    documentation and/or other materials provided with the
15   *    distribution.
# Line 37 | Line 28
28   * arising out of the use of or inability to use software, even if the
29   * University of Notre Dame has been advised of the possibility of
30   * such damages.
31 + *
32 + * SUPPORT OPEN SCIENCE!  If you use OpenMD or its source code in your
33 + * research, please cite the appropriate papers when you publish your
34 + * work.  Good starting points are:
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).          
39 + * [4]  Vardeman & Gezelter, in progress (2009).                        
40   */
41  
42   /**
# Line 54 | Line 54
54   #include "math/Vector3.hpp"
55   #include "primitives/Molecule.hpp"
56   #include "primitives/StuntDouble.hpp"
57 #include "UseTheForce/fCutoffPolicy.h"
58 #include "UseTheForce/DarkSide/fElectrostaticSummationMethod.h"
59 #include "UseTheForce/DarkSide/fElectrostaticScreeningMethod.h"
60 #include "UseTheForce/DarkSide/fSwitchingFunctionType.h"
61 #include "UseTheForce/doForces_interface.h"
62 #include "UseTheForce/DarkSide/neighborLists_interface.h"
63 #include "UseTheForce/DarkSide/electrostatic_interface.h"
64 #include "UseTheForce/DarkSide/switcheroo_interface.h"
57   #include "utils/MemoryUtils.hpp"
58   #include "utils/simError.h"
59   #include "selection/SelectionManager.hpp"
60   #include "io/ForceFieldOptions.hpp"
61   #include "UseTheForce/ForceField.hpp"
62 + #include "nonbonded/SwitchingFunction.hpp"
63  
64 <
65 < #ifdef IS_MPI
73 < #include "UseTheForce/mpiComponentPlan.h"
74 < #include "UseTheForce/DarkSide/simParallel_interface.h"
75 < #endif
76 <
77 < namespace oopse {
78 <  std::set<int> getRigidSet(int index, std::map<int, std::set<int> >& container) {
79 <    std::map<int, std::set<int> >::iterator i = container.find(index);
80 <    std::set<int> result;
81 <    if (i != container.end()) {
82 <        result = i->second;
83 <    }
84 <
85 <    return result;
86 <  }
64 > using namespace std;
65 > namespace OpenMD {
66    
67    SimInfo::SimInfo(ForceField* ff, Globals* simParams) :
68      forceField_(ff), simParams_(simParams),
69      ndf_(0), fdf_local(0), ndfRaw_(0), ndfTrans_(0), nZconstraint_(0),
70      nGlobalMols_(0), nGlobalAtoms_(0), nGlobalCutoffGroups_(0),
71      nGlobalIntegrableObjects_(0), nGlobalRigidBodies_(0),
72 <    nAtoms_(0), nBonds_(0),  nBends_(0), nTorsions_(0), nRigidBodies_(0),
73 <    nIntegrableObjects_(0),  nCutoffGroups_(0), nConstraints_(0),
74 <    sman_(NULL), fortranInitialized_(false), calcBoxDipole_(false),
75 <    useAtomicVirial_(true) {
76 <
77 <      MoleculeStamp* molStamp;
78 <      int nMolWithSameStamp;
79 <      int nCutoffAtoms = 0; // number of atoms belong to cutoff groups
80 <      int nGroups = 0;      //total cutoff groups defined in meta-data file
81 <      CutoffGroupStamp* cgStamp;    
82 <      RigidBodyStamp* rbStamp;
83 <      int nRigidAtoms = 0;
84 <      std::vector<Component*> components = simParams->getComponents();
72 >    nAtoms_(0), nBonds_(0),  nBends_(0), nTorsions_(0), nInversions_(0),
73 >    nRigidBodies_(0), nIntegrableObjects_(0), nCutoffGroups_(0),
74 >    nConstraints_(0), sman_(NULL), fortranInitialized_(false),
75 >    calcBoxDipole_(false), useAtomicVirial_(true) {    
76 >    
77 >    MoleculeStamp* molStamp;
78 >    int nMolWithSameStamp;
79 >    int nCutoffAtoms = 0; // number of atoms belong to cutoff groups
80 >    int nGroups = 0;       //total cutoff groups defined in meta-data file
81 >    CutoffGroupStamp* cgStamp;    
82 >    RigidBodyStamp* rbStamp;
83 >    int nRigidAtoms = 0;
84 >    
85 >    vector<Component*> components = simParams->getComponents();
86 >    
87 >    for (vector<Component*>::iterator i = components.begin(); i !=components.end(); ++i) {
88 >      molStamp = (*i)->getMoleculeStamp();
89 >      nMolWithSameStamp = (*i)->getNMol();
90        
91 <      for (std::vector<Component*>::iterator i = components.begin(); i !=components.end(); ++i) {
92 <        molStamp = (*i)->getMoleculeStamp();
93 <        nMolWithSameStamp = (*i)->getNMol();
94 <        
95 <        addMoleculeStamp(molStamp, nMolWithSameStamp);
96 <
97 <        //calculate atoms in molecules
98 <        nGlobalAtoms_ += molStamp->getNAtoms() *nMolWithSameStamp;  
99 <
100 <        //calculate atoms in cutoff groups
101 <        int nAtomsInGroups = 0;
102 <        int nCutoffGroupsInStamp = molStamp->getNCutoffGroups();
119 <        
120 <        for (int j=0; j < nCutoffGroupsInStamp; j++) {
121 <          cgStamp = molStamp->getCutoffGroupStamp(j);
122 <          nAtomsInGroups += cgStamp->getNMembers();
123 <        }
124 <
125 <        nGroups += nCutoffGroupsInStamp * nMolWithSameStamp;
126 <
127 <        nCutoffAtoms += nAtomsInGroups * nMolWithSameStamp;            
128 <
129 <        //calculate atoms in rigid bodies
130 <        int nAtomsInRigidBodies = 0;
131 <        int nRigidBodiesInStamp = molStamp->getNRigidBodies();
132 <        
133 <        for (int j=0; j < nRigidBodiesInStamp; j++) {
134 <          rbStamp = molStamp->getRigidBodyStamp(j);
135 <          nAtomsInRigidBodies += rbStamp->getNMembers();
136 <        }
137 <
138 <        nGlobalRigidBodies_ += nRigidBodiesInStamp * nMolWithSameStamp;
139 <        nRigidAtoms += nAtomsInRigidBodies * nMolWithSameStamp;            
140 <        
91 >      addMoleculeStamp(molStamp, nMolWithSameStamp);
92 >      
93 >      //calculate atoms in molecules
94 >      nGlobalAtoms_ += molStamp->getNAtoms() *nMolWithSameStamp;  
95 >      
96 >      //calculate atoms in cutoff groups
97 >      int nAtomsInGroups = 0;
98 >      int nCutoffGroupsInStamp = molStamp->getNCutoffGroups();
99 >      
100 >      for (int j=0; j < nCutoffGroupsInStamp; j++) {
101 >        cgStamp = molStamp->getCutoffGroupStamp(j);
102 >        nAtomsInGroups += cgStamp->getNMembers();
103        }
104 +      
105 +      nGroups += nCutoffGroupsInStamp * nMolWithSameStamp;
106 +      
107 +      nCutoffAtoms += nAtomsInGroups * nMolWithSameStamp;            
108 +      
109 +      //calculate atoms in rigid bodies
110 +      int nAtomsInRigidBodies = 0;
111 +      int nRigidBodiesInStamp = molStamp->getNRigidBodies();
112 +      
113 +      for (int j=0; j < nRigidBodiesInStamp; j++) {
114 +        rbStamp = molStamp->getRigidBodyStamp(j);
115 +        nAtomsInRigidBodies += rbStamp->getNMembers();
116 +      }
117 +      
118 +      nGlobalRigidBodies_ += nRigidBodiesInStamp * nMolWithSameStamp;
119 +      nRigidAtoms += nAtomsInRigidBodies * nMolWithSameStamp;            
120 +      
121 +    }
122 +    
123 +    //every free atom (atom does not belong to cutoff groups) is a cutoff
124 +    //group therefore the total number of cutoff groups in the system is
125 +    //equal to the total number of atoms minus number of atoms belong to
126 +    //cutoff group defined in meta-data file plus the number of cutoff
127 +    //groups defined in meta-data file
128 +    std::cerr << "nGA = " << nGlobalAtoms_ << "\n";
129 +    std::cerr << "nCA = " << nCutoffAtoms << "\n";
130 +    std::cerr << "nG = " << nGroups << "\n";
131  
132 <      //every free atom (atom does not belong to cutoff groups) is a cutoff
144 <      //group therefore the total number of cutoff groups in the system is
145 <      //equal to the total number of atoms minus number of atoms belong to
146 <      //cutoff group defined in meta-data file plus the number of cutoff
147 <      //groups defined in meta-data file
148 <      nGlobalCutoffGroups_ = nGlobalAtoms_ - nCutoffAtoms + nGroups;
132 >    nGlobalCutoffGroups_ = nGlobalAtoms_ - nCutoffAtoms + nGroups;
133  
134 <      //every free atom (atom does not belong to rigid bodies) is an
135 <      //integrable object therefore the total number of integrable objects
136 <      //in the system is equal to the total number of atoms minus number of
137 <      //atoms belong to rigid body defined in meta-data file plus the number
138 <      //of rigid bodies defined in meta-data file
139 <      nGlobalIntegrableObjects_ = nGlobalAtoms_ - nRigidAtoms
140 <                                                + nGlobalRigidBodies_;
134 >    std::cerr << "nGCG = " << nGlobalCutoffGroups_ << "\n";
135 >    
136 >    //every free atom (atom does not belong to rigid bodies) is an
137 >    //integrable object therefore the total number of integrable objects
138 >    //in the system is equal to the total number of atoms minus number of
139 >    //atoms belong to rigid body defined in meta-data file plus the number
140 >    //of rigid bodies defined in meta-data file
141 >    nGlobalIntegrableObjects_ = nGlobalAtoms_ - nRigidAtoms
142 >      + nGlobalRigidBodies_;
143 >    
144 >    nGlobalMols_ = molStampIds_.size();
145 >    molToProcMap_.resize(nGlobalMols_);
146 >  }
147    
158      nGlobalMols_ = molStampIds_.size();
159
160 #ifdef IS_MPI    
161      molToProcMap_.resize(nGlobalMols_);
162 #endif
163
164    }
165
148    SimInfo::~SimInfo() {
149 <    std::map<int, Molecule*>::iterator i;
149 >    map<int, Molecule*>::iterator i;
150      for (i = molecules_.begin(); i != molecules_.end(); ++i) {
151        delete i->second;
152      }
# Line 175 | Line 157 | namespace oopse {
157      delete forceField_;
158    }
159  
178  int SimInfo::getNGlobalConstraints() {
179    int nGlobalConstraints;
180 #ifdef IS_MPI
181    MPI_Allreduce(&nConstraints_, &nGlobalConstraints, 1, MPI_INT, MPI_SUM,
182                  MPI_COMM_WORLD);    
183 #else
184    nGlobalConstraints =  nConstraints_;
185 #endif
186    return nGlobalConstraints;
187  }
160  
161    bool SimInfo::addMolecule(Molecule* mol) {
162      MoleculeIterator i;
163 <
163 >    
164      i = molecules_.find(mol->getGlobalIndex());
165      if (i == molecules_.end() ) {
166 <
167 <      molecules_.insert(std::make_pair(mol->getGlobalIndex(), mol));
168 <        
166 >      
167 >      molecules_.insert(make_pair(mol->getGlobalIndex(), mol));
168 >      
169        nAtoms_ += mol->getNAtoms();
170        nBonds_ += mol->getNBonds();
171        nBends_ += mol->getNBends();
172        nTorsions_ += mol->getNTorsions();
173 +      nInversions_ += mol->getNInversions();
174        nRigidBodies_ += mol->getNRigidBodies();
175        nIntegrableObjects_ += mol->getNIntegrableObjects();
176        nCutoffGroups_ += mol->getNCutoffGroups();
177        nConstraints_ += mol->getNConstraintPairs();
178 <
179 <      addExcludePairs(mol);
180 <        
178 >      
179 >      addInteractionPairs(mol);
180 >      
181        return true;
182      } else {
183        return false;
184      }
185    }
186 <
186 >  
187    bool SimInfo::removeMolecule(Molecule* mol) {
188      MoleculeIterator i;
189      i = molecules_.find(mol->getGlobalIndex());
# Line 223 | Line 196 | namespace oopse {
196        nBonds_ -= mol->getNBonds();
197        nBends_ -= mol->getNBends();
198        nTorsions_ -= mol->getNTorsions();
199 +      nInversions_ -= mol->getNInversions();
200        nRigidBodies_ -= mol->getNRigidBodies();
201        nIntegrableObjects_ -= mol->getNIntegrableObjects();
202        nCutoffGroups_ -= mol->getNCutoffGroups();
203        nConstraints_ -= mol->getNConstraintPairs();
204  
205 <      removeExcludePairs(mol);
205 >      removeInteractionPairs(mol);
206        molecules_.erase(mol->getGlobalIndex());
207  
208        delete mol;
# Line 237 | Line 211 | namespace oopse {
211      } else {
212        return false;
213      }
240
241
214    }    
215  
216          
# Line 256 | Line 228 | namespace oopse {
228    void SimInfo::calcNdf() {
229      int ndf_local;
230      MoleculeIterator i;
231 <    std::vector<StuntDouble*>::iterator j;
231 >    vector<StuntDouble*>::iterator j;
232      Molecule* mol;
233      StuntDouble* integrableObject;
234  
# Line 307 | Line 279 | namespace oopse {
279      int ndfRaw_local;
280  
281      MoleculeIterator i;
282 <    std::vector<StuntDouble*>::iterator j;
282 >    vector<StuntDouble*>::iterator j;
283      Molecule* mol;
284      StuntDouble* integrableObject;
285  
# Line 354 | Line 326 | namespace oopse {
326  
327    }
328  
329 <  void SimInfo::addExcludePairs(Molecule* mol) {
330 <    std::vector<Bond*>::iterator bondIter;
331 <    std::vector<Bend*>::iterator bendIter;
332 <    std::vector<Torsion*>::iterator torsionIter;
329 >  void SimInfo::addInteractionPairs(Molecule* mol) {
330 >    ForceFieldOptions& options_ = forceField_->getForceFieldOptions();
331 >    vector<Bond*>::iterator bondIter;
332 >    vector<Bend*>::iterator bendIter;
333 >    vector<Torsion*>::iterator torsionIter;
334 >    vector<Inversion*>::iterator inversionIter;
335      Bond* bond;
336      Bend* bend;
337      Torsion* torsion;
338 +    Inversion* inversion;
339      int a;
340      int b;
341      int c;
342      int d;
343  
344 <    std::map<int, std::set<int> > atomGroups;
344 >    // atomGroups can be used to add special interaction maps between
345 >    // groups of atoms that are in two separate rigid bodies.
346 >    // However, most site-site interactions between two rigid bodies
347 >    // are probably not special, just the ones between the physically
348 >    // bonded atoms.  Interactions *within* a single rigid body should
349 >    // always be excluded.  These are done at the bottom of this
350 >    // function.
351  
352 +    map<int, set<int> > atomGroups;
353      Molecule::RigidBodyIterator rbIter;
354      RigidBody* rb;
355      Molecule::IntegrableObjectIterator ii;
356      StuntDouble* integrableObject;
357      
358 <    for (integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL;
359 <           integrableObject = mol->nextIntegrableObject(ii)) {
360 <
358 >    for (integrableObject = mol->beginIntegrableObject(ii);
359 >         integrableObject != NULL;
360 >         integrableObject = mol->nextIntegrableObject(ii)) {
361 >      
362        if (integrableObject->isRigidBody()) {
363 <          rb = static_cast<RigidBody*>(integrableObject);
364 <          std::vector<Atom*> atoms = rb->getAtoms();
365 <          std::set<int> rigidAtoms;
366 <          for (int i = 0; i < atoms.size(); ++i) {
367 <            rigidAtoms.insert(atoms[i]->getGlobalIndex());
368 <          }
369 <          for (int i = 0; i < atoms.size(); ++i) {
370 <            atomGroups.insert(std::map<int, std::set<int> >::value_type(atoms[i]->getGlobalIndex(), rigidAtoms));
371 <          }      
363 >        rb = static_cast<RigidBody*>(integrableObject);
364 >        vector<Atom*> atoms = rb->getAtoms();
365 >        set<int> rigidAtoms;
366 >        for (int i = 0; i < static_cast<int>(atoms.size()); ++i) {
367 >          rigidAtoms.insert(atoms[i]->getGlobalIndex());
368 >        }
369 >        for (int i = 0; i < static_cast<int>(atoms.size()); ++i) {
370 >          atomGroups.insert(map<int, set<int> >::value_type(atoms[i]->getGlobalIndex(), rigidAtoms));
371 >        }      
372        } else {
373 <        std::set<int> oneAtomSet;
373 >        set<int> oneAtomSet;
374          oneAtomSet.insert(integrableObject->getGlobalIndex());
375 <        atomGroups.insert(std::map<int, std::set<int> >::value_type(integrableObject->getGlobalIndex(), oneAtomSet));        
375 >        atomGroups.insert(map<int, set<int> >::value_type(integrableObject->getGlobalIndex(), oneAtomSet));        
376        }
377      }  
378 +          
379 +    for (bond= mol->beginBond(bondIter); bond != NULL;
380 +         bond = mol->nextBond(bondIter)) {
381  
396    
397    
398    for (bond= mol->beginBond(bondIter); bond != NULL; bond = mol->nextBond(bondIter)) {
382        a = bond->getAtomA()->getGlobalIndex();
383 <      b = bond->getAtomB()->getGlobalIndex();        
384 <      exclude_.addPair(a, b);
383 >      b = bond->getAtomB()->getGlobalIndex();  
384 >    
385 >      if (options_.havevdw12scale() || options_.haveelectrostatic12scale()) {
386 >        oneTwoInteractions_.addPair(a, b);
387 >      } else {
388 >        excludedInteractions_.addPair(a, b);
389 >      }
390      }
391  
392 <    for (bend= mol->beginBend(bendIter); bend != NULL; bend = mol->nextBend(bendIter)) {
392 >    for (bend= mol->beginBend(bendIter); bend != NULL;
393 >         bend = mol->nextBend(bendIter)) {
394 >
395        a = bend->getAtomA()->getGlobalIndex();
396        b = bend->getAtomB()->getGlobalIndex();        
397        c = bend->getAtomC()->getGlobalIndex();
408      std::set<int> rigidSetA = getRigidSet(a, atomGroups);
409      std::set<int> rigidSetB = getRigidSet(b, atomGroups);
410      std::set<int> rigidSetC = getRigidSet(c, atomGroups);
411
412      exclude_.addPairs(rigidSetA, rigidSetB);
413      exclude_.addPairs(rigidSetA, rigidSetC);
414      exclude_.addPairs(rigidSetB, rigidSetC);
398        
399 <      //exclude_.addPair(a, b);
400 <      //exclude_.addPair(a, c);
401 <      //exclude_.addPair(b, c);        
399 >      if (options_.havevdw12scale() || options_.haveelectrostatic12scale()) {
400 >        oneTwoInteractions_.addPair(a, b);      
401 >        oneTwoInteractions_.addPair(b, c);
402 >      } else {
403 >        excludedInteractions_.addPair(a, b);
404 >        excludedInteractions_.addPair(b, c);
405 >      }
406 >
407 >      if (options_.havevdw13scale() || options_.haveelectrostatic13scale()) {
408 >        oneThreeInteractions_.addPair(a, c);      
409 >      } else {
410 >        excludedInteractions_.addPair(a, c);
411 >      }
412      }
413  
414 <    for (torsion= mol->beginTorsion(torsionIter); torsion != NULL; torsion = mol->nextTorsion(torsionIter)) {
414 >    for (torsion= mol->beginTorsion(torsionIter); torsion != NULL;
415 >         torsion = mol->nextTorsion(torsionIter)) {
416 >
417        a = torsion->getAtomA()->getGlobalIndex();
418        b = torsion->getAtomB()->getGlobalIndex();        
419        c = torsion->getAtomC()->getGlobalIndex();        
420 <      d = torsion->getAtomD()->getGlobalIndex();        
426 <      std::set<int> rigidSetA = getRigidSet(a, atomGroups);
427 <      std::set<int> rigidSetB = getRigidSet(b, atomGroups);
428 <      std::set<int> rigidSetC = getRigidSet(c, atomGroups);
429 <      std::set<int> rigidSetD = getRigidSet(d, atomGroups);
420 >      d = torsion->getAtomD()->getGlobalIndex();      
421  
422 <      exclude_.addPairs(rigidSetA, rigidSetB);
423 <      exclude_.addPairs(rigidSetA, rigidSetC);
424 <      exclude_.addPairs(rigidSetA, rigidSetD);
425 <      exclude_.addPairs(rigidSetB, rigidSetC);
426 <      exclude_.addPairs(rigidSetB, rigidSetD);
427 <      exclude_.addPairs(rigidSetC, rigidSetD);
422 >      if (options_.havevdw12scale() || options_.haveelectrostatic12scale()) {
423 >        oneTwoInteractions_.addPair(a, b);      
424 >        oneTwoInteractions_.addPair(b, c);
425 >        oneTwoInteractions_.addPair(c, d);
426 >      } else {
427 >        excludedInteractions_.addPair(a, b);
428 >        excludedInteractions_.addPair(b, c);
429 >        excludedInteractions_.addPair(c, d);
430 >      }
431  
432 <      /*
433 <      exclude_.addPairs(rigidSetA.begin(), rigidSetA.end(), rigidSetB.begin(), rigidSetB.end());
434 <      exclude_.addPairs(rigidSetA.begin(), rigidSetA.end(), rigidSetC.begin(), rigidSetC.end());
435 <      exclude_.addPairs(rigidSetA.begin(), rigidSetA.end(), rigidSetD.begin(), rigidSetD.end());
436 <      exclude_.addPairs(rigidSetB.begin(), rigidSetB.end(), rigidSetC.begin(), rigidSetC.end());
437 <      exclude_.addPairs(rigidSetB.begin(), rigidSetB.end(), rigidSetD.begin(), rigidSetD.end());
438 <      exclude_.addPairs(rigidSetC.begin(), rigidSetC.end(), rigidSetD.begin(), rigidSetD.end());
439 <        
440 <      
441 <      exclude_.addPair(a, b);
442 <      exclude_.addPair(a, c);
443 <      exclude_.addPair(a, d);
444 <      exclude_.addPair(b, c);
451 <      exclude_.addPair(b, d);
452 <      exclude_.addPair(c, d);        
453 <      */
432 >      if (options_.havevdw13scale() || options_.haveelectrostatic13scale()) {
433 >        oneThreeInteractions_.addPair(a, c);      
434 >        oneThreeInteractions_.addPair(b, d);      
435 >      } else {
436 >        excludedInteractions_.addPair(a, c);
437 >        excludedInteractions_.addPair(b, d);
438 >      }
439 >
440 >      if (options_.havevdw14scale() || options_.haveelectrostatic14scale()) {
441 >        oneFourInteractions_.addPair(a, d);      
442 >      } else {
443 >        excludedInteractions_.addPair(a, d);
444 >      }
445      }
446  
447 <    for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) {
448 <      std::vector<Atom*> atoms = rb->getAtoms();
449 <      for (int i = 0; i < atoms.size() -1 ; ++i) {
450 <        for (int j = i + 1; j < atoms.size(); ++j) {
447 >    for (inversion= mol->beginInversion(inversionIter); inversion != NULL;
448 >         inversion = mol->nextInversion(inversionIter)) {
449 >
450 >      a = inversion->getAtomA()->getGlobalIndex();
451 >      b = inversion->getAtomB()->getGlobalIndex();        
452 >      c = inversion->getAtomC()->getGlobalIndex();        
453 >      d = inversion->getAtomD()->getGlobalIndex();        
454 >
455 >      if (options_.havevdw12scale() || options_.haveelectrostatic12scale()) {
456 >        oneTwoInteractions_.addPair(a, b);      
457 >        oneTwoInteractions_.addPair(a, c);
458 >        oneTwoInteractions_.addPair(a, d);
459 >      } else {
460 >        excludedInteractions_.addPair(a, b);
461 >        excludedInteractions_.addPair(a, c);
462 >        excludedInteractions_.addPair(a, d);
463 >      }
464 >
465 >      if (options_.havevdw13scale() || options_.haveelectrostatic13scale()) {
466 >        oneThreeInteractions_.addPair(b, c);    
467 >        oneThreeInteractions_.addPair(b, d);    
468 >        oneThreeInteractions_.addPair(c, d);      
469 >      } else {
470 >        excludedInteractions_.addPair(b, c);
471 >        excludedInteractions_.addPair(b, d);
472 >        excludedInteractions_.addPair(c, d);
473 >      }
474 >    }
475 >
476 >    for (rb = mol->beginRigidBody(rbIter); rb != NULL;
477 >         rb = mol->nextRigidBody(rbIter)) {
478 >      vector<Atom*> atoms = rb->getAtoms();
479 >      for (int i = 0; i < static_cast<int>(atoms.size()) -1 ; ++i) {
480 >        for (int j = i + 1; j < static_cast<int>(atoms.size()); ++j) {
481            a = atoms[i]->getGlobalIndex();
482            b = atoms[j]->getGlobalIndex();
483 <          exclude_.addPair(a, b);
483 >          excludedInteractions_.addPair(a, b);
484          }
485        }
486      }        
487  
488    }
489  
490 <  void SimInfo::removeExcludePairs(Molecule* mol) {
491 <    std::vector<Bond*>::iterator bondIter;
492 <    std::vector<Bend*>::iterator bendIter;
493 <    std::vector<Torsion*>::iterator torsionIter;
490 >  void SimInfo::removeInteractionPairs(Molecule* mol) {
491 >    ForceFieldOptions& options_ = forceField_->getForceFieldOptions();
492 >    vector<Bond*>::iterator bondIter;
493 >    vector<Bend*>::iterator bendIter;
494 >    vector<Torsion*>::iterator torsionIter;
495 >    vector<Inversion*>::iterator inversionIter;
496      Bond* bond;
497      Bend* bend;
498      Torsion* torsion;
499 +    Inversion* inversion;
500      int a;
501      int b;
502      int c;
503      int d;
504  
505 <    std::map<int, std::set<int> > atomGroups;
482 <
505 >    map<int, set<int> > atomGroups;
506      Molecule::RigidBodyIterator rbIter;
507      RigidBody* rb;
508      Molecule::IntegrableObjectIterator ii;
509      StuntDouble* integrableObject;
510      
511 <    for (integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL;
512 <           integrableObject = mol->nextIntegrableObject(ii)) {
513 <
511 >    for (integrableObject = mol->beginIntegrableObject(ii);
512 >         integrableObject != NULL;
513 >         integrableObject = mol->nextIntegrableObject(ii)) {
514 >      
515        if (integrableObject->isRigidBody()) {
516 <          rb = static_cast<RigidBody*>(integrableObject);
517 <          std::vector<Atom*> atoms = rb->getAtoms();
518 <          std::set<int> rigidAtoms;
519 <          for (int i = 0; i < atoms.size(); ++i) {
520 <            rigidAtoms.insert(atoms[i]->getGlobalIndex());
521 <          }
522 <          for (int i = 0; i < atoms.size(); ++i) {
523 <            atomGroups.insert(std::map<int, std::set<int> >::value_type(atoms[i]->getGlobalIndex(), rigidAtoms));
524 <          }      
516 >        rb = static_cast<RigidBody*>(integrableObject);
517 >        vector<Atom*> atoms = rb->getAtoms();
518 >        set<int> rigidAtoms;
519 >        for (int i = 0; i < static_cast<int>(atoms.size()); ++i) {
520 >          rigidAtoms.insert(atoms[i]->getGlobalIndex());
521 >        }
522 >        for (int i = 0; i < static_cast<int>(atoms.size()); ++i) {
523 >          atomGroups.insert(map<int, set<int> >::value_type(atoms[i]->getGlobalIndex(), rigidAtoms));
524 >        }      
525        } else {
526 <        std::set<int> oneAtomSet;
526 >        set<int> oneAtomSet;
527          oneAtomSet.insert(integrableObject->getGlobalIndex());
528 <        atomGroups.insert(std::map<int, std::set<int> >::value_type(integrableObject->getGlobalIndex(), oneAtomSet));        
528 >        atomGroups.insert(map<int, set<int> >::value_type(integrableObject->getGlobalIndex(), oneAtomSet));        
529        }
530      }  
531  
532 <    
533 <    for (bond= mol->beginBond(bondIter); bond != NULL; bond = mol->nextBond(bondIter)) {
532 >    for (bond= mol->beginBond(bondIter); bond != NULL;
533 >         bond = mol->nextBond(bondIter)) {
534 >      
535        a = bond->getAtomA()->getGlobalIndex();
536 <      b = bond->getAtomB()->getGlobalIndex();        
537 <      exclude_.removePair(a, b);
536 >      b = bond->getAtomB()->getGlobalIndex();  
537 >    
538 >      if (options_.havevdw12scale() || options_.haveelectrostatic12scale()) {
539 >        oneTwoInteractions_.removePair(a, b);
540 >      } else {
541 >        excludedInteractions_.removePair(a, b);
542 >      }
543      }
544  
545 <    for (bend= mol->beginBend(bendIter); bend != NULL; bend = mol->nextBend(bendIter)) {
545 >    for (bend= mol->beginBend(bendIter); bend != NULL;
546 >         bend = mol->nextBend(bendIter)) {
547 >
548        a = bend->getAtomA()->getGlobalIndex();
549        b = bend->getAtomB()->getGlobalIndex();        
550        c = bend->getAtomC()->getGlobalIndex();
519
520      std::set<int> rigidSetA = getRigidSet(a, atomGroups);
521      std::set<int> rigidSetB = getRigidSet(b, atomGroups);
522      std::set<int> rigidSetC = getRigidSet(c, atomGroups);
523
524      exclude_.removePairs(rigidSetA, rigidSetB);
525      exclude_.removePairs(rigidSetA, rigidSetC);
526      exclude_.removePairs(rigidSetB, rigidSetC);
551        
552 <      //exclude_.removePair(a, b);
553 <      //exclude_.removePair(a, c);
554 <      //exclude_.removePair(b, c);        
552 >      if (options_.havevdw12scale() || options_.haveelectrostatic12scale()) {
553 >        oneTwoInteractions_.removePair(a, b);      
554 >        oneTwoInteractions_.removePair(b, c);
555 >      } else {
556 >        excludedInteractions_.removePair(a, b);
557 >        excludedInteractions_.removePair(b, c);
558 >      }
559 >
560 >      if (options_.havevdw13scale() || options_.haveelectrostatic13scale()) {
561 >        oneThreeInteractions_.removePair(a, c);      
562 >      } else {
563 >        excludedInteractions_.removePair(a, c);
564 >      }
565      }
566  
567 <    for (torsion= mol->beginTorsion(torsionIter); torsion != NULL; torsion = mol->nextTorsion(torsionIter)) {
567 >    for (torsion= mol->beginTorsion(torsionIter); torsion != NULL;
568 >         torsion = mol->nextTorsion(torsionIter)) {
569 >
570        a = torsion->getAtomA()->getGlobalIndex();
571        b = torsion->getAtomB()->getGlobalIndex();        
572        c = torsion->getAtomC()->getGlobalIndex();        
573 <      d = torsion->getAtomD()->getGlobalIndex();        
573 >      d = torsion->getAtomD()->getGlobalIndex();      
574 >  
575 >      if (options_.havevdw12scale() || options_.haveelectrostatic12scale()) {
576 >        oneTwoInteractions_.removePair(a, b);      
577 >        oneTwoInteractions_.removePair(b, c);
578 >        oneTwoInteractions_.removePair(c, d);
579 >      } else {
580 >        excludedInteractions_.removePair(a, b);
581 >        excludedInteractions_.removePair(b, c);
582 >        excludedInteractions_.removePair(c, d);
583 >      }
584  
585 <      std::set<int> rigidSetA = getRigidSet(a, atomGroups);
586 <      std::set<int> rigidSetB = getRigidSet(b, atomGroups);
587 <      std::set<int> rigidSetC = getRigidSet(c, atomGroups);
588 <      std::set<int> rigidSetD = getRigidSet(d, atomGroups);
585 >      if (options_.havevdw13scale() || options_.haveelectrostatic13scale()) {
586 >        oneThreeInteractions_.removePair(a, c);      
587 >        oneThreeInteractions_.removePair(b, d);      
588 >      } else {
589 >        excludedInteractions_.removePair(a, c);
590 >        excludedInteractions_.removePair(b, d);
591 >      }
592  
593 <      exclude_.removePairs(rigidSetA, rigidSetB);
594 <      exclude_.removePairs(rigidSetA, rigidSetC);
595 <      exclude_.removePairs(rigidSetA, rigidSetD);
596 <      exclude_.removePairs(rigidSetB, rigidSetC);
597 <      exclude_.removePairs(rigidSetB, rigidSetD);
598 <      exclude_.removePairs(rigidSetC, rigidSetD);
593 >      if (options_.havevdw14scale() || options_.haveelectrostatic14scale()) {
594 >        oneFourInteractions_.removePair(a, d);      
595 >      } else {
596 >        excludedInteractions_.removePair(a, d);
597 >      }
598 >    }
599  
600 <      /*
601 <      exclude_.removePairs(rigidSetA.begin(), rigidSetA.end(), rigidSetB.begin(), rigidSetB.end());
553 <      exclude_.removePairs(rigidSetA.begin(), rigidSetA.end(), rigidSetC.begin(), rigidSetC.end());
554 <      exclude_.removePairs(rigidSetA.begin(), rigidSetA.end(), rigidSetD.begin(), rigidSetD.end());
555 <      exclude_.removePairs(rigidSetB.begin(), rigidSetB.end(), rigidSetC.begin(), rigidSetC.end());
556 <      exclude_.removePairs(rigidSetB.begin(), rigidSetB.end(), rigidSetD.begin(), rigidSetD.end());
557 <      exclude_.removePairs(rigidSetC.begin(), rigidSetC.end(), rigidSetD.begin(), rigidSetD.end());
600 >    for (inversion= mol->beginInversion(inversionIter); inversion != NULL;
601 >         inversion = mol->nextInversion(inversionIter)) {
602  
603 <      
604 <      exclude_.removePair(a, b);
605 <      exclude_.removePair(a, c);
606 <      exclude_.removePair(a, d);
607 <      exclude_.removePair(b, c);
608 <      exclude_.removePair(b, d);
609 <      exclude_.removePair(c, d);        
610 <      */
603 >      a = inversion->getAtomA()->getGlobalIndex();
604 >      b = inversion->getAtomB()->getGlobalIndex();        
605 >      c = inversion->getAtomC()->getGlobalIndex();        
606 >      d = inversion->getAtomD()->getGlobalIndex();        
607 >
608 >      if (options_.havevdw12scale() || options_.haveelectrostatic12scale()) {
609 >        oneTwoInteractions_.removePair(a, b);      
610 >        oneTwoInteractions_.removePair(a, c);
611 >        oneTwoInteractions_.removePair(a, d);
612 >      } else {
613 >        excludedInteractions_.removePair(a, b);
614 >        excludedInteractions_.removePair(a, c);
615 >        excludedInteractions_.removePair(a, d);
616 >      }
617 >
618 >      if (options_.havevdw13scale() || options_.haveelectrostatic13scale()) {
619 >        oneThreeInteractions_.removePair(b, c);    
620 >        oneThreeInteractions_.removePair(b, d);    
621 >        oneThreeInteractions_.removePair(c, d);      
622 >      } else {
623 >        excludedInteractions_.removePair(b, c);
624 >        excludedInteractions_.removePair(b, d);
625 >        excludedInteractions_.removePair(c, d);
626 >      }
627      }
628  
629 <    for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) {
630 <      std::vector<Atom*> atoms = rb->getAtoms();
631 <      for (int i = 0; i < atoms.size() -1 ; ++i) {
632 <        for (int j = i + 1; j < atoms.size(); ++j) {
629 >    for (rb = mol->beginRigidBody(rbIter); rb != NULL;
630 >         rb = mol->nextRigidBody(rbIter)) {
631 >      vector<Atom*> atoms = rb->getAtoms();
632 >      for (int i = 0; i < static_cast<int>(atoms.size()) -1 ; ++i) {
633 >        for (int j = i + 1; j < static_cast<int>(atoms.size()); ++j) {
634            a = atoms[i]->getGlobalIndex();
635            b = atoms[j]->getGlobalIndex();
636 <          exclude_.removePair(a, b);
636 >          excludedInteractions_.removePair(a, b);
637          }
638        }
639      }        
640 <
640 >    
641    }
642 <
643 <
642 >  
643 >  
644    void SimInfo::addMoleculeStamp(MoleculeStamp* molStamp, int nmol) {
645      int curStampId;
646 <
646 >    
647      //index from 0
648      curStampId = moleculeStamps_.size();
649  
# Line 590 | Line 651 | namespace oopse {
651      molStampIds_.insert(molStampIds_.end(), nmol, curStampId);
652    }
653  
593  void SimInfo::update() {
654  
655 <    setupSimType();
656 <
657 < #ifdef IS_MPI
658 <    setupFortranParallel();
659 < #endif
660 <
661 <    setupFortranSim();
662 <
663 <    //setup fortran force field
604 <    /** @deprecate */    
605 <    int isError = 0;
606 <    
607 <    setupCutoff();
608 <    
609 <    setupElectrostaticSummationMethod( isError );
610 <    setupSwitchingFunction();
611 <    setupAccumulateBoxDipole();
612 <
613 <    if(isError){
614 <      sprintf( painCave.errMsg,
615 <               "ForceField error: There was an error initializing the forceField in fortran.\n" );
616 <      painCave.isFatal = 1;
617 <      simError();
618 <    }
619 <
655 >  /**
656 >   * update
657 >   *
658 >   *  Performs the global checks and variable settings after the
659 >   *  objects have been created.
660 >   *
661 >   */
662 >  void SimInfo::update() {  
663 >    setupSimVariables();
664      calcNdf();
665      calcNdfRaw();
666      calcNdfTrans();
623
624    fortranInitialized_ = true;
667    }
668 <
669 <  std::set<AtomType*> SimInfo::getUniqueAtomTypes() {
668 >  
669 >  /**
670 >   * getSimulatedAtomTypes
671 >   *
672 >   * Returns an STL set of AtomType* that are actually present in this
673 >   * simulation.  Must query all processors to assemble this information.
674 >   *
675 >   */
676 >  set<AtomType*> SimInfo::getSimulatedAtomTypes() {
677      SimInfo::MoleculeIterator mi;
678      Molecule* mol;
679      Molecule::AtomIterator ai;
680      Atom* atom;
681 <    std::set<AtomType*> atomTypes;
682 <
683 <    for(mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) {
635 <
681 >    set<AtomType*> atomTypes;
682 >    
683 >    for(mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) {      
684        for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
685          atomTypes.insert(atom->getAtomType());
686 <      }
687 <        
640 <    }
686 >      }      
687 >    }    
688  
689 <    return atomTypes;        
643 <  }
689 > #ifdef IS_MPI
690  
691 <  void SimInfo::setupSimType() {
692 <    std::set<AtomType*>::iterator i;
647 <    std::set<AtomType*> atomTypes;
648 <    atomTypes = getUniqueAtomTypes();
649 <    
650 <    int useLennardJones = 0;
651 <    int useElectrostatic = 0;
652 <    int useEAM = 0;
653 <    int useSC = 0;
654 <    int useCharge = 0;
655 <    int useDirectional = 0;
656 <    int useDipole = 0;
657 <    int useGayBerne = 0;
658 <    int useSticky = 0;
659 <    int useStickyPower = 0;
660 <    int useShape = 0;
661 <    int useFLARB = 0; //it is not in AtomType yet
662 <    int useDirectionalAtom = 0;    
663 <    int useElectrostatics = 0;
664 <    //usePBC and useRF are from simParams
665 <    int usePBC = simParams_->getUsePeriodicBoundaryConditions();
666 <    int useRF;
667 <    int useSF;
668 <    int useSP;
669 <    int useBoxDipole;
691 >    // loop over the found atom types on this processor, and add their
692 >    // numerical idents to a vector:
693  
694 <    std::string myMethod;
694 >    vector<int> foundTypes;
695 >    set<AtomType*>::iterator i;
696 >    for (i = atomTypes.begin(); i != atomTypes.end(); ++i)
697 >      foundTypes.push_back( (*i)->getIdent() );
698  
699 <    // set the useRF logical
700 <    useRF = 0;
675 <    useSF = 0;
676 <    useSP = 0;
699 >    // count_local holds the number of found types on this processor
700 >    int count_local = foundTypes.size();
701  
702 +    // count holds the total number of found types on all processors
703 +    // (some will be redundant with the ones found locally):
704 +    int count;
705 +    MPI::COMM_WORLD.Allreduce(&count_local, &count, 1, MPI::INT, MPI::SUM);
706  
707 <    if (simParams_->haveElectrostaticSummationMethod()) {
708 <      std::string myMethod = simParams_->getElectrostaticSummationMethod();
709 <      toUpper(myMethod);
710 <      if (myMethod == "REACTION_FIELD"){
711 <        useRF = 1;
712 <      } else if (myMethod == "SHIFTED_FORCE"){
713 <        useSF = 1;
714 <      } else if (myMethod == "SHIFTED_POTENTIAL"){
715 <        useSP = 1;
716 <      }
717 <    }
707 >    // create a vector to hold the globally found types, and resize it:
708 >    vector<int> ftGlobal;
709 >    ftGlobal.resize(count);
710 >    vector<int> counts;
711 >
712 >    int nproc = MPI::COMM_WORLD.Get_size();
713 >    counts.resize(nproc);
714 >    vector<int> disps;
715 >    disps.resize(nproc);
716 >
717 >    // now spray out the foundTypes to all the other processors:
718      
719 <    if (simParams_->haveAccumulateBoxDipole())
720 <      if (simParams_->getAccumulateBoxDipole())
693 <        useBoxDipole = 1;
719 >    MPI::COMM_WORLD.Allgatherv(&foundTypes[0], count_local, MPI::INT,
720 >                               &ftGlobal[0], &counts[0], &disps[0], MPI::INT);
721  
722 +    // foundIdents is a stl set, so inserting an already found ident
723 +    // will have no effect.
724 +    set<int> foundIdents;
725 +    vector<int>::iterator j;
726 +    for (j = ftGlobal.begin(); j != ftGlobal.end(); ++j)
727 +      foundIdents.insert((*j));
728 +    
729 +    // now iterate over the foundIdents and get the actual atom types
730 +    // that correspond to these:
731 +    set<int>::iterator it;
732 +    for (it = foundIdents.begin(); it != foundIdents.end(); ++it)
733 +      atomTypes.insert( forceField_->getAtomType((*it)) );
734 +
735 + #endif
736 +    
737 +    return atomTypes;        
738 +  }
739 +
740 +  void SimInfo::setupSimVariables() {
741      useAtomicVirial_ = simParams_->getUseAtomicVirial();
742 +    // we only call setAccumulateBoxDipole if the accumulateBoxDipole parameter is true
743 +    calcBoxDipole_ = false;
744 +    if ( simParams_->haveAccumulateBoxDipole() )
745 +      if ( simParams_->getAccumulateBoxDipole() ) {
746 +        calcBoxDipole_ = true;      
747 +      }
748  
749 +    set<AtomType*>::iterator i;
750 +    set<AtomType*> atomTypes;
751 +    atomTypes = getSimulatedAtomTypes();    
752 +    int usesElectrostatic = 0;
753 +    int usesMetallic = 0;
754 +    int usesDirectional = 0;
755      //loop over all of the atom types
756      for (i = atomTypes.begin(); i != atomTypes.end(); ++i) {
757 <      useLennardJones |= (*i)->isLennardJones();
758 <      useElectrostatic |= (*i)->isElectrostatic();
759 <      useEAM |= (*i)->isEAM();
702 <      useSC |= (*i)->isSC();
703 <      useCharge |= (*i)->isCharge();
704 <      useDirectional |= (*i)->isDirectional();
705 <      useDipole |= (*i)->isDipole();
706 <      useGayBerne |= (*i)->isGayBerne();
707 <      useSticky |= (*i)->isSticky();
708 <      useStickyPower |= (*i)->isStickyPower();
709 <      useShape |= (*i)->isShape();
757 >      usesElectrostatic |= (*i)->isElectrostatic();
758 >      usesMetallic |= (*i)->isMetal();
759 >      usesDirectional |= (*i)->isDirectional();
760      }
761  
712    if (useSticky || useStickyPower || useDipole || useGayBerne || useShape) {
713      useDirectionalAtom = 1;
714    }
715
716    if (useCharge || useDipole) {
717      useElectrostatics = 1;
718    }
719
762   #ifdef IS_MPI    
763      int temp;
764 +    temp = usesDirectional;
765 +    MPI_Allreduce(&temp, &usesDirectionalAtoms_, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
766  
767 <    temp = usePBC;
768 <    MPI_Allreduce(&temp, &usePBC, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
767 >    temp = usesMetallic;
768 >    MPI_Allreduce(&temp, &usesMetallicAtoms_, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
769  
770 <    temp = useDirectionalAtom;
771 <    MPI_Allreduce(&temp, &useDirectionalAtom, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
770 >    temp = usesElectrostatic;
771 >    MPI_Allreduce(&temp, &usesElectrostaticAtoms_, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);
772 > #endif
773 >    fInfo_.SIM_uses_PBC = usesPeriodicBoundaries_;    
774 >    fInfo_.SIM_uses_DirectionalAtoms = usesDirectionalAtoms_;
775 >    fInfo_.SIM_uses_MetallicAtoms = usesMetallicAtoms_;
776 >    fInfo_.SIM_requires_SkipCorrection = usesElectrostaticAtoms_;
777 >    fInfo_.SIM_requires_SelfCorrection = usesElectrostaticAtoms_;
778 >    fInfo_.SIM_uses_AtomicVirial = usesAtomicVirial_;
779 >  }
780  
729    temp = useLennardJones;
730    MPI_Allreduce(&temp, &useLennardJones, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
781  
782 <    temp = useElectrostatics;
783 <    MPI_Allreduce(&temp, &useElectrostatics, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
782 >  vector<int> SimInfo::getGlobalAtomIndices() {
783 >    SimInfo::MoleculeIterator mi;
784 >    Molecule* mol;
785 >    Molecule::AtomIterator ai;
786 >    Atom* atom;
787  
788 <    temp = useCharge;
736 <    MPI_Allreduce(&temp, &useCharge, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
737 <
738 <    temp = useDipole;
739 <    MPI_Allreduce(&temp, &useDipole, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
740 <
741 <    temp = useSticky;
742 <    MPI_Allreduce(&temp, &useSticky, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
743 <
744 <    temp = useStickyPower;
745 <    MPI_Allreduce(&temp, &useStickyPower, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
788 >    vector<int> GlobalAtomIndices(getNAtoms(), 0);
789      
790 <    temp = useGayBerne;
791 <    MPI_Allreduce(&temp, &useGayBerne, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
790 >    for (mol = beginMolecule(mi); mol != NULL; mol  = nextMolecule(mi)) {
791 >      
792 >      for (atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
793 >        GlobalAtomIndices[atom->getLocalIndex()] = atom->getGlobalIndex();
794 >      }
795 >    }
796 >    return GlobalAtomIndices;
797 >  }
798  
750    temp = useEAM;
751    MPI_Allreduce(&temp, &useEAM, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
799  
800 <    temp = useSC;
801 <    MPI_Allreduce(&temp, &useSC, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);
802 <    
803 <    temp = useShape;
804 <    MPI_Allreduce(&temp, &useShape, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);  
800 >  vector<int> SimInfo::getGlobalGroupIndices() {
801 >    SimInfo::MoleculeIterator mi;
802 >    Molecule* mol;
803 >    Molecule::CutoffGroupIterator ci;
804 >    CutoffGroup* cg;
805  
806 <    temp = useFLARB;
807 <    MPI_Allreduce(&temp, &useFLARB, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
808 <
809 <    temp = useRF;
810 <    MPI_Allreduce(&temp, &useRF, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
811 <
812 <    temp = useSF;
813 <    MPI_Allreduce(&temp, &useSF, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);  
814 <
815 <    temp = useSP;
816 <    MPI_Allreduce(&temp, &useSP, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);
817 <
771 <    temp = useBoxDipole;
772 <    MPI_Allreduce(&temp, &useBoxDipole, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);
773 <
774 <    temp = useAtomicVirial_;
775 <    MPI_Allreduce(&temp, &useAtomicVirial_, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);
776 <
777 < #endif
778 <
779 <    fInfo_.SIM_uses_PBC = usePBC;    
780 <    fInfo_.SIM_uses_DirectionalAtoms = useDirectionalAtom;
781 <    fInfo_.SIM_uses_LennardJones = useLennardJones;
782 <    fInfo_.SIM_uses_Electrostatics = useElectrostatics;    
783 <    fInfo_.SIM_uses_Charges = useCharge;
784 <    fInfo_.SIM_uses_Dipoles = useDipole;
785 <    fInfo_.SIM_uses_Sticky = useSticky;
786 <    fInfo_.SIM_uses_StickyPower = useStickyPower;
787 <    fInfo_.SIM_uses_GayBerne = useGayBerne;
788 <    fInfo_.SIM_uses_EAM = useEAM;
789 <    fInfo_.SIM_uses_SC = useSC;
790 <    fInfo_.SIM_uses_Shapes = useShape;
791 <    fInfo_.SIM_uses_FLARB = useFLARB;
792 <    fInfo_.SIM_uses_RF = useRF;
793 <    fInfo_.SIM_uses_SF = useSF;
794 <    fInfo_.SIM_uses_SP = useSP;
795 <    fInfo_.SIM_uses_BoxDipole = useBoxDipole;
796 <    fInfo_.SIM_uses_AtomicVirial = useAtomicVirial_;
806 >    vector<int> GlobalGroupIndices;
807 >    
808 >    for (mol = beginMolecule(mi); mol != NULL; mol  = nextMolecule(mi)) {
809 >      
810 >      //local index of cutoff group is trivial, it only depends on the
811 >      //order of travesing
812 >      for (cg = mol->beginCutoffGroup(ci); cg != NULL;
813 >           cg = mol->nextCutoffGroup(ci)) {
814 >        GlobalGroupIndices.push_back(cg->getGlobalIndex());
815 >      }        
816 >    }
817 >    return GlobalGroupIndices;
818    }
819  
820 <  void SimInfo::setupFortranSim() {
820 >
821 >  void SimInfo::setupFortran() {
822      int isError;
823 <    int nExclude;
824 <    std::vector<int> fortranGlobalGroupMembership;
823 >    int nExclude, nOneTwo, nOneThree, nOneFour;
824 >    vector<int> fortranGlobalGroupMembership;
825      
804    nExclude = exclude_.getSize();
826      isError = 0;
827  
828      //globalGroupMembership_ is filled by SimCreator    
# Line 810 | Line 831 | namespace oopse {
831      }
832  
833      //calculate mass ratio of cutoff group
834 <    std::vector<RealType> mfact;
834 >    vector<RealType> mfact;
835      SimInfo::MoleculeIterator mi;
836      Molecule* mol;
837      Molecule::CutoffGroupIterator ci;
# Line 833 | Line 854 | namespace oopse {
854            else
855              mfact.push_back( 1.0 );
856          }
836
857        }      
858      }
859  
860 <    //fill ident array of local atoms (it is actually ident of AtomType, it is so confusing !!!)
841 <    std::vector<int> identArray;
860 >    // Build the identArray_
861  
862 <    //to avoid memory reallocation, reserve enough space identArray
863 <    identArray.reserve(getNAtoms());
845 <    
862 >    identArray_.clear();
863 >    identArray_.reserve(getNAtoms());    
864      for(mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) {        
865        for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
866 <        identArray.push_back(atom->getIdent());
866 >        identArray_.push_back(atom->getIdent());
867        }
868      }    
869  
870      //fill molMembershipArray
871      //molMembershipArray is filled by SimCreator    
872 <    std::vector<int> molMembershipArray(nGlobalAtoms_);
872 >    vector<int> molMembershipArray(nGlobalAtoms_);
873      for (int i = 0; i < nGlobalAtoms_; i++) {
874        molMembershipArray[i] = globalMolMembership_[i] + 1;
875      }
876      
877      //setup fortran simulation
860    int nGlobalExcludes = 0;
861    int* globalExcludes = NULL;
862    int* excludeList = exclude_.getExcludeList();
863    setFortranSim( &fInfo_, &nGlobalAtoms_, &nAtoms_, &identArray[0], &nExclude, excludeList ,
864                   &nGlobalExcludes, globalExcludes, &molMembershipArray[0],
865                   &mfact[0], &nCutoffGroups_, &fortranGlobalGroupMembership[0], &isError);
878  
879 <    if( isError ){
879 >    nExclude = excludedInteractions_.getSize();
880 >    nOneTwo = oneTwoInteractions_.getSize();
881 >    nOneThree = oneThreeInteractions_.getSize();
882 >    nOneFour = oneFourInteractions_.getSize();
883  
884 <      sprintf( painCave.errMsg,
885 <               "There was an error setting the simulation information in fortran.\n" );
886 <      painCave.isFatal = 1;
887 <      painCave.severity = OOPSE_ERROR;
873 <      simError();
874 <    }
884 >    int* excludeList = excludedInteractions_.getPairList();
885 >    int* oneTwoList = oneTwoInteractions_.getPairList();
886 >    int* oneThreeList = oneThreeInteractions_.getPairList();
887 >    int* oneFourList = oneFourInteractions_.getPairList();
888  
889 < #ifdef IS_MPI
890 <    sprintf( checkPointMsg,
891 <             "succesfully sent the simulation information to fortran.\n");
892 <    MPIcheckPoint();
893 < #endif // is_mpi
894 <
889 >    //setFortranSim( &fInfo_, &nGlobalAtoms_, &nAtoms_, &identArray_[0],
890 >    //               &nExclude, excludeList,
891 >    //               &nOneTwo, oneTwoList,
892 >    //               &nOneThree, oneThreeList,
893 >    //               &nOneFour, oneFourList,
894 >    //               &molMembershipArray[0], &mfact[0], &nCutoffGroups_,
895 >    //               &fortranGlobalGroupMembership[0], &isError);
896 >    
897 >    // if( isError ){
898 >    //  
899 >    //  sprintf( painCave.errMsg,
900 >    //         "There was an error setting the simulation information in fortran.\n" );
901 >    //  painCave.isFatal = 1;
902 >    //  painCave.severity = OPENMD_ERROR;
903 >    //  simError();
904 >    //}
905 >    
906 >    
907 >    // sprintf( checkPointMsg,
908 >    //          "succesfully sent the simulation information to fortran.\n");
909 >    
910 >    // errorCheckPoint();
911 >    
912      // Setup number of neighbors in neighbor list if present
913 <    if (simParams_->haveNeighborListNeighbors()) {
914 <      int nlistNeighbors = simParams_->getNeighborListNeighbors();
915 <      setNeighbors(&nlistNeighbors);
916 <    }
913 >    //if (simParams_->haveNeighborListNeighbors()) {
914 >    //  int nlistNeighbors = simParams_->getNeighborListNeighbors();
915 >    //  setNeighbors(&nlistNeighbors);
916 >    //}
917    
918 + #ifdef IS_MPI    
919 +    // mpiSimData parallelData;
920  
889  }
890
891
892 #ifdef IS_MPI
893  void SimInfo::setupFortranParallel() {
894    
895    //SimInfo is responsible for creating localToGlobalAtomIndex and localToGlobalGroupIndex
896    std::vector<int> localToGlobalAtomIndex(getNAtoms(), 0);
897    std::vector<int> localToGlobalCutoffGroupIndex;
898    SimInfo::MoleculeIterator mi;
899    Molecule::AtomIterator ai;
900    Molecule::CutoffGroupIterator ci;
901    Molecule* mol;
902    Atom* atom;
903    CutoffGroup* cg;
904    mpiSimData parallelData;
905    int isError;
906
907    for (mol = beginMolecule(mi); mol != NULL; mol  = nextMolecule(mi)) {
908
909      //local index(index in DataStorge) of atom is important
910      for (atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
911        localToGlobalAtomIndex[atom->getLocalIndex()] = atom->getGlobalIndex() + 1;
912      }
913
914      //local index of cutoff group is trivial, it only depends on the order of travesing
915      for (cg = mol->beginCutoffGroup(ci); cg != NULL; cg = mol->nextCutoffGroup(ci)) {
916        localToGlobalCutoffGroupIndex.push_back(cg->getGlobalIndex() + 1);
917      }        
918        
919    }
920
921      //fill up mpiSimData struct
922 <    parallelData.nMolGlobal = getNGlobalMolecules();
923 <    parallelData.nMolLocal = getNMolecules();
924 <    parallelData.nAtomsGlobal = getNGlobalAtoms();
925 <    parallelData.nAtomsLocal = getNAtoms();
926 <    parallelData.nGroupsGlobal = getNGlobalCutoffGroups();
927 <    parallelData.nGroupsLocal = getNCutoffGroups();
928 <    parallelData.myNode = worldRank;
929 <    MPI_Comm_size(MPI_COMM_WORLD, &(parallelData.nProcessors));
922 >    // parallelData.nMolGlobal = getNGlobalMolecules();
923 >    // parallelData.nMolLocal = getNMolecules();
924 >    // parallelData.nAtomsGlobal = getNGlobalAtoms();
925 >    // parallelData.nAtomsLocal = getNAtoms();
926 >    // parallelData.nGroupsGlobal = getNGlobalCutoffGroups();
927 >    // parallelData.nGroupsLocal = getNCutoffGroups();
928 >    // parallelData.myNode = worldRank;
929 >    // MPI_Comm_size(MPI_COMM_WORLD, &(parallelData.nProcessors));
930  
931      //pass mpiSimData struct and index arrays to fortran
932 <    setFsimParallel(&parallelData, &(parallelData.nAtomsLocal),
933 <                    &localToGlobalAtomIndex[0],  &(parallelData.nGroupsLocal),
934 <                    &localToGlobalCutoffGroupIndex[0], &isError);
932 >    //setFsimParallel(&parallelData, &(parallelData.nAtomsLocal),
933 >    //                &localToGlobalAtomIndex[0],  &(parallelData.nGroupsLocal),
934 >    //                &localToGlobalCutoffGroupIndex[0], &isError);
935  
936 <    if (isError) {
937 <      sprintf(painCave.errMsg,
938 <              "mpiRefresh errror: fortran didn't like something we gave it.\n");
939 <      painCave.isFatal = 1;
940 <      simError();
941 <    }
936 >    // if (isError) {
937 >    //   sprintf(painCave.errMsg,
938 >    //           "mpiRefresh errror: fortran didn't like something we gave it.\n");
939 >    //   painCave.isFatal = 1;
940 >    //   simError();
941 >    // }
942  
943 <    sprintf(checkPointMsg, " mpiRefresh successful.\n");
944 <    MPIcheckPoint();
945 <
946 <
947 <  }
948 <
943 >    // sprintf(checkPointMsg, " mpiRefresh successful.\n");
944 >    // errorCheckPoint();
945   #endif
946  
947 <  void SimInfo::setupCutoff() {          
948 <    
949 <    ForceFieldOptions& forceFieldOptions_ = forceField_->getForceFieldOptions();
950 <
951 <    // Check the cutoff policy
952 <    int cp =  TRADITIONAL_CUTOFF_POLICY; // Set to traditional by default
953 <
954 <    std::string myPolicy;
959 <    if (forceFieldOptions_.haveCutoffPolicy()){
960 <      myPolicy = forceFieldOptions_.getCutoffPolicy();
961 <    }else if (simParams_->haveCutoffPolicy()) {
962 <      myPolicy = simParams_->getCutoffPolicy();
963 <    }
964 <
965 <    if (!myPolicy.empty()){
966 <      toUpper(myPolicy);
967 <      if (myPolicy == "MIX") {
968 <        cp = MIX_CUTOFF_POLICY;
969 <      } else {
970 <        if (myPolicy == "MAX") {
971 <          cp = MAX_CUTOFF_POLICY;
972 <        } else {
973 <          if (myPolicy == "TRADITIONAL") {            
974 <            cp = TRADITIONAL_CUTOFF_POLICY;
975 <          } else {
976 <            // throw error        
977 <            sprintf( painCave.errMsg,
978 <                     "SimInfo error: Unknown cutoffPolicy. (Input file specified %s .)\n\tcutoffPolicy must be one of: \"Mix\", \"Max\", or \"Traditional\".", myPolicy.c_str() );
979 <            painCave.isFatal = 1;
980 <            simError();
981 <          }    
982 <        }          
983 <      }
984 <    }          
985 <    notifyFortranCutoffPolicy(&cp);
986 <
987 <    // Check the Skin Thickness for neighborlists
988 <    RealType skin;
989 <    if (simParams_->haveSkinThickness()) {
990 <      skin = simParams_->getSkinThickness();
991 <      notifyFortranSkinThickness(&skin);
992 <    }            
993 <        
994 <    // Check if the cutoff was set explicitly:
995 <    if (simParams_->haveCutoffRadius()) {
996 <      rcut_ = simParams_->getCutoffRadius();
997 <      if (simParams_->haveSwitchingRadius()) {
998 <        rsw_  = simParams_->getSwitchingRadius();
999 <      } else {
1000 <        if (fInfo_.SIM_uses_Charges |
1001 <            fInfo_.SIM_uses_Dipoles |
1002 <            fInfo_.SIM_uses_RF) {
1003 <          
1004 <          rsw_ = 0.85 * rcut_;
1005 <          sprintf(painCave.errMsg,
1006 <                  "SimCreator Warning: No value was set for the switchingRadius.\n"
1007 <                  "\tOOPSE will use a default value of 85 percent of the cutoffRadius.\n"
1008 <                  "\tswitchingRadius = %f. for this simulation\n", rsw_);
1009 <        painCave.isFatal = 0;
1010 <        simError();
1011 <        } else {
1012 <          rsw_ = rcut_;
1013 <          sprintf(painCave.errMsg,
1014 <                  "SimCreator Warning: No value was set for the switchingRadius.\n"
1015 <                  "\tOOPSE will use the same value as the cutoffRadius.\n"
1016 <                  "\tswitchingRadius = %f. for this simulation\n", rsw_);
1017 <          painCave.isFatal = 0;
1018 <          simError();
1019 <        }
1020 <      }
1021 <      
1022 <      notifyFortranCutoffs(&rcut_, &rsw_);
1023 <      
1024 <    } else {
1025 <      
1026 <      // For electrostatic atoms, we'll assume a large safe value:
1027 <      if (fInfo_.SIM_uses_Charges | fInfo_.SIM_uses_Dipoles | fInfo_.SIM_uses_RF) {
1028 <        sprintf(painCave.errMsg,
1029 <                "SimCreator Warning: No value was set for the cutoffRadius.\n"
1030 <                "\tOOPSE will use a default value of 15.0 angstroms"
1031 <                "\tfor the cutoffRadius.\n");
1032 <        painCave.isFatal = 0;
1033 <        simError();
1034 <        rcut_ = 15.0;
1035 <      
1036 <        if (simParams_->haveElectrostaticSummationMethod()) {
1037 <          std::string myMethod = simParams_->getElectrostaticSummationMethod();
1038 <          toUpper(myMethod);
1039 <          if (myMethod == "SHIFTED_POTENTIAL" || myMethod == "SHIFTED_FORCE") {
1040 <            if (simParams_->haveSwitchingRadius()){
1041 <              sprintf(painCave.errMsg,
1042 <                      "SimInfo Warning: A value was set for the switchingRadius\n"
1043 <                      "\teven though the electrostaticSummationMethod was\n"
1044 <                      "\tset to %s\n", myMethod.c_str());
1045 <              painCave.isFatal = 1;
1046 <              simError();            
1047 <            }
1048 <          }
1049 <        }
1050 <      
1051 <        if (simParams_->haveSwitchingRadius()){
1052 <          rsw_ = simParams_->getSwitchingRadius();
1053 <        } else {        
1054 <          sprintf(painCave.errMsg,
1055 <                  "SimCreator Warning: No value was set for switchingRadius.\n"
1056 <                  "\tOOPSE will use a default value of\n"
1057 <                  "\t0.85 * cutoffRadius for the switchingRadius\n");
1058 <          painCave.isFatal = 0;
1059 <          simError();
1060 <          rsw_ = 0.85 * rcut_;
1061 <        }
1062 <        notifyFortranCutoffs(&rcut_, &rsw_);
1063 <      } else {
1064 <        // We didn't set rcut explicitly, and we don't have electrostatic atoms, so
1065 <        // We'll punt and let fortran figure out the cutoffs later.
1066 <        
1067 <        notifyFortranYouAreOnYourOwn();
1068 <
1069 <      }
1070 <    }
1071 <  }
1072 <
1073 <  void SimInfo::setupElectrostaticSummationMethod( int isError ) {    
1074 <    
1075 <    int errorOut;
1076 <    int esm =  NONE;
1077 <    int sm = UNDAMPED;
1078 <    RealType alphaVal;
1079 <    RealType dielectric;
1080 <    
1081 <    errorOut = isError;
1082 <
1083 <    if (simParams_->haveElectrostaticSummationMethod()) {
1084 <      std::string myMethod = simParams_->getElectrostaticSummationMethod();
1085 <      toUpper(myMethod);
1086 <      if (myMethod == "NONE") {
1087 <        esm = NONE;
1088 <      } else {
1089 <        if (myMethod == "SWITCHING_FUNCTION") {
1090 <          esm = SWITCHING_FUNCTION;
1091 <        } else {
1092 <          if (myMethod == "SHIFTED_POTENTIAL") {
1093 <            esm = SHIFTED_POTENTIAL;
1094 <          } else {
1095 <            if (myMethod == "SHIFTED_FORCE") {            
1096 <              esm = SHIFTED_FORCE;
1097 <            } else {
1098 <              if (myMethod == "REACTION_FIELD") {
1099 <                esm = REACTION_FIELD;
1100 <                dielectric = simParams_->getDielectric();
1101 <                if (!simParams_->haveDielectric()) {
1102 <                  // throw warning
1103 <                  sprintf( painCave.errMsg,
1104 <                           "SimInfo warning: dielectric was not specified in the input file\n\tfor the reaction field correction method.\n"
1105 <                           "\tA default value of %f will be used for the dielectric.\n", dielectric);
1106 <                  painCave.isFatal = 0;
1107 <                  simError();
1108 <                }
1109 <              } else {
1110 <                // throw error        
1111 <                sprintf( painCave.errMsg,
1112 <                         "SimInfo error: Unknown electrostaticSummationMethod.\n"
1113 <                         "\t(Input file specified %s .)\n"
1114 <                         "\telectrostaticSummationMethod must be one of: \"none\",\n"
1115 <                         "\t\"shifted_potential\", \"shifted_force\", or \n"
1116 <                         "\t\"reaction_field\".\n", myMethod.c_str() );
1117 <                painCave.isFatal = 1;
1118 <                simError();
1119 <              }    
1120 <            }          
1121 <          }
1122 <        }
1123 <      }
1124 <    }
1125 <    
1126 <    if (simParams_->haveElectrostaticScreeningMethod()) {
1127 <      std::string myScreen = simParams_->getElectrostaticScreeningMethod();
1128 <      toUpper(myScreen);
1129 <      if (myScreen == "UNDAMPED") {
1130 <        sm = UNDAMPED;
1131 <      } else {
1132 <        if (myScreen == "DAMPED") {
1133 <          sm = DAMPED;
1134 <          if (!simParams_->haveDampingAlpha()) {
1135 <            // first set a cutoff dependent alpha value
1136 <            // we assume alpha depends linearly with rcut from 0 to 20.5 ang
1137 <            alphaVal = 0.5125 - rcut_* 0.025;
1138 <            // for values rcut > 20.5, alpha is zero
1139 <            if (alphaVal < 0) alphaVal = 0;
1140 <
1141 <            // throw warning
1142 <            sprintf( painCave.errMsg,
1143 <                     "SimInfo warning: dampingAlpha was not specified in the input file.\n"
1144 <                     "\tA default value of %f (1/ang) will be used for the cutoff of\n\t%f (ang).\n", alphaVal, rcut_);
1145 <            painCave.isFatal = 0;
1146 <            simError();
1147 <          } else {
1148 <            alphaVal = simParams_->getDampingAlpha();
1149 <          }
1150 <          
1151 <        } else {
1152 <          // throw error        
1153 <          sprintf( painCave.errMsg,
1154 <                   "SimInfo error: Unknown electrostaticScreeningMethod.\n"
1155 <                   "\t(Input file specified %s .)\n"
1156 <                   "\telectrostaticScreeningMethod must be one of: \"undamped\"\n"
1157 <                   "or \"damped\".\n", myScreen.c_str() );
1158 <          painCave.isFatal = 1;
1159 <          simError();
1160 <        }
1161 <      }
1162 <    }
1163 <    
1164 <    // let's pass some summation method variables to fortran
1165 <    setElectrostaticSummationMethod( &esm );
1166 <    setFortranElectrostaticMethod( &esm );
1167 <    setScreeningMethod( &sm );
1168 <    setDampingAlpha( &alphaVal );
1169 <    setReactionFieldDielectric( &dielectric );
1170 <    initFortranFF( &errorOut );
1171 <  }
1172 <
1173 <  void SimInfo::setupSwitchingFunction() {    
1174 <    int ft = CUBIC;
1175 <
1176 <    if (simParams_->haveSwitchingFunctionType()) {
1177 <      std::string funcType = simParams_->getSwitchingFunctionType();
1178 <      toUpper(funcType);
1179 <      if (funcType == "CUBIC") {
1180 <        ft = CUBIC;
1181 <      } else {
1182 <        if (funcType == "FIFTH_ORDER_POLYNOMIAL") {
1183 <          ft = FIFTH_ORDER_POLY;
1184 <        } else {
1185 <          // throw error        
1186 <          sprintf( painCave.errMsg,
1187 <                   "SimInfo error: Unknown switchingFunctionType. (Input file specified %s .)\n\tswitchingFunctionType must be one of: \"cubic\" or \"fifth_order_polynomial\".", funcType.c_str() );
1188 <          painCave.isFatal = 1;
1189 <          simError();
1190 <        }          
1191 <      }
1192 <    }
1193 <
1194 <    // send switching function notification to switcheroo
1195 <    setFunctionType(&ft);
1196 <
1197 <  }
1198 <
1199 <  void SimInfo::setupAccumulateBoxDipole() {    
1200 <
1201 <    // we only call setAccumulateBoxDipole if the accumulateBoxDipole parameter is true
1202 <    if ( simParams_->haveAccumulateBoxDipole() )
1203 <      if ( simParams_->getAccumulateBoxDipole() ) {
1204 <        setAccumulateBoxDipole();
1205 <        calcBoxDipole_ = true;
1206 <      }
1207 <
947 >    // initFortranFF(&isError);
948 >    // if (isError) {
949 >    //   sprintf(painCave.errMsg,
950 >    //           "initFortranFF errror: fortran didn't like something we gave it.\n");
951 >    //   painCave.isFatal = 1;
952 >    //   simError();
953 >    // }
954 >    // fortranInitialized_ = true;
955    }
956  
957    void SimInfo::addProperty(GenericData* genData) {
958      properties_.addProperty(genData);  
959    }
960  
961 <  void SimInfo::removeProperty(const std::string& propName) {
961 >  void SimInfo::removeProperty(const string& propName) {
962      properties_.removeProperty(propName);  
963    }
964  
# Line 1219 | Line 966 | namespace oopse {
966      properties_.clearProperties();
967    }
968  
969 <  std::vector<std::string> SimInfo::getPropertyNames() {
969 >  vector<string> SimInfo::getPropertyNames() {
970      return properties_.getPropertyNames();  
971    }
972        
973 <  std::vector<GenericData*> SimInfo::getProperties() {
973 >  vector<GenericData*> SimInfo::getProperties() {
974      return properties_.getProperties();
975    }
976  
977 <  GenericData* SimInfo::getPropertyByName(const std::string& propName) {
977 >  GenericData* SimInfo::getPropertyByName(const string& propName) {
978      return properties_.getPropertyByName(propName);
979    }
980  
# Line 1241 | Line 988 | namespace oopse {
988      Molecule* mol;
989      RigidBody* rb;
990      Atom* atom;
991 +    CutoffGroup* cg;
992      SimInfo::MoleculeIterator mi;
993      Molecule::RigidBodyIterator rbIter;
994 <    Molecule::AtomIterator atomIter;;
994 >    Molecule::AtomIterator atomIter;
995 >    Molecule::CutoffGroupIterator cgIter;
996  
997      for (mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) {
998          
# Line 1254 | Line 1003 | namespace oopse {
1003        for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) {
1004          rb->setSnapshotManager(sman_);
1005        }
1006 +
1007 +      for (cg = mol->beginCutoffGroup(cgIter); cg != NULL; cg = mol->nextCutoffGroup(cgIter)) {
1008 +        cg->setSnapshotManager(sman_);
1009 +      }
1010      }    
1011      
1012    }
# Line 1310 | Line 1063 | namespace oopse {
1063  
1064    }        
1065  
1066 <  std::ostream& operator <<(std::ostream& o, SimInfo& info) {
1066 >  ostream& operator <<(ostream& o, SimInfo& info) {
1067  
1068      return o;
1069    }
# Line 1353 | Line 1106 | namespace oopse {
1106  
1107  
1108         [  Ixx -Ixy  -Ixz ]
1109 <  J =| -Iyx  Iyy  -Iyz |
1109 >    J =| -Iyx  Iyy  -Iyz |
1110         [ -Izx -Iyz   Izz ]
1111      */
1112  
# Line 1460 | Line 1213 | namespace oopse {
1213      return IOIndexToIntegrableObject.at(index);
1214    }
1215    
1216 <  void SimInfo::setIOIndexToIntegrableObject(const std::vector<StuntDouble*>& v) {
1216 >  void SimInfo::setIOIndexToIntegrableObject(const vector<StuntDouble*>& v) {
1217      IOIndexToIntegrableObject= v;
1218    }
1219  
# Line 1502 | Line 1255 | namespace oopse {
1255      return;
1256    }
1257   /*
1258 <   void SimInfo::setStuntDoubleFromGlobalIndex(std::vector<StuntDouble*> v) {
1258 >   void SimInfo::setStuntDoubleFromGlobalIndex(vector<StuntDouble*> v) {
1259        assert( v.size() == nAtoms_ + nRigidBodies_);
1260        sdByGlobalIndex_ = v;
1261      }
# Line 1512 | Line 1265 | namespace oopse {
1265        return sdByGlobalIndex_.at(index);
1266      }  
1267   */  
1268 < }//end namespace oopse
1268 >  int SimInfo::getNGlobalConstraints() {
1269 >    int nGlobalConstraints;
1270 > #ifdef IS_MPI
1271 >    MPI_Allreduce(&nConstraints_, &nGlobalConstraints, 1, MPI_INT, MPI_SUM,
1272 >                  MPI_COMM_WORLD);    
1273 > #else
1274 >    nGlobalConstraints =  nConstraints_;
1275 > #endif
1276 >    return nGlobalConstraints;
1277 >  }
1278  
1279 + }//end namespace OpenMD
1280 +

Comparing:
trunk/src/brains/SimInfo.cpp (property svn:keywords), Revision 1126 by gezelter, Fri Apr 6 21:53:43 2007 UTC vs.
branches/development/src/brains/SimInfo.cpp (property svn:keywords), Revision 1550 by gezelter, Wed Apr 27 21:49:59 2011 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines