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

Comparing trunk/OOPSE-2.0/src/brains/SimInfo.cpp (file contents):
Revision 1958 by tim, Tue Jan 25 21:59:18 2005 UTC vs.
Revision 2082 by tim, Mon Mar 7 22:39:33 2005 UTC

# Line 56 | Line 56
56   #include "UseTheForce/notifyCutoffs_interface.h"
57   #include "utils/MemoryUtils.hpp"
58   #include "utils/simError.h"
59 + #include "selection/SelectionManager.hpp"
60  
61   #ifdef IS_MPI
62   #include "UseTheForce/mpiComponentPlan.h"
# Line 72 | Line 73 | SimInfo::SimInfo(std::vector<std::pair<MoleculeStamp*,
73                                  nGlobalIntegrableObjects_(0), nGlobalRigidBodies_(0),
74                                  nAtoms_(0), nBonds_(0),  nBends_(0), nTorsions_(0), nRigidBodies_(0),
75                                  nIntegrableObjects_(0),  nCutoffGroups_(0), nConstraints_(0),
76 <                                sman_(NULL), fortranInitialized_(false) {
76 >                                sman_(NULL), fortranInitialized_(false), selectMan_(NULL) {
77  
78              
79      std::vector<std::pair<MoleculeStamp*, int> >::iterator i;
# Line 137 | Line 138 | SimInfo::SimInfo(std::vector<std::pair<MoleculeStamp*,
138   #ifdef IS_MPI    
139      molToProcMap_.resize(nGlobalMols_);
140   #endif
141 <    
141 >
142 >    selectMan_ = new SelectionManager(this);
143 >    selectMan_->selectAll();
144   }
145  
146   SimInfo::~SimInfo() {
147 <    //MemoryUtils::deleteVectorOfPointer(molecules_);
148 <
149 <    MemoryUtils::deleteVectorOfPointer(moleculeStamps_);
147 >    std::map<int, Molecule*>::iterator i;
148 >    for (i = molecules_.begin(); i != molecules_.end(); ++i) {
149 >        delete i->second;
150 >    }
151 >    molecules_.clear();
152      
153 +    MemoryUtils::deletePointers(moleculeStamps_);
154 +    
155      delete sman_;
156      delete simParams_;
157      delete forceField_;
158 <
158 >    delete selectMan_;
159   }
160  
161   int SimInfo::getNGlobalConstraints() {
# Line 751 | Line 758 | void SimInfo::setupCutoff() {
758      return maxCutoffRadius;
759   }
760  
761 < void SimInfo::setupCutoff() {
755 <    double rcut_;  //cutoff radius
756 <    double rsw_; //switching radius
761 > void SimInfo::getCutoff(double& rcut, double& rsw) {
762      
763      if (fInfo_.SIM_uses_Charges | fInfo_.SIM_uses_Dipoles | fInfo_.SIM_uses_RF) {
764          
# Line 764 | Line 769 | void SimInfo::setupCutoff() {
769                  "\tfor the cutoffRadius.\n");
770              painCave.isFatal = 0;
771              simError();
772 <            rcut_ = 15.0;
772 >            rcut = 15.0;
773          } else{
774 <            rcut_ = simParams_->getRcut();
774 >            rcut = simParams_->getRcut();
775          }
776  
777          if (!simParams_->haveRsw()){
# Line 776 | Line 781 | void SimInfo::setupCutoff() {
781                  "\t0.95 * cutoffRadius for the switchingRadius\n");
782              painCave.isFatal = 0;
783              simError();
784 <            rsw_ = 0.95 * rcut_;
784 >            rsw = 0.95 * rcut;
785          } else{
786 <            rsw_ = simParams_->getRsw();
786 >            rsw = simParams_->getRsw();
787          }
788  
789      } else {
# Line 786 | Line 791 | void SimInfo::setupCutoff() {
791          //meta-data file, the maximum cutoff radius calculated from forcefiled will be used
792          
793          if (simParams_->haveRcut()) {
794 <            rcut_ = simParams_->getRcut();
794 >            rcut = simParams_->getRcut();
795          } else {
796              //set cutoff radius to the maximum cutoff radius based on atom types in the whole system
797 <            rcut_ = calcMaxCutoffRadius();
797 >            rcut = calcMaxCutoffRadius();
798          }
799  
800          if (simParams_->haveRsw()) {
801 <            rsw_  = simParams_->getRsw();
801 >            rsw  = simParams_->getRsw();
802          } else {
803 <            rsw_ = rcut_;
803 >            rsw = rcut;
804          }
805      
806      }
807 <        
807 > }
808 >
809 > void SimInfo::setupCutoff() {
810 >    getCutoff(rcut_, rsw_);    
811      double rnblist = rcut_ + 1; // skin of neighbor list
812  
813      //Pass these cutoff radius etc. to fortran. This function should be called once and only once
# Line 831 | Line 839 | void SimInfo::setSnapshotManager(SnapshotManager* sman
839   }
840  
841   void SimInfo::setSnapshotManager(SnapshotManager* sman) {
842 +    //if (sman_ == sman_) {
843 +    //    return;
844 +    //}
845 +    
846 +    //delete sman_;
847      sman_ = sman;
848  
849      Molecule* mol;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines