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" |
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), selectMan_(NULL) { |
76 |
> |
sman_(NULL), fortranInitialized_(false) { |
77 |
|
|
78 |
|
|
79 |
|
std::vector<std::pair<MoleculeStamp*, int> >::iterator i; |
139 |
|
molToProcMap_.resize(nGlobalMols_); |
140 |
|
#endif |
141 |
|
|
141 |
– |
selectMan_ = new SelectionManager(nGlobalAtoms_ + nGlobalRigidBodies_); |
142 |
– |
selectMan_->selectAll(); |
142 |
|
} |
143 |
|
|
144 |
|
SimInfo::~SimInfo() { |
145 |
< |
//MemoryUtils::deleteVectorOfPointer(molecules_); |
146 |
< |
|
147 |
< |
MemoryUtils::deleteVectorOfPointer(moleculeStamps_); |
145 |
> |
std::map<int, Molecule*>::iterator i; |
146 |
> |
for (i = molecules_.begin(); i != molecules_.end(); ++i) { |
147 |
> |
delete i->second; |
148 |
> |
} |
149 |
> |
molecules_.clear(); |
150 |
|
|
151 |
+ |
MemoryUtils::deletePointers(moleculeStamps_); |
152 |
+ |
|
153 |
|
delete sman_; |
154 |
|
delete simParams_; |
155 |
|
delete forceField_; |
153 |
– |
delete selectMan_; |
156 |
|
} |
157 |
|
|
158 |
|
int SimInfo::getNGlobalConstraints() { |
755 |
|
return maxCutoffRadius; |
756 |
|
} |
757 |
|
|
758 |
< |
void SimInfo::setupCutoff() { |
757 |
< |
double rcut_; //cutoff radius |
758 |
< |
double rsw_; //switching radius |
758 |
> |
void SimInfo::getCutoff(double& rcut, double& rsw) { |
759 |
|
|
760 |
|
if (fInfo_.SIM_uses_Charges | fInfo_.SIM_uses_Dipoles | fInfo_.SIM_uses_RF) { |
761 |
|
|
766 |
|
"\tfor the cutoffRadius.\n"); |
767 |
|
painCave.isFatal = 0; |
768 |
|
simError(); |
769 |
< |
rcut_ = 15.0; |
769 |
> |
rcut = 15.0; |
770 |
|
} else{ |
771 |
< |
rcut_ = simParams_->getRcut(); |
771 |
> |
rcut = simParams_->getRcut(); |
772 |
|
} |
773 |
|
|
774 |
|
if (!simParams_->haveRsw()){ |
778 |
|
"\t0.95 * cutoffRadius for the switchingRadius\n"); |
779 |
|
painCave.isFatal = 0; |
780 |
|
simError(); |
781 |
< |
rsw_ = 0.95 * rcut_; |
781 |
> |
rsw = 0.95 * rcut; |
782 |
|
} else{ |
783 |
< |
rsw_ = simParams_->getRsw(); |
783 |
> |
rsw = simParams_->getRsw(); |
784 |
|
} |
785 |
|
|
786 |
|
} else { |
788 |
|
//meta-data file, the maximum cutoff radius calculated from forcefiled will be used |
789 |
|
|
790 |
|
if (simParams_->haveRcut()) { |
791 |
< |
rcut_ = simParams_->getRcut(); |
791 |
> |
rcut = simParams_->getRcut(); |
792 |
|
} else { |
793 |
|
//set cutoff radius to the maximum cutoff radius based on atom types in the whole system |
794 |
< |
rcut_ = calcMaxCutoffRadius(); |
794 |
> |
rcut = calcMaxCutoffRadius(); |
795 |
|
} |
796 |
|
|
797 |
|
if (simParams_->haveRsw()) { |
798 |
< |
rsw_ = simParams_->getRsw(); |
798 |
> |
rsw = simParams_->getRsw(); |
799 |
|
} else { |
800 |
< |
rsw_ = rcut_; |
800 |
> |
rsw = rcut; |
801 |
|
} |
802 |
|
|
803 |
|
} |
804 |
< |
|
804 |
> |
} |
805 |
> |
|
806 |
> |
void SimInfo::setupCutoff() { |
807 |
> |
getCutoff(rcut_, rsw_); |
808 |
|
double rnblist = rcut_ + 1; // skin of neighbor list |
809 |
|
|
810 |
|
//Pass these cutoff radius etc. to fortran. This function should be called once and only once |
836 |
|
} |
837 |
|
|
838 |
|
void SimInfo::setSnapshotManager(SnapshotManager* sman) { |
839 |
+ |
//if (sman_ == sman_) { |
840 |
+ |
// return; |
841 |
+ |
//} |
842 |
+ |
|
843 |
+ |
//delete sman_; |
844 |
|
sman_ = sman; |
845 |
|
|
846 |
|
Molecule* mol; |