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 1290 by cli2, Wed Sep 10 19:51:45 2008 UTC vs.
branches/development/src/brains/SimInfo.cpp (file contents), Revision 1529 by gezelter, Mon Dec 27 18:35:59 2010 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 55 | Line 55
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"
58   #include "UseTheForce/DarkSide/fSwitchingFunctionType.h"
59   #include "UseTheForce/doForces_interface.h"
60   #include "UseTheForce/DarkSide/neighborLists_interface.h"
63 #include "UseTheForce/DarkSide/electrostatic_interface.h"
61   #include "UseTheForce/DarkSide/switcheroo_interface.h"
62   #include "utils/MemoryUtils.hpp"
63   #include "utils/simError.h"
64   #include "selection/SelectionManager.hpp"
65   #include "io/ForceFieldOptions.hpp"
66   #include "UseTheForce/ForceField.hpp"
67 + #include "nonbonded/InteractionManager.hpp"
68  
69  
70   #ifdef IS_MPI
# Line 74 | Line 72
72   #include "UseTheForce/DarkSide/simParallel_interface.h"
73   #endif
74  
75 < namespace oopse {
76 <  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 <  }
75 > using namespace std;
76 > namespace OpenMD {
77    
78    SimInfo::SimInfo(ForceField* ff, Globals* simParams) :
79      forceField_(ff), simParams_(simParams),
# Line 93 | Line 83 | namespace oopse {
83      nAtoms_(0), nBonds_(0),  nBends_(0), nTorsions_(0), nInversions_(0),
84      nRigidBodies_(0), nIntegrableObjects_(0), nCutoffGroups_(0),
85      nConstraints_(0), sman_(NULL), fortranInitialized_(false),
86 <    calcBoxDipole_(false), useAtomicVirial_(true) {
87 <
88 <
89 <      MoleculeStamp* molStamp;
90 <      int nMolWithSameStamp;
91 <      int nCutoffAtoms = 0; // number of atoms belong to cutoff groups
92 <      int nGroups = 0;      //total cutoff groups defined in meta-data file
93 <      CutoffGroupStamp* cgStamp;    
94 <      RigidBodyStamp* rbStamp;
95 <      int nRigidAtoms = 0;
96 <
97 <      std::vector<Component*> components = simParams->getComponents();
86 >    calcBoxDipole_(false), useAtomicVirial_(true) {    
87 >    
88 >    MoleculeStamp* molStamp;
89 >    int nMolWithSameStamp;
90 >    int nCutoffAtoms = 0; // number of atoms belong to cutoff groups
91 >    int nGroups = 0;       //total cutoff groups defined in meta-data file
92 >    CutoffGroupStamp* cgStamp;    
93 >    RigidBodyStamp* rbStamp;
94 >    int nRigidAtoms = 0;
95 >    
96 >    vector<Component*> components = simParams->getComponents();
97 >    
98 >    for (vector<Component*>::iterator i = components.begin(); i !=components.end(); ++i) {
99 >      molStamp = (*i)->getMoleculeStamp();
100 >      nMolWithSameStamp = (*i)->getNMol();
101        
102 <      for (std::vector<Component*>::iterator i = components.begin(); i !=components.end(); ++i) {
103 <        molStamp = (*i)->getMoleculeStamp();
104 <        nMolWithSameStamp = (*i)->getNMol();
105 <        
106 <        addMoleculeStamp(molStamp, nMolWithSameStamp);
107 <
108 <        //calculate atoms in molecules
109 <        nGlobalAtoms_ += molStamp->getNAtoms() *nMolWithSameStamp;  
110 <
111 <        //calculate atoms in cutoff groups
112 <        int nAtomsInGroups = 0;
113 <        int nCutoffGroupsInStamp = molStamp->getNCutoffGroups();
121 <        
122 <        for (int j=0; j < nCutoffGroupsInStamp; j++) {
123 <          cgStamp = molStamp->getCutoffGroupStamp(j);
124 <          nAtomsInGroups += cgStamp->getNMembers();
125 <        }
126 <
127 <        nGroups += nCutoffGroupsInStamp * nMolWithSameStamp;
128 <
129 <        nCutoffAtoms += nAtomsInGroups * nMolWithSameStamp;            
130 <
131 <        //calculate atoms in rigid bodies
132 <        int nAtomsInRigidBodies = 0;
133 <        int nRigidBodiesInStamp = molStamp->getNRigidBodies();
134 <        
135 <        for (int j=0; j < nRigidBodiesInStamp; j++) {
136 <          rbStamp = molStamp->getRigidBodyStamp(j);
137 <          nAtomsInRigidBodies += rbStamp->getNMembers();
138 <        }
139 <
140 <        nGlobalRigidBodies_ += nRigidBodiesInStamp * nMolWithSameStamp;
141 <        nRigidAtoms += nAtomsInRigidBodies * nMolWithSameStamp;            
142 <        
102 >      addMoleculeStamp(molStamp, nMolWithSameStamp);
103 >      
104 >      //calculate atoms in molecules
105 >      nGlobalAtoms_ += molStamp->getNAtoms() *nMolWithSameStamp;  
106 >      
107 >      //calculate atoms in cutoff groups
108 >      int nAtomsInGroups = 0;
109 >      int nCutoffGroupsInStamp = molStamp->getNCutoffGroups();
110 >      
111 >      for (int j=0; j < nCutoffGroupsInStamp; j++) {
112 >        cgStamp = molStamp->getCutoffGroupStamp(j);
113 >        nAtomsInGroups += cgStamp->getNMembers();
114        }
115 <
116 <      //every free atom (atom does not belong to cutoff groups) is a cutoff
117 <      //group therefore the total number of cutoff groups in the system is
118 <      //equal to the total number of atoms minus number of atoms belong to
119 <      //cutoff group defined in meta-data file plus the number of cutoff
120 <      //groups defined in meta-data file
121 <      nGlobalCutoffGroups_ = nGlobalAtoms_ - nCutoffAtoms + nGroups;
122 <
123 <      //every free atom (atom does not belong to rigid bodies) is an
124 <      //integrable object therefore the total number of integrable objects
125 <      //in the system is equal to the total number of atoms minus number of
126 <      //atoms belong to rigid body defined in meta-data file plus the number
127 <      //of rigid bodies defined in meta-data file
128 <      nGlobalIntegrableObjects_ = nGlobalAtoms_ - nRigidAtoms
129 <                                                + nGlobalRigidBodies_;
130 <  
131 <      nGlobalMols_ = molStampIds_.size();
161 <      molToProcMap_.resize(nGlobalMols_);
115 >      
116 >      nGroups += nCutoffGroupsInStamp * nMolWithSameStamp;
117 >      
118 >      nCutoffAtoms += nAtomsInGroups * nMolWithSameStamp;            
119 >      
120 >      //calculate atoms in rigid bodies
121 >      int nAtomsInRigidBodies = 0;
122 >      int nRigidBodiesInStamp = molStamp->getNRigidBodies();
123 >      
124 >      for (int j=0; j < nRigidBodiesInStamp; j++) {
125 >        rbStamp = molStamp->getRigidBodyStamp(j);
126 >        nAtomsInRigidBodies += rbStamp->getNMembers();
127 >      }
128 >      
129 >      nGlobalRigidBodies_ += nRigidBodiesInStamp * nMolWithSameStamp;
130 >      nRigidAtoms += nAtomsInRigidBodies * nMolWithSameStamp;            
131 >      
132      }
133 <
133 >    
134 >    //every free atom (atom does not belong to cutoff groups) is a cutoff
135 >    //group therefore the total number of cutoff groups in the system is
136 >    //equal to the total number of atoms minus number of atoms belong to
137 >    //cutoff group defined in meta-data file plus the number of cutoff
138 >    //groups defined in meta-data file
139 >    nGlobalCutoffGroups_ = nGlobalAtoms_ - nCutoffAtoms + nGroups;
140 >    
141 >    //every free atom (atom does not belong to rigid bodies) is an
142 >    //integrable object therefore the total number of integrable objects
143 >    //in the system is equal to the total number of atoms minus number of
144 >    //atoms belong to rigid body defined in meta-data file plus the number
145 >    //of rigid bodies defined in meta-data file
146 >    nGlobalIntegrableObjects_ = nGlobalAtoms_ - nRigidAtoms
147 >      + nGlobalRigidBodies_;
148 >    
149 >    nGlobalMols_ = molStampIds_.size();
150 >    molToProcMap_.resize(nGlobalMols_);
151 >  }
152 >  
153    SimInfo::~SimInfo() {
154 <    std::map<int, Molecule*>::iterator i;
154 >    map<int, Molecule*>::iterator i;
155      for (i = molecules_.begin(); i != molecules_.end(); ++i) {
156        delete i->second;
157      }
# Line 173 | Line 162 | namespace oopse {
162      delete forceField_;
163    }
164  
176  int SimInfo::getNGlobalConstraints() {
177    int nGlobalConstraints;
178 #ifdef IS_MPI
179    MPI_Allreduce(&nConstraints_, &nGlobalConstraints, 1, MPI_INT, MPI_SUM,
180                  MPI_COMM_WORLD);    
181 #else
182    nGlobalConstraints =  nConstraints_;
183 #endif
184    return nGlobalConstraints;
185  }
165  
166    bool SimInfo::addMolecule(Molecule* mol) {
167      MoleculeIterator i;
168 <
168 >    
169      i = molecules_.find(mol->getGlobalIndex());
170      if (i == molecules_.end() ) {
171 <
172 <      molecules_.insert(std::make_pair(mol->getGlobalIndex(), mol));
173 <        
171 >      
172 >      molecules_.insert(make_pair(mol->getGlobalIndex(), mol));
173 >      
174        nAtoms_ += mol->getNAtoms();
175        nBonds_ += mol->getNBonds();
176        nBends_ += mol->getNBends();
# Line 201 | Line 180 | namespace oopse {
180        nIntegrableObjects_ += mol->getNIntegrableObjects();
181        nCutoffGroups_ += mol->getNCutoffGroups();
182        nConstraints_ += mol->getNConstraintPairs();
183 <
183 >      
184        addInteractionPairs(mol);
185 <  
185 >      
186        return true;
187      } else {
188        return false;
189      }
190    }
191 <
191 >  
192    bool SimInfo::removeMolecule(Molecule* mol) {
193      MoleculeIterator i;
194      i = molecules_.find(mol->getGlobalIndex());
# Line 237 | Line 216 | namespace oopse {
216      } else {
217        return false;
218      }
240
241
219    }    
220  
221          
# Line 256 | Line 233 | namespace oopse {
233    void SimInfo::calcNdf() {
234      int ndf_local;
235      MoleculeIterator i;
236 <    std::vector<StuntDouble*>::iterator j;
236 >    vector<StuntDouble*>::iterator j;
237      Molecule* mol;
238      StuntDouble* integrableObject;
239  
# Line 307 | Line 284 | namespace oopse {
284      int ndfRaw_local;
285  
286      MoleculeIterator i;
287 <    std::vector<StuntDouble*>::iterator j;
287 >    vector<StuntDouble*>::iterator j;
288      Molecule* mol;
289      StuntDouble* integrableObject;
290  
# Line 356 | Line 333 | namespace oopse {
333  
334    void SimInfo::addInteractionPairs(Molecule* mol) {
335      ForceFieldOptions& options_ = forceField_->getForceFieldOptions();
336 <    std::vector<Bond*>::iterator bondIter;
337 <    std::vector<Bend*>::iterator bendIter;
338 <    std::vector<Torsion*>::iterator torsionIter;
339 <    std::vector<Inversion*>::iterator inversionIter;
336 >    vector<Bond*>::iterator bondIter;
337 >    vector<Bend*>::iterator bendIter;
338 >    vector<Torsion*>::iterator torsionIter;
339 >    vector<Inversion*>::iterator inversionIter;
340      Bond* bond;
341      Bend* bend;
342      Torsion* torsion;
# Line 377 | Line 354 | namespace oopse {
354      // always be excluded.  These are done at the bottom of this
355      // function.
356  
357 <    std::map<int, std::set<int> > atomGroups;
357 >    map<int, set<int> > atomGroups;
358      Molecule::RigidBodyIterator rbIter;
359      RigidBody* rb;
360      Molecule::IntegrableObjectIterator ii;
# Line 389 | Line 366 | namespace oopse {
366        
367        if (integrableObject->isRigidBody()) {
368          rb = static_cast<RigidBody*>(integrableObject);
369 <        std::vector<Atom*> atoms = rb->getAtoms();
370 <        std::set<int> rigidAtoms;
369 >        vector<Atom*> atoms = rb->getAtoms();
370 >        set<int> rigidAtoms;
371          for (int i = 0; i < static_cast<int>(atoms.size()); ++i) {
372            rigidAtoms.insert(atoms[i]->getGlobalIndex());
373          }
374          for (int i = 0; i < static_cast<int>(atoms.size()); ++i) {
375 <          atomGroups.insert(std::map<int, std::set<int> >::value_type(atoms[i]->getGlobalIndex(), rigidAtoms));
375 >          atomGroups.insert(map<int, set<int> >::value_type(atoms[i]->getGlobalIndex(), rigidAtoms));
376          }      
377        } else {
378 <        std::set<int> oneAtomSet;
378 >        set<int> oneAtomSet;
379          oneAtomSet.insert(integrableObject->getGlobalIndex());
380 <        atomGroups.insert(std::map<int, std::set<int> >::value_type(integrableObject->getGlobalIndex(), oneAtomSet));        
380 >        atomGroups.insert(map<int, set<int> >::value_type(integrableObject->getGlobalIndex(), oneAtomSet));        
381        }
382      }  
383            
# Line 503 | Line 480 | namespace oopse {
480  
481      for (rb = mol->beginRigidBody(rbIter); rb != NULL;
482           rb = mol->nextRigidBody(rbIter)) {
483 <      std::vector<Atom*> atoms = rb->getAtoms();
483 >      vector<Atom*> atoms = rb->getAtoms();
484        for (int i = 0; i < static_cast<int>(atoms.size()) -1 ; ++i) {
485          for (int j = i + 1; j < static_cast<int>(atoms.size()); ++j) {
486            a = atoms[i]->getGlobalIndex();
# Line 517 | Line 494 | namespace oopse {
494  
495    void SimInfo::removeInteractionPairs(Molecule* mol) {
496      ForceFieldOptions& options_ = forceField_->getForceFieldOptions();
497 <    std::vector<Bond*>::iterator bondIter;
498 <    std::vector<Bend*>::iterator bendIter;
499 <    std::vector<Torsion*>::iterator torsionIter;
500 <    std::vector<Inversion*>::iterator inversionIter;
497 >    vector<Bond*>::iterator bondIter;
498 >    vector<Bend*>::iterator bendIter;
499 >    vector<Torsion*>::iterator torsionIter;
500 >    vector<Inversion*>::iterator inversionIter;
501      Bond* bond;
502      Bend* bend;
503      Torsion* torsion;
# Line 530 | Line 507 | namespace oopse {
507      int c;
508      int d;
509  
510 <    std::map<int, std::set<int> > atomGroups;
510 >    map<int, set<int> > atomGroups;
511      Molecule::RigidBodyIterator rbIter;
512      RigidBody* rb;
513      Molecule::IntegrableObjectIterator ii;
# Line 542 | Line 519 | namespace oopse {
519        
520        if (integrableObject->isRigidBody()) {
521          rb = static_cast<RigidBody*>(integrableObject);
522 <        std::vector<Atom*> atoms = rb->getAtoms();
523 <        std::set<int> rigidAtoms;
522 >        vector<Atom*> atoms = rb->getAtoms();
523 >        set<int> rigidAtoms;
524          for (int i = 0; i < static_cast<int>(atoms.size()); ++i) {
525            rigidAtoms.insert(atoms[i]->getGlobalIndex());
526          }
527          for (int i = 0; i < static_cast<int>(atoms.size()); ++i) {
528 <          atomGroups.insert(std::map<int, std::set<int> >::value_type(atoms[i]->getGlobalIndex(), rigidAtoms));
528 >          atomGroups.insert(map<int, set<int> >::value_type(atoms[i]->getGlobalIndex(), rigidAtoms));
529          }      
530        } else {
531 <        std::set<int> oneAtomSet;
531 >        set<int> oneAtomSet;
532          oneAtomSet.insert(integrableObject->getGlobalIndex());
533 <        atomGroups.insert(std::map<int, std::set<int> >::value_type(integrableObject->getGlobalIndex(), oneAtomSet));        
533 >        atomGroups.insert(map<int, set<int> >::value_type(integrableObject->getGlobalIndex(), oneAtomSet));        
534        }
535      }  
536  
# Line 656 | Line 633 | namespace oopse {
633  
634      for (rb = mol->beginRigidBody(rbIter); rb != NULL;
635           rb = mol->nextRigidBody(rbIter)) {
636 <      std::vector<Atom*> atoms = rb->getAtoms();
636 >      vector<Atom*> atoms = rb->getAtoms();
637        for (int i = 0; i < static_cast<int>(atoms.size()) -1 ; ++i) {
638          for (int j = i + 1; j < static_cast<int>(atoms.size()); ++j) {
639            a = atoms[i]->getGlobalIndex();
# Line 682 | Line 659 | namespace oopse {
659    void SimInfo::update() {
660  
661      setupSimType();
662 +    setupCutoffRadius();
663 +    setupSwitchingRadius();
664 +    setupCutoffMethod();
665 +    setupSkinThickness();
666 +    setupSwitchingFunction();
667 +    setupAccumulateBoxDipole();
668  
669   #ifdef IS_MPI
670      setupFortranParallel();
671   #endif
689
672      setupFortranSim();
673 +    fortranInitialized_ = true;
674  
692    //setup fortran force field
693    /** @deprecate */    
694    int isError = 0;
695    
696    setupCutoff();
697    
698    setupElectrostaticSummationMethod( isError );
699    setupSwitchingFunction();
700    setupAccumulateBoxDipole();
701
702    if(isError){
703      sprintf( painCave.errMsg,
704               "ForceField error: There was an error initializing the forceField in fortran.\n" );
705      painCave.isFatal = 1;
706      simError();
707    }
708
675      calcNdf();
676      calcNdfRaw();
677      calcNdfTrans();
712
713    fortranInitialized_ = true;
678    }
679 <
680 <  std::set<AtomType*> SimInfo::getUniqueAtomTypes() {
679 >  
680 >  set<AtomType*> SimInfo::getSimulatedAtomTypes() {
681      SimInfo::MoleculeIterator mi;
682      Molecule* mol;
683      Molecule::AtomIterator ai;
684      Atom* atom;
685 <    std::set<AtomType*> atomTypes;
686 <
687 <    for(mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) {
724 <
685 >    set<AtomType*> atomTypes;
686 >    
687 >    for(mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) {      
688        for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
689          atomTypes.insert(atom->getAtomType());
690 <      }
691 <        
729 <    }
730 <
690 >      }      
691 >    }    
692      return atomTypes;        
693    }
694  
695 <  void SimInfo::setupSimType() {
696 <    std::set<AtomType*>::iterator i;
697 <    std::set<AtomType*> atomTypes;
698 <    atomTypes = getUniqueAtomTypes();
699 <    
700 <    int useLennardJones = 0;
701 <    int useElectrostatic = 0;
702 <    int useEAM = 0;
703 <    int useSC = 0;
704 <    int useCharge = 0;
705 <    int useDirectional = 0;
706 <    int useDipole = 0;
707 <    int useGayBerne = 0;
708 <    int useSticky = 0;
709 <    int useStickyPower = 0;
710 <    int useShape = 0;
711 <    int useFLARB = 0; //it is not in AtomType yet
712 <    int useDirectionalAtom = 0;    
713 <    int useElectrostatics = 0;
714 <    //usePBC and useRF are from simParams
715 <    int usePBC = simParams_->getUsePeriodicBoundaryConditions();
716 <    int useRF;
717 <    int useSF;
718 <    int useSP;
719 <    int useBoxDipole;
720 <
721 <    std::string myMethod;
722 <
723 <    // set the useRF logical
724 <    useRF = 0;
725 <    useSF = 0;
726 <    useSP = 0;
695 >  /**
696 >   * setupCutoffRadius
697 >   *
698 >   *  If the cutoffRadius was explicitly set, use that value.
699 >   *  If the cutoffRadius was not explicitly set:
700 >   *      Are there electrostatic atoms?  Use 12.0 Angstroms.
701 >   *      No electrostatic atoms?  Poll the atom types present in the
702 >   *      simulation for suggested cutoff values (e.g. 2.5 * sigma).
703 >   *      Use the maximum suggested value that was found.
704 >   */
705 >  void SimInfo::setupCutoffRadius() {
706 >    
707 >    if (simParams_->haveCutoffRadius()) {
708 >      cutoffRadius_ = simParams_->getCutoffRadius();
709 >    } else {      
710 >      if (usesElectrostaticAtoms_) {
711 >        sprintf(painCave.errMsg,
712 >                "SimInfo Warning: No value was set for the cutoffRadius.\n"
713 >                "\tOpenMD will use a default value of 12.0 angstroms"
714 >                "\tfor the cutoffRadius.\n");
715 >        painCave.isFatal = 0;
716 >        simError();
717 >        cutoffRadius_ = 12.0;
718 >      } else {
719 >        RealType thisCut;
720 >        set<AtomType*>::iterator i;
721 >        set<AtomType*> atomTypes;
722 >        atomTypes = getSimulatedAtomTypes();        
723 >        for (i = atomTypes.begin(); i != atomTypes.end(); ++i) {
724 >          thisCut = InteractionManager::Instance()->getSuggestedCutoffRadius((*i));
725 >          cutoffRadius_ = max(thisCut, cutoffRadius_);
726 >        }
727 >        sprintf(painCave.errMsg,
728 >                "SimInfo Warning: No value was set for the cutoffRadius.\n"
729 >                "\tOpenMD will use %lf angstroms.\n",
730 >                cutoffRadius_);
731 >        painCave.isFatal = 0;
732 >        simError();
733 >      }            
734 >    }
735  
736 +    InteractionManager::Instance()->setCutoffRadius(cutoffRadius_);
737 +  }
738 +  
739 +  /**
740 +   * setupSwitchingRadius
741 +   *
742 +   *  If the switchingRadius was explicitly set, use that value (but check it)
743 +   *  If the switchingRadius was not explicitly set: use 0.85 * cutoffRadius_
744 +   */
745 +  void SimInfo::setupSwitchingRadius() {
746 +    
747 +    if (simParams_->haveSwitchingRadius()) {
748 +      switchingRadius_ = simParams_->getSwitchingRadius();
749 +      if (switchingRadius_ > cutoffRadius_) {        
750 +        sprintf(painCave.errMsg,
751 +                "SimInfo Error: switchingRadius (%f) is larger than cutoffRadius(%f)\n",
752 +                switchingRadius_, cutoffRadius_);
753 +        painCave.isFatal = 1;
754 +        simError();
755  
768    if (simParams_->haveElectrostaticSummationMethod()) {
769      std::string myMethod = simParams_->getElectrostaticSummationMethod();
770      toUpper(myMethod);
771      if (myMethod == "REACTION_FIELD"){
772        useRF = 1;
773      } else if (myMethod == "SHIFTED_FORCE"){
774        useSF = 1;
775      } else if (myMethod == "SHIFTED_POTENTIAL"){
776        useSP = 1;
756        }
757 <    }
758 <    
759 <    if (simParams_->haveAccumulateBoxDipole())
760 <      if (simParams_->getAccumulateBoxDipole())
761 <        useBoxDipole = 1;
757 >    } else {      
758 >      switchingRadius_ = 0.85 * cutoffRadius_;
759 >      sprintf(painCave.errMsg,
760 >              "SimInfo Warning: No value was set for the switchingRadius.\n"
761 >              "\tOpenMD will use a default value of 85 percent of the cutoffRadius.\n"
762 >              "\tswitchingRadius = %f. for this simulation\n", switchingRadius_);
763 >      painCave.isFatal = 0;
764 >      simError();
765 >    }            
766 >    InteractionManager::Instance()->setSwitchingRadius(switchingRadius_);
767 >  }
768 >
769 >  /**
770 >   * setupSkinThickness
771 >   *
772 >   *  If the skinThickness was explicitly set, use that value (but check it)
773 >   *  If the skinThickness was not explicitly set: use 1.0 angstroms
774 >   */
775 >  void SimInfo::setupSkinThickness() {    
776 >    if (simParams_->haveSkinThickness()) {
777 >      skinThickness_ = simParams_->getSkinThickness();
778 >    } else {      
779 >      skinThickness_ = 1.0;
780 >      sprintf(painCave.errMsg,
781 >              "SimInfo Warning: No value was set for the skinThickness.\n"
782 >              "\tOpenMD will use a default value of %f Angstroms\n"
783 >              "\tfor this simulation\n", skinThickness_);
784 >      painCave.isFatal = 0;
785 >      simError();
786 >    }            
787 >  }
788 >
789 >  void SimInfo::setupSimType() {
790 >    set<AtomType*>::iterator i;
791 >    set<AtomType*> atomTypes;
792 >    atomTypes = getSimulatedAtomTypes();
793  
794      useAtomicVirial_ = simParams_->getUseAtomicVirial();
795  
796 +    int usesElectrostatic = 0;
797 +    int usesMetallic = 0;
798 +    int usesDirectional = 0;
799      //loop over all of the atom types
800      for (i = atomTypes.begin(); i != atomTypes.end(); ++i) {
801 <      useLennardJones |= (*i)->isLennardJones();
802 <      useElectrostatic |= (*i)->isElectrostatic();
803 <      useEAM |= (*i)->isEAM();
791 <      useSC |= (*i)->isSC();
792 <      useCharge |= (*i)->isCharge();
793 <      useDirectional |= (*i)->isDirectional();
794 <      useDipole |= (*i)->isDipole();
795 <      useGayBerne |= (*i)->isGayBerne();
796 <      useSticky |= (*i)->isSticky();
797 <      useStickyPower |= (*i)->isStickyPower();
798 <      useShape |= (*i)->isShape();
801 >      usesElectrostatic |= (*i)->isElectrostatic();
802 >      usesMetallic |= (*i)->isMetal();
803 >      usesDirectional |= (*i)->isDirectional();
804      }
805  
801    if (useSticky || useStickyPower || useDipole || useGayBerne || useShape) {
802      useDirectionalAtom = 1;
803    }
804
805    if (useCharge || useDipole) {
806      useElectrostatics = 1;
807    }
808
806   #ifdef IS_MPI    
807      int temp;
808 +    temp = usesDirectional;
809 +    MPI_Allreduce(&temp, &usesDirectionalAtoms_, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
810  
811 <    temp = usePBC;
812 <    MPI_Allreduce(&temp, &usePBC, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
811 >    temp = usesMetallic;
812 >    MPI_Allreduce(&temp, &usesMetallicAtoms_, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
813  
814 <    temp = useDirectionalAtom;
815 <    MPI_Allreduce(&temp, &useDirectionalAtom, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
817 <
818 <    temp = useLennardJones;
819 <    MPI_Allreduce(&temp, &useLennardJones, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
820 <
821 <    temp = useElectrostatics;
822 <    MPI_Allreduce(&temp, &useElectrostatics, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
823 <
824 <    temp = useCharge;
825 <    MPI_Allreduce(&temp, &useCharge, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
826 <
827 <    temp = useDipole;
828 <    MPI_Allreduce(&temp, &useDipole, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
829 <
830 <    temp = useSticky;
831 <    MPI_Allreduce(&temp, &useSticky, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
832 <
833 <    temp = useStickyPower;
834 <    MPI_Allreduce(&temp, &useStickyPower, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
835 <    
836 <    temp = useGayBerne;
837 <    MPI_Allreduce(&temp, &useGayBerne, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
838 <
839 <    temp = useEAM;
840 <    MPI_Allreduce(&temp, &useEAM, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
841 <
842 <    temp = useSC;
843 <    MPI_Allreduce(&temp, &useSC, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);
844 <    
845 <    temp = useShape;
846 <    MPI_Allreduce(&temp, &useShape, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);  
847 <
848 <    temp = useFLARB;
849 <    MPI_Allreduce(&temp, &useFLARB, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
850 <
851 <    temp = useRF;
852 <    MPI_Allreduce(&temp, &useRF, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
853 <
854 <    temp = useSF;
855 <    MPI_Allreduce(&temp, &useSF, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);  
856 <
857 <    temp = useSP;
858 <    MPI_Allreduce(&temp, &useSP, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);
859 <
860 <    temp = useBoxDipole;
861 <    MPI_Allreduce(&temp, &useBoxDipole, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);
862 <
863 <    temp = useAtomicVirial_;
864 <    MPI_Allreduce(&temp, &useAtomicVirial_, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);
865 <
814 >    temp = usesElectrostatic;
815 >    MPI_Allreduce(&temp, &usesElectrostaticAtoms_, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);
816   #endif
817 <
818 <    fInfo_.SIM_uses_PBC = usePBC;    
819 <    fInfo_.SIM_uses_DirectionalAtoms = useDirectionalAtom;
820 <    fInfo_.SIM_uses_LennardJones = useLennardJones;
821 <    fInfo_.SIM_uses_Electrostatics = useElectrostatics;    
822 <    fInfo_.SIM_uses_Charges = useCharge;
873 <    fInfo_.SIM_uses_Dipoles = useDipole;
874 <    fInfo_.SIM_uses_Sticky = useSticky;
875 <    fInfo_.SIM_uses_StickyPower = useStickyPower;
876 <    fInfo_.SIM_uses_GayBerne = useGayBerne;
877 <    fInfo_.SIM_uses_EAM = useEAM;
878 <    fInfo_.SIM_uses_SC = useSC;
879 <    fInfo_.SIM_uses_Shapes = useShape;
880 <    fInfo_.SIM_uses_FLARB = useFLARB;
881 <    fInfo_.SIM_uses_RF = useRF;
882 <    fInfo_.SIM_uses_SF = useSF;
883 <    fInfo_.SIM_uses_SP = useSP;
884 <    fInfo_.SIM_uses_BoxDipole = useBoxDipole;
885 <    fInfo_.SIM_uses_AtomicVirial = useAtomicVirial_;
817 >    fInfo_.SIM_uses_PBC = usesPeriodicBoundaries_;    
818 >    fInfo_.SIM_uses_DirectionalAtoms = usesDirectionalAtoms_;
819 >    fInfo_.SIM_uses_MetallicAtoms = usesMetallicAtoms_;
820 >    fInfo_.SIM_requires_SkipCorrection = usesElectrostaticAtoms_;
821 >    fInfo_.SIM_requires_SelfCorrection = usesElectrostaticAtoms_;
822 >    fInfo_.SIM_uses_AtomicVirial = usesAtomicVirial_;
823    }
824  
825    void SimInfo::setupFortranSim() {
826      int isError;
827      int nExclude, nOneTwo, nOneThree, nOneFour;
828 <    std::vector<int> fortranGlobalGroupMembership;
828 >    vector<int> fortranGlobalGroupMembership;
829      
830 +    notifyFortranSkinThickness(&skinThickness_);
831 +
832 +    int ljsp = cutoffMethod_ == SHIFTED_POTENTIAL ? 1 : 0;
833 +    int ljsf = cutoffMethod_ == SHIFTED_FORCE ? 1 : 0;
834 +    notifyFortranCutoffs(&cutoffRadius_, &switchingRadius_, &ljsp, &ljsf);
835 +
836      isError = 0;
837  
838      //globalGroupMembership_ is filled by SimCreator    
# Line 898 | Line 841 | namespace oopse {
841      }
842  
843      //calculate mass ratio of cutoff group
844 <    std::vector<RealType> mfact;
844 >    vector<RealType> mfact;
845      SimInfo::MoleculeIterator mi;
846      Molecule* mol;
847      Molecule::CutoffGroupIterator ci;
# Line 925 | Line 868 | namespace oopse {
868      }
869  
870      //fill ident array of local atoms (it is actually ident of AtomType, it is so confusing !!!)
871 <    std::vector<int> identArray;
871 >    vector<int> identArray;
872  
873      //to avoid memory reallocation, reserve enough space identArray
874      identArray.reserve(getNAtoms());
# Line 938 | Line 881 | namespace oopse {
881  
882      //fill molMembershipArray
883      //molMembershipArray is filled by SimCreator    
884 <    std::vector<int> molMembershipArray(nGlobalAtoms_);
884 >    vector<int> molMembershipArray(nGlobalAtoms_);
885      for (int i = 0; i < nGlobalAtoms_; i++) {
886        molMembershipArray[i] = globalMolMembership_[i] + 1;
887      }
# Line 950 | Line 893 | namespace oopse {
893      nOneThree = oneThreeInteractions_.getSize();
894      nOneFour = oneFourInteractions_.getSize();
895  
953    std::cerr << "excludedInteractions contains: " << excludedInteractions_.getSize() << " pairs \n";
954    std::cerr << "oneTwoInteractions contains: " << oneTwoInteractions_.getSize() << " pairs \n";
955    std::cerr << "oneThreeInteractions contains: " << oneThreeInteractions_.getSize() << " pairs \n";
956    std::cerr << "oneFourInteractions contains: " << oneFourInteractions_.getSize() << " pairs \n";
957
896      int* excludeList = excludedInteractions_.getPairList();
897      int* oneTwoList = oneTwoInteractions_.getPairList();
898      int* oneThreeList = oneThreeInteractions_.getPairList();
# Line 973 | Line 911 | namespace oopse {
911        sprintf( painCave.errMsg,
912                 "There was an error setting the simulation information in fortran.\n" );
913        painCave.isFatal = 1;
914 <      painCave.severity = OOPSE_ERROR;
914 >      painCave.severity = OPENMD_ERROR;
915        simError();
916      }
917      
# Line 996 | Line 934 | namespace oopse {
934    void SimInfo::setupFortranParallel() {
935   #ifdef IS_MPI    
936      //SimInfo is responsible for creating localToGlobalAtomIndex and localToGlobalGroupIndex
937 <    std::vector<int> localToGlobalAtomIndex(getNAtoms(), 0);
938 <    std::vector<int> localToGlobalCutoffGroupIndex;
937 >    vector<int> localToGlobalAtomIndex(getNAtoms(), 0);
938 >    vector<int> localToGlobalCutoffGroupIndex;
939      SimInfo::MoleculeIterator mi;
940      Molecule::AtomIterator ai;
941      Molecule::CutoffGroupIterator ci;
# Line 1047 | Line 985 | namespace oopse {
985      errorCheckPoint();
986  
987   #endif
1050  }
1051
1052  void SimInfo::setupCutoff() {          
1053    
1054    ForceFieldOptions& forceFieldOptions_ = forceField_->getForceFieldOptions();
1055
1056    // Check the cutoff policy
1057    int cp =  TRADITIONAL_CUTOFF_POLICY; // Set to traditional by default
1058
1059    // Set LJ shifting bools to false
1060    ljsp_ = false;
1061    ljsf_ = false;
1062
1063    std::string myPolicy;
1064    if (forceFieldOptions_.haveCutoffPolicy()){
1065      myPolicy = forceFieldOptions_.getCutoffPolicy();
1066    }else if (simParams_->haveCutoffPolicy()) {
1067      myPolicy = simParams_->getCutoffPolicy();
1068    }
1069
1070    if (!myPolicy.empty()){
1071      toUpper(myPolicy);
1072      if (myPolicy == "MIX") {
1073        cp = MIX_CUTOFF_POLICY;
1074      } else {
1075        if (myPolicy == "MAX") {
1076          cp = MAX_CUTOFF_POLICY;
1077        } else {
1078          if (myPolicy == "TRADITIONAL") {            
1079            cp = TRADITIONAL_CUTOFF_POLICY;
1080          } else {
1081            // throw error        
1082            sprintf( painCave.errMsg,
1083                     "SimInfo error: Unknown cutoffPolicy. (Input file specified %s .)\n\tcutoffPolicy must be one of: \"Mix\", \"Max\", or \"Traditional\".", myPolicy.c_str() );
1084            painCave.isFatal = 1;
1085            simError();
1086          }    
1087        }          
1088      }
1089    }          
1090    notifyFortranCutoffPolicy(&cp);
1091
1092    // Check the Skin Thickness for neighborlists
1093    RealType skin;
1094    if (simParams_->haveSkinThickness()) {
1095      skin = simParams_->getSkinThickness();
1096      notifyFortranSkinThickness(&skin);
1097    }            
1098        
1099    // Check if the cutoff was set explicitly:
1100    if (simParams_->haveCutoffRadius()) {
1101      rcut_ = simParams_->getCutoffRadius();
1102      if (simParams_->haveSwitchingRadius()) {
1103        rsw_  = simParams_->getSwitchingRadius();
1104      } else {
1105        if (fInfo_.SIM_uses_Charges |
1106            fInfo_.SIM_uses_Dipoles |
1107            fInfo_.SIM_uses_RF) {
1108          
1109          rsw_ = 0.85 * rcut_;
1110          sprintf(painCave.errMsg,
1111                  "SimCreator Warning: No value was set for the switchingRadius.\n"
1112                  "\tOOPSE will use a default value of 85 percent of the cutoffRadius.\n"
1113                  "\tswitchingRadius = %f. for this simulation\n", rsw_);
1114        painCave.isFatal = 0;
1115        simError();
1116        } else {
1117          rsw_ = rcut_;
1118          sprintf(painCave.errMsg,
1119                  "SimCreator Warning: No value was set for the switchingRadius.\n"
1120                  "\tOOPSE will use the same value as the cutoffRadius.\n"
1121                  "\tswitchingRadius = %f. for this simulation\n", rsw_);
1122          painCave.isFatal = 0;
1123          simError();
1124        }
1125      }
1126
1127      if (simParams_->haveElectrostaticSummationMethod()) {
1128        std::string myMethod = simParams_->getElectrostaticSummationMethod();
1129        toUpper(myMethod);
1130        
1131        if (myMethod == "SHIFTED_POTENTIAL") {
1132          ljsp_ = true;
1133        } else if (myMethod == "SHIFTED_FORCE") {
1134          ljsf_ = true;
1135        }
1136      }
1137      notifyFortranCutoffs(&rcut_, &rsw_, &ljsp_, &ljsf_);
1138      
1139    } else {
1140      
1141      // For electrostatic atoms, we'll assume a large safe value:
1142      if (fInfo_.SIM_uses_Charges | fInfo_.SIM_uses_Dipoles | fInfo_.SIM_uses_RF) {
1143        sprintf(painCave.errMsg,
1144                "SimCreator Warning: No value was set for the cutoffRadius.\n"
1145                "\tOOPSE will use a default value of 15.0 angstroms"
1146                "\tfor the cutoffRadius.\n");
1147        painCave.isFatal = 0;
1148        simError();
1149        rcut_ = 15.0;
1150      
1151        if (simParams_->haveElectrostaticSummationMethod()) {
1152          std::string myMethod = simParams_->getElectrostaticSummationMethod();
1153          toUpper(myMethod);
1154      
1155      // For the time being, we're tethering the LJ shifted behavior to the
1156      // electrostaticSummationMethod keyword options
1157          if (myMethod == "SHIFTED_POTENTIAL") {
1158            ljsp_ = true;
1159          } else if (myMethod == "SHIFTED_FORCE") {
1160            ljsf_ = true;
1161          }
1162          if (myMethod == "SHIFTED_POTENTIAL" || myMethod == "SHIFTED_FORCE") {
1163            if (simParams_->haveSwitchingRadius()){
1164              sprintf(painCave.errMsg,
1165                      "SimInfo Warning: A value was set for the switchingRadius\n"
1166                      "\teven though the electrostaticSummationMethod was\n"
1167                      "\tset to %s\n", myMethod.c_str());
1168              painCave.isFatal = 1;
1169              simError();            
1170            }
1171          }
1172        }
1173      
1174        if (simParams_->haveSwitchingRadius()){
1175          rsw_ = simParams_->getSwitchingRadius();
1176        } else {        
1177          sprintf(painCave.errMsg,
1178                  "SimCreator Warning: No value was set for switchingRadius.\n"
1179                  "\tOOPSE will use a default value of\n"
1180                  "\t0.85 * cutoffRadius for the switchingRadius\n");
1181          painCave.isFatal = 0;
1182          simError();
1183          rsw_ = 0.85 * rcut_;
1184        }
1185
1186        notifyFortranCutoffs(&rcut_, &rsw_, &ljsp_, &ljsf_);
1187
1188      } else {
1189        // We didn't set rcut explicitly, and we don't have electrostatic atoms, so
1190        // We'll punt and let fortran figure out the cutoffs later.
1191        
1192        notifyFortranYouAreOnYourOwn();
1193
1194      }
1195    }
988    }
989  
1198  void SimInfo::setupElectrostaticSummationMethod( int isError ) {    
1199    
1200    int errorOut;
1201    int esm =  NONE;
1202    int sm = UNDAMPED;
1203    RealType alphaVal;
1204    RealType dielectric;
1205    
1206    errorOut = isError;
990  
991 <    if (simParams_->haveElectrostaticSummationMethod()) {
992 <      std::string myMethod = simParams_->getElectrostaticSummationMethod();
1210 <      toUpper(myMethod);
1211 <      if (myMethod == "NONE") {
1212 <        esm = NONE;
1213 <      } else {
1214 <        if (myMethod == "SWITCHING_FUNCTION") {
1215 <          esm = SWITCHING_FUNCTION;
1216 <        } else {
1217 <          if (myMethod == "SHIFTED_POTENTIAL") {
1218 <            esm = SHIFTED_POTENTIAL;
1219 <          } else {
1220 <            if (myMethod == "SHIFTED_FORCE") {            
1221 <              esm = SHIFTED_FORCE;
1222 <            } else {
1223 <              if (myMethod == "REACTION_FIELD") {
1224 <                esm = REACTION_FIELD;
1225 <                dielectric = simParams_->getDielectric();
1226 <                if (!simParams_->haveDielectric()) {
1227 <                  // throw warning
1228 <                  sprintf( painCave.errMsg,
1229 <                           "SimInfo warning: dielectric was not specified in the input file\n\tfor the reaction field correction method.\n"
1230 <                           "\tA default value of %f will be used for the dielectric.\n", dielectric);
1231 <                  painCave.isFatal = 0;
1232 <                  simError();
1233 <                }
1234 <              } else {
1235 <                // throw error        
1236 <                sprintf( painCave.errMsg,
1237 <                         "SimInfo error: Unknown electrostaticSummationMethod.\n"
1238 <                         "\t(Input file specified %s .)\n"
1239 <                         "\telectrostaticSummationMethod must be one of: \"none\",\n"
1240 <                         "\t\"shifted_potential\", \"shifted_force\", or \n"
1241 <                         "\t\"reaction_field\".\n", myMethod.c_str() );
1242 <                painCave.isFatal = 1;
1243 <                simError();
1244 <              }    
1245 <            }          
1246 <          }
1247 <        }
1248 <      }
1249 <    }
991 >  void SimInfo::setupSwitchingFunction() {    
992 >    int ft = CUBIC;
993      
994 <    if (simParams_->haveElectrostaticScreeningMethod()) {
995 <      std::string myScreen = simParams_->getElectrostaticScreeningMethod();
1253 <      toUpper(myScreen);
1254 <      if (myScreen == "UNDAMPED") {
1255 <        sm = UNDAMPED;
1256 <      } else {
1257 <        if (myScreen == "DAMPED") {
1258 <          sm = DAMPED;
1259 <          if (!simParams_->haveDampingAlpha()) {
1260 <            // first set a cutoff dependent alpha value
1261 <            // we assume alpha depends linearly with rcut from 0 to 20.5 ang
1262 <            alphaVal = 0.5125 - rcut_* 0.025;
1263 <            // for values rcut > 20.5, alpha is zero
1264 <            if (alphaVal < 0) alphaVal = 0;
1265 <
1266 <            // throw warning
1267 <            sprintf( painCave.errMsg,
1268 <                     "SimInfo warning: dampingAlpha was not specified in the input file.\n"
1269 <                     "\tA default value of %f (1/ang) will be used for the cutoff of\n\t%f (ang).\n", alphaVal, rcut_);
1270 <            painCave.isFatal = 0;
1271 <            simError();
1272 <          } else {
1273 <            alphaVal = simParams_->getDampingAlpha();
1274 <          }
1275 <          
1276 <        } else {
1277 <          // throw error        
1278 <          sprintf( painCave.errMsg,
1279 <                   "SimInfo error: Unknown electrostaticScreeningMethod.\n"
1280 <                   "\t(Input file specified %s .)\n"
1281 <                   "\telectrostaticScreeningMethod must be one of: \"undamped\"\n"
1282 <                   "or \"damped\".\n", myScreen.c_str() );
1283 <          painCave.isFatal = 1;
1284 <          simError();
1285 <        }
1286 <      }
1287 <    }
1288 <    
1289 <    // let's pass some summation method variables to fortran
1290 <    setElectrostaticSummationMethod( &esm );
1291 <    setFortranElectrostaticMethod( &esm );
1292 <    setScreeningMethod( &sm );
1293 <    setDampingAlpha( &alphaVal );
1294 <    setReactionFieldDielectric( &dielectric );
1295 <    initFortranFF( &errorOut );
1296 <  }
1297 <
1298 <  void SimInfo::setupSwitchingFunction() {    
1299 <    int ft = CUBIC;
1300 <
1301 <    if (simParams_->haveSwitchingFunctionType()) {
1302 <      std::string funcType = simParams_->getSwitchingFunctionType();
994 >    if (simParams_->haveSwitchingFunctionType()) {
995 >      string funcType = simParams_->getSwitchingFunctionType();
996        toUpper(funcType);
997        if (funcType == "CUBIC") {
998          ft = CUBIC;
# Line 1309 | Line 1002 | namespace oopse {
1002          } else {
1003            // throw error        
1004            sprintf( painCave.errMsg,
1005 <                   "SimInfo error: Unknown switchingFunctionType. (Input file specified %s .)\n\tswitchingFunctionType must be one of: \"cubic\" or \"fifth_order_polynomial\".", funcType.c_str() );
1005 >                   "SimInfo error: Unknown switchingFunctionType. (Input file specified %s .)\n"
1006 >                   "\tswitchingFunctionType must be one of: \"cubic\" or \"fifth_order_polynomial\".",
1007 >                   funcType.c_str() );
1008            painCave.isFatal = 1;
1009            simError();
1010          }          
# Line 1326 | Line 1021 | namespace oopse {
1021      // we only call setAccumulateBoxDipole if the accumulateBoxDipole parameter is true
1022      if ( simParams_->haveAccumulateBoxDipole() )
1023        if ( simParams_->getAccumulateBoxDipole() ) {
1329        setAccumulateBoxDipole();
1024          calcBoxDipole_ = true;
1025        }
1026  
# Line 1336 | Line 1030 | namespace oopse {
1030      properties_.addProperty(genData);  
1031    }
1032  
1033 <  void SimInfo::removeProperty(const std::string& propName) {
1033 >  void SimInfo::removeProperty(const string& propName) {
1034      properties_.removeProperty(propName);  
1035    }
1036  
# Line 1344 | Line 1038 | namespace oopse {
1038      properties_.clearProperties();
1039    }
1040  
1041 <  std::vector<std::string> SimInfo::getPropertyNames() {
1041 >  vector<string> SimInfo::getPropertyNames() {
1042      return properties_.getPropertyNames();  
1043    }
1044        
1045 <  std::vector<GenericData*> SimInfo::getProperties() {
1045 >  vector<GenericData*> SimInfo::getProperties() {
1046      return properties_.getProperties();
1047    }
1048  
1049 <  GenericData* SimInfo::getPropertyByName(const std::string& propName) {
1049 >  GenericData* SimInfo::getPropertyByName(const string& propName) {
1050      return properties_.getPropertyByName(propName);
1051    }
1052  
# Line 1435 | Line 1129 | namespace oopse {
1129  
1130    }        
1131  
1132 <  std::ostream& operator <<(std::ostream& o, SimInfo& info) {
1132 >  ostream& operator <<(ostream& o, SimInfo& info) {
1133  
1134      return o;
1135    }
# Line 1478 | Line 1172 | namespace oopse {
1172  
1173  
1174         [  Ixx -Ixy  -Ixz ]
1175 <  J =| -Iyx  Iyy  -Iyz |
1175 >    J =| -Iyx  Iyy  -Iyz |
1176         [ -Izx -Iyz   Izz ]
1177      */
1178  
# Line 1585 | Line 1279 | namespace oopse {
1279      return IOIndexToIntegrableObject.at(index);
1280    }
1281    
1282 <  void SimInfo::setIOIndexToIntegrableObject(const std::vector<StuntDouble*>& v) {
1282 >  void SimInfo::setIOIndexToIntegrableObject(const vector<StuntDouble*>& v) {
1283      IOIndexToIntegrableObject= v;
1284    }
1285  
# Line 1627 | Line 1321 | namespace oopse {
1321      return;
1322    }
1323   /*
1324 <   void SimInfo::setStuntDoubleFromGlobalIndex(std::vector<StuntDouble*> v) {
1324 >   void SimInfo::setStuntDoubleFromGlobalIndex(vector<StuntDouble*> v) {
1325        assert( v.size() == nAtoms_ + nRigidBodies_);
1326        sdByGlobalIndex_ = v;
1327      }
# Line 1637 | Line 1331 | namespace oopse {
1331        return sdByGlobalIndex_.at(index);
1332      }  
1333   */  
1334 < }//end namespace oopse
1334 >  int SimInfo::getNGlobalConstraints() {
1335 >    int nGlobalConstraints;
1336 > #ifdef IS_MPI
1337 >    MPI_Allreduce(&nConstraints_, &nGlobalConstraints, 1, MPI_INT, MPI_SUM,
1338 >                  MPI_COMM_WORLD);    
1339 > #else
1340 >    nGlobalConstraints =  nConstraints_;
1341 > #endif
1342 >    return nGlobalConstraints;
1343 >  }
1344  
1345 + }//end namespace OpenMD
1346 +

Comparing:
trunk/src/brains/SimInfo.cpp (property svn:keywords), Revision 1290 by cli2, Wed Sep 10 19:51:45 2008 UTC vs.
branches/development/src/brains/SimInfo.cpp (property svn:keywords), Revision 1529 by gezelter, Mon Dec 27 18:35:59 2010 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines