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 |
|
|
142 |
– |
selectMan_ = new SelectionManager(this); |
143 |
– |
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_; |
154 |
– |
delete selectMan_; |
156 |
|
} |
157 |
|
|
158 |
|
int SimInfo::getNGlobalConstraints() { |
367 |
|
exclude_.addPair(c, d); |
368 |
|
} |
369 |
|
|
370 |
< |
|
370 |
> |
Molecule::RigidBodyIterator rbIter; |
371 |
> |
RigidBody* rb; |
372 |
> |
for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { |
373 |
> |
std::vector<Atom*> atoms = rb->getAtoms(); |
374 |
> |
for (int i = 0; i < atoms.size() -1 ; ++i) { |
375 |
> |
for (int j = i + 1; j < atoms.size(); ++j) { |
376 |
> |
a = atoms[i]->getGlobalIndex(); |
377 |
> |
b = atoms[j]->getGlobalIndex(); |
378 |
> |
exclude_.addPair(a, b); |
379 |
> |
} |
380 |
> |
} |
381 |
> |
} |
382 |
> |
|
383 |
|
} |
384 |
|
|
385 |
|
void SimInfo::removeExcludePairs(Molecule* mol) { |
423 |
|
exclude_.removePair(b, d); |
424 |
|
exclude_.removePair(c, d); |
425 |
|
} |
426 |
+ |
|
427 |
+ |
Molecule::RigidBodyIterator rbIter; |
428 |
+ |
RigidBody* rb; |
429 |
+ |
for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { |
430 |
+ |
std::vector<Atom*> atoms = rb->getAtoms(); |
431 |
+ |
for (int i = 0; i < atoms.size() -1 ; ++i) { |
432 |
+ |
for (int j = i + 1; j < atoms.size(); ++j) { |
433 |
+ |
a = atoms[i]->getGlobalIndex(); |
434 |
+ |
b = atoms[j]->getGlobalIndex(); |
435 |
+ |
exclude_.removePair(a, b); |
436 |
+ |
} |
437 |
+ |
} |
438 |
+ |
} |
439 |
|
|
440 |
|
} |
441 |
|
|
671 |
|
} |
672 |
|
|
673 |
|
//setup fortran simulation |
648 |
– |
//gloalExcludes and molMembershipArray should go away (They are never used) |
649 |
– |
//why the hell fortran need to know molecule? |
650 |
– |
//OOPSE = Object-Obfuscated Parallel Simulation Engine |
674 |
|
int nGlobalExcludes = 0; |
675 |
|
int* globalExcludes = NULL; |
676 |
|
int* excludeList = exclude_.getExcludeList(); |
777 |
|
return maxCutoffRadius; |
778 |
|
} |
779 |
|
|
780 |
< |
void SimInfo::setupCutoff() { |
758 |
< |
double rcut_; //cutoff radius |
759 |
< |
double rsw_; //switching radius |
780 |
> |
void SimInfo::getCutoff(double& rcut, double& rsw) { |
781 |
|
|
782 |
|
if (fInfo_.SIM_uses_Charges | fInfo_.SIM_uses_Dipoles | fInfo_.SIM_uses_RF) { |
783 |
|
|
788 |
|
"\tfor the cutoffRadius.\n"); |
789 |
|
painCave.isFatal = 0; |
790 |
|
simError(); |
791 |
< |
rcut_ = 15.0; |
791 |
> |
rcut = 15.0; |
792 |
|
} else{ |
793 |
< |
rcut_ = simParams_->getRcut(); |
793 |
> |
rcut = simParams_->getRcut(); |
794 |
|
} |
795 |
|
|
796 |
|
if (!simParams_->haveRsw()){ |
800 |
|
"\t0.95 * cutoffRadius for the switchingRadius\n"); |
801 |
|
painCave.isFatal = 0; |
802 |
|
simError(); |
803 |
< |
rsw_ = 0.95 * rcut_; |
803 |
> |
rsw = 0.95 * rcut; |
804 |
|
} else{ |
805 |
< |
rsw_ = simParams_->getRsw(); |
805 |
> |
rsw = simParams_->getRsw(); |
806 |
|
} |
807 |
|
|
808 |
|
} else { |
810 |
|
//meta-data file, the maximum cutoff radius calculated from forcefiled will be used |
811 |
|
|
812 |
|
if (simParams_->haveRcut()) { |
813 |
< |
rcut_ = simParams_->getRcut(); |
813 |
> |
rcut = simParams_->getRcut(); |
814 |
|
} else { |
815 |
|
//set cutoff radius to the maximum cutoff radius based on atom types in the whole system |
816 |
< |
rcut_ = calcMaxCutoffRadius(); |
816 |
> |
rcut = calcMaxCutoffRadius(); |
817 |
|
} |
818 |
|
|
819 |
|
if (simParams_->haveRsw()) { |
820 |
< |
rsw_ = simParams_->getRsw(); |
820 |
> |
rsw = simParams_->getRsw(); |
821 |
|
} else { |
822 |
< |
rsw_ = rcut_; |
822 |
> |
rsw = rcut; |
823 |
|
} |
824 |
|
|
825 |
|
} |
826 |
< |
|
826 |
> |
} |
827 |
> |
|
828 |
> |
void SimInfo::setupCutoff() { |
829 |
> |
getCutoff(rcut_, rsw_); |
830 |
|
double rnblist = rcut_ + 1; // skin of neighbor list |
831 |
|
|
832 |
|
//Pass these cutoff radius etc. to fortran. This function should be called once and only once |
858 |
|
} |
859 |
|
|
860 |
|
void SimInfo::setSnapshotManager(SnapshotManager* sman) { |
861 |
+ |
if (sman_ == sman) { |
862 |
+ |
return; |
863 |
+ |
} |
864 |
+ |
delete sman_; |
865 |
|
sman_ = sman; |
866 |
|
|
867 |
|
Molecule* mol; |