65 |
|
|
66 |
|
namespace oopse { |
67 |
|
|
68 |
< |
SimInfo::SimInfo(std::vector<std::pair<MoleculeStamp*, int> >& molStampPairs, |
68 |
> |
SimInfo::SimInfo(MakeStamps* stamps, std::vector<std::pair<MoleculeStamp*, int> >& molStampPairs, |
69 |
|
ForceField* ff, Globals* simParams) : |
70 |
< |
forceField_(ff), simParams_(simParams), |
70 |
> |
stamps_(stamps), forceField_(ff), simParams_(simParams), |
71 |
|
ndf_(0), ndfRaw_(0), ndfTrans_(0), nZconstraint_(0), |
72 |
|
nGlobalMols_(0), nGlobalAtoms_(0), nGlobalCutoffGroups_(0), |
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_); |
148 |
< |
|
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 |
> |
delete stamps_; |
152 |
|
delete sman_; |
153 |
|
delete simParams_; |
154 |
|
delete forceField_; |
154 |
– |
delete selectMan_; |
155 |
|
} |
156 |
|
|
157 |
|
int SimInfo::getNGlobalConstraints() { |
366 |
|
exclude_.addPair(c, d); |
367 |
|
} |
368 |
|
|
369 |
< |
|
369 |
> |
Molecule::RigidBodyIterator rbIter; |
370 |
> |
RigidBody* rb; |
371 |
> |
for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { |
372 |
> |
std::vector<Atom*> atoms = rb->getAtoms(); |
373 |
> |
for (int i = 0; i < atoms.size() -1 ; ++i) { |
374 |
> |
for (int j = i + 1; j < atoms.size(); ++j) { |
375 |
> |
a = atoms[i]->getGlobalIndex(); |
376 |
> |
b = atoms[j]->getGlobalIndex(); |
377 |
> |
exclude_.addPair(a, b); |
378 |
> |
} |
379 |
> |
} |
380 |
> |
} |
381 |
> |
|
382 |
|
} |
383 |
|
|
384 |
|
void SimInfo::removeExcludePairs(Molecule* mol) { |
422 |
|
exclude_.removePair(b, d); |
423 |
|
exclude_.removePair(c, d); |
424 |
|
} |
425 |
+ |
|
426 |
+ |
Molecule::RigidBodyIterator rbIter; |
427 |
+ |
RigidBody* rb; |
428 |
+ |
for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { |
429 |
+ |
std::vector<Atom*> atoms = rb->getAtoms(); |
430 |
+ |
for (int i = 0; i < atoms.size() -1 ; ++i) { |
431 |
+ |
for (int j = i + 1; j < atoms.size(); ++j) { |
432 |
+ |
a = atoms[i]->getGlobalIndex(); |
433 |
+ |
b = atoms[j]->getGlobalIndex(); |
434 |
+ |
exclude_.removePair(a, b); |
435 |
+ |
} |
436 |
+ |
} |
437 |
+ |
} |
438 |
|
|
439 |
|
} |
440 |
|
|
670 |
|
} |
671 |
|
|
672 |
|
//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 |
673 |
|
int nGlobalExcludes = 0; |
674 |
|
int* globalExcludes = NULL; |
675 |
|
int* excludeList = exclude_.getExcludeList(); |
857 |
|
} |
858 |
|
|
859 |
|
void SimInfo::setSnapshotManager(SnapshotManager* sman) { |
860 |
< |
if (sman_ == sman_) { |
860 |
> |
if (sman_ == sman) { |
861 |
|
return; |
862 |
< |
} |
841 |
< |
|
862 |
> |
} |
863 |
|
delete sman_; |
864 |
|
sman_ = sman; |
865 |
|
|