ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/brains/SimInfo.cpp
(Generate patch)

Comparing branches/new_design/OOPSE-3.0/src/brains/SimInfo.cpp (file contents):
Revision 1832 by tim, Thu Dec 2 16:04:19 2004 UTC vs.
Revision 1841 by tim, Fri Dec 3 17:59:45 2004 UTC

# Line 42 | Line 42 | SimInfo::SimInfo(std::vector<std::pair<MoleculeStamp*,
42   namespace oopse {
43  
44   SimInfo::SimInfo(std::vector<std::pair<MoleculeStamp*, int> >& molStampPairs,
45 <                                ForceField* ff, Globals* globals) :
46 <                                forceField_(ff), globals_(globals), nAtoms_(0), nBonds_(0),
47 <                                nBends_(0), nTorsions_(0), nRigidBodies_(0), nIntegrableObjects_(0),
48 <                                nCutoffGroups_(0), nConstraints_(0), nZconstraint_(0), sman_(NULL),
49 <                                fortranInitialized_(false) {
45 >                                ForceField* ff, Globals* simParams) :
46 >                                forceField_(ff), simParams_(simParams),
47 >                                ndf_(0), ndfRaw_(0), ndfTrans_(0), nZconstraint_(0),
48 >                                nGlobalMols_(0), nGlobalAtoms_(0), nGlobalCutoffGroups_(0),
49 >                                nGlobalIntegrableObjects_(0), nGlobalRigidBodies_(0),
50 >                                nAtoms_(0), nBonds_(0),  nBends_(0), nTorsions_(0), nRigidBodies_(0),
51 >                                nIntegrableObjects_(0),  nCutoffGroups_(0), nConstraints_(0),
52 >                                sman_(NULL), fortranInitialized_(false) {
53  
54 +            
55      std::vector<std::pair<MoleculeStamp*, int> >::iterator i;
56      MoleculeStamp* molStamp;
57      int nMolWithSameStamp;
58 <    int nCutoffAtoms; // number of atoms belong to cutoff groups
59 <    int nGroups;          //total cutoff groups defined in meta-data file
60 <    CutoffGroupStamp* cgStamp;
57 <    int nAtomsInGroups;
58 <    int nCutoffGroupsInStamp;
59 <    
58 >    int nCutoffAtoms = 0; // number of atoms belong to cutoff groups
59 >    int nGroups = 0;          //total cutoff groups defined in meta-data file
60 >    CutoffGroupStamp* cgStamp;    
61      RigidBodyStamp* rbStamp;
62 <    int nAtomsInRigidBodies;
62 <    int nRigidBodiesInStamp;
63 <    int nRigidAtoms;
64 <    int nRigidBodies;
65 <        
66 <    nGlobalAtoms_ =  0;
62 >    int nRigidAtoms = 0;
63      
68    nGroups = 0;
69    nCutoffAtoms = 0;
70    nRigidBodies = 0;
71    
64      for (i = molStampPairs.begin(); i !=molStampPairs.end(); ++i) {
65          molStamp = i->first;
66          nMolWithSameStamp = i->second;
# Line 80 | Line 72 | SimInfo::SimInfo(std::vector<std::pair<MoleculeStamp*,
72  
73  
74          //calculate atoms in cutoff groups
75 <        nAtomsInGroups = 0;
76 <        nCutoffGroupsInStamp = molStamp->getNCutoffGroups();
75 >        int nAtomsInGroups = 0;
76 >        int nCutoffGroupsInStamp = molStamp->getNCutoffGroups();
77          
78          for (int j=0; j < nCutoffGroupsInStamp; j++) {
79              cgStamp = molStamp->getCutoffGroup(j);
# Line 92 | Line 84 | SimInfo::SimInfo(std::vector<std::pair<MoleculeStamp*,
84          nCutoffAtoms += nAtomsInGroups * nMolWithSameStamp;            
85  
86          //calculate atoms in rigid bodies
87 <        nAtomsInRigidBodies = 0;
88 <        nRigidBodiesInStamp = molStamp->getNCutoffGroups();
87 >        int nAtomsInRigidBodies = 0;
88 >        int nRigidBodiesInStamp = molStamp->getNCutoffGroups();
89          
90          for (int j=0; j < nRigidBodiesInStamp; j++) {
91              rbStamp = molStamp->getRigidBody(j);
92 <            nRigidBodiesInStamp += rbStamp->getNMembers();
92 >            nAtomsInRigidBodies += rbStamp->getNMembers();
93          }
94  
95 <        nRigidBodies += nRigidBodiesInStamp * nMolWithSameStamp;
95 >        nGlobalRigidBodies_ += nRigidBodiesInStamp * nMolWithSameStamp;
96          nRigidAtoms += nAtomsInRigidBodies * nMolWithSameStamp;            
97          
98      }
# Line 111 | Line 103 | SimInfo::SimInfo(std::vector<std::pair<MoleculeStamp*,
103      //file plus the number of cutoff groups defined in meta-data file
104      nGlobalCutoffGroups_ = nGlobalAtoms_ - nCutoffAtoms + nGroups;
105  
106 <    //every free atom (atom does not belong to rigid bodies) is a rigid body
107 <    //therefore the total number of cutoff groups in the system is equal to
106 >    //every free atom (atom does not belong to rigid bodies) is an integrable object
107 >    //therefore the total number of  integrable objects in the system is equal to
108      //the total number of atoms minus number of atoms belong to  rigid body defined in meta-data
109      //file plus the number of  rigid bodies defined in meta-data file
110 <    nGlobalIntegrableObjects_ = nGlobalAtoms_ - nRigidAtoms + nRigidBodies;
110 >    nGlobalIntegrableObjects_ = nGlobalAtoms_ - nRigidAtoms + nGlobalRigidBodies_;
111  
112      //initialize globalGroupMembership_, every element of this array will be 0
113      globalGroupMembership_.insert(globalGroupMembership_.end(), nGlobalAtoms_, 0);
# Line 134 | Line 126 | SimInfo::~SimInfo() {
126      MemoryUtils::deleteVectorOfPointer(moleculeStamps_);
127      
128      delete sman_;
129 <    delete globals_;
129 >    delete simParams_;
130      delete forceField_;
131  
132   }
# Line 144 | Line 136 | bool SimInfo::addMolecule(Molecule* mol) {
136      MoleculeIterator i;
137  
138      i = molecules_.find(mol->getGlobalIndex());
139 <    if (i != molecules_.end() ) {
139 >    if (i == molecules_.end() ) {
140  
141          molecules_.insert(std::make_pair(mol->getGlobalIndex(), mol));
142          
# Line 462 | Line 454 | void SimInfo::setupSimType() {
454      int useFLARB = 0; //it is not in AtomType yet
455      int useDirectionalAtom = 0;    
456      int useElectrostatics = 0;
457 <    //usePBC and useRF are from globals
458 <    bool usePBC = globals_->getPBC();
459 <    bool useRF = globals_->getUseRF();
457 >    //usePBC and useRF are from simParams
458 >    bool usePBC = simParams_->getPBC();
459 >    bool useRF = simParams_->getUseRF();
460  
461      //loop over all of the atom types
462      for (i = atomTypes.begin(); i != atomTypes.end(); ++i) {
# Line 543 | Line 535 | void SimInfo::setupSimType() {
535  
536      if( fInfo_.SIM_uses_Dipoles && fInfo_.SIM_uses_RF) {
537  
538 <        if (globals_->haveDielectric()) {
539 <            fInfo_.dielect = globals_->getDielectric();
538 >        if (simParams_->haveDielectric()) {
539 >            fInfo_.dielect = simParams_->getDielectric();
540          } else {
541              sprintf(painCave.errMsg,
542                      "SimSetup Error: No Dielectric constant was set.\n"
# Line 732 | Line 724 | void SimInfo::setupCutoff() {
724      
725      if (fInfo_.SIM_uses_Charges | fInfo_.SIM_uses_Dipoles | fInfo_.SIM_uses_RF) {
726          
727 <        if (!globals_->haveRcut()){
727 >        if (!simParams_->haveRcut()){
728              sprintf(painCave.errMsg,
729                  "SimCreator Warning: No value was set for the cutoffRadius.\n"
730                  "\tOOPSE will use a default value of 15.0 angstroms"
# Line 741 | Line 733 | void SimInfo::setupCutoff() {
733              simError();
734              rcut_ = 15.0;
735          } else{
736 <            rcut_ = globals_->getRcut();
736 >            rcut_ = simParams_->getRcut();
737          }
738  
739 <        if (!globals_->haveRsw()){
739 >        if (!simParams_->haveRsw()){
740              sprintf(painCave.errMsg,
741                  "SimCreator Warning: No value was set for switchingRadius.\n"
742                  "\tOOPSE will use a default value of\n"
# Line 753 | Line 745 | void SimInfo::setupCutoff() {
745              simError();
746              rsw_ = 0.95 * rcut_;
747          } else{
748 <            rsw_ = globals_->getRsw();
748 >            rsw_ = simParams_->getRsw();
749          }
750  
751      } else {
752          // if charge, dipole or reaction field is not used and the cutofff radius is not specified in
753          //meta-data file, the maximum cutoff radius calculated from forcefiled will be used
754          
755 <        if (globals_->haveRcut()) {
756 <            rcut_ = globals_->getRcut();
755 >        if (simParams_->haveRcut()) {
756 >            rcut_ = simParams_->getRcut();
757          } else {
758              //set cutoff radius to the maximum cutoff radius based on atom types in the whole system
759              rcut_ = calcMaxCutoffRadius();
760          }
761  
762 <        if (globals_->haveRsw()) {
763 <            rsw_  = globals_->getRsw();
762 >        if (simParams_->haveRsw()) {
763 >            rsw_  = simParams_->getRsw();
764          } else {
765              rsw_ = rcut_;
766          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines