| 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" |
| 139 |
|
molToProcMap_.resize(nGlobalMols_); |
| 140 |
|
#endif |
| 141 |
|
|
| 142 |
< |
selectMan_ = new SelectionManager(nGlobalAtoms_ + nGlobalRigidBodies_); |
| 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_; |
| 758 |
|
return maxCutoffRadius; |
| 759 |
|
} |
| 760 |
|
|
| 761 |
< |
void SimInfo::setupCutoff() { |
| 757 |
< |
double rcut_; //cutoff radius |
| 758 |
< |
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 |
|
|
| 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()){ |
| 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 { |
| 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 |
| 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; |