44 |
|
#include <sstream> |
45 |
|
#include "types/MoleculeStamp.hpp" |
46 |
|
#include "utils/Tuple.hpp" |
47 |
< |
|
47 |
> |
#include "utils/MemoryUtils.hpp" |
48 |
|
namespace oopse { |
49 |
|
|
50 |
|
template<class ContainerType> |
77 |
|
} |
78 |
|
|
79 |
|
MoleculeStamp::~MoleculeStamp() { |
80 |
< |
|
80 |
> |
MemoryUtils::deletePointers(atomStamps_); |
81 |
> |
MemoryUtils::deletePointers(bondStamps_); |
82 |
> |
MemoryUtils::deletePointers(bendStamps_); |
83 |
> |
MemoryUtils::deletePointers(torsionStamps_); |
84 |
> |
MemoryUtils::deletePointers(rigidBodyStamps_); |
85 |
> |
MemoryUtils::deletePointers(cutoffGroupStamps_); |
86 |
> |
MemoryUtils::deletePointers(fragmentStamps_); |
87 |
|
} |
88 |
|
|
89 |
|
bool MoleculeStamp::addAtomStamp( AtomStamp* atom) { |
207 |
|
} |
208 |
|
|
209 |
|
} |
204 |
– |
|
205 |
– |
struct BendLessThan : public std::binary_function<IntTuple4, IntTuple4, bool> { |
206 |
– |
bool operator()(IntTuple3 b1, IntTuple3 b2) { |
207 |
– |
return b1.first < b2.first |
208 |
– |
|| (!(b2.first < b1.first) && b1.second < b2.second) |
209 |
– |
|| (!(b2.first < b1.first) && !(b2.second < b2.second) && b1.third < b2.third); |
210 |
– |
} |
211 |
– |
}; |
210 |
|
|
211 |
|
void MoleculeStamp::checkBends() { |
212 |
|
for(int i = 0; i < getNBends(); ++i) { |
255 |
|
} |
256 |
|
|
257 |
|
|
258 |
< |
std::set<IntTuple3, BendLessThan> allBends; |
259 |
< |
std::set<IntTuple3, BendLessThan>::iterator iter; |
258 |
> |
std::set<IntTuple3> allBends; |
259 |
> |
std::set<IntTuple3>::iterator iter; |
260 |
|
for(int i = 0; i < getNBends(); ++i) { |
261 |
|
BendStamp* bendStamp= getBendStamp(i); |
262 |
|
std::vector<int> bend = bendStamp->getMembers(); |
304 |
|
|
305 |
|
//find bend c--a--b |
306 |
|
AtomStamp::AtomIter ai; |
307 |
< |
for(int c= atomA->getFirstBonedAtom(ai);c != -1;c = atomA->getNextBonedAtom(ai)) |
307 |
> |
for(int c= atomA->getFirstBondedAtom(ai);c != -1;c = atomA->getNextBondedAtom(ai)) |
308 |
|
{ |
309 |
|
if(b == c) |
310 |
|
continue; |
323 |
|
} |
324 |
|
|
325 |
|
//find bend a--b--c |
326 |
< |
for(int c= atomB->getFirstBonedAtom(ai);c != -1;c = atomB->getNextBonedAtom(ai)) |
326 |
> |
for(int c= atomB->getFirstBondedAtom(ai);c != -1;c = atomB->getNextBondedAtom(ai)) |
327 |
|
{ |
328 |
|
if(a == c) |
329 |
|
continue; |
342 |
|
} |
343 |
|
|
344 |
|
} |
347 |
– |
|
348 |
– |
struct TorsionLessThan : public std::binary_function<IntTuple4, IntTuple4, bool> { |
349 |
– |
bool operator()(IntTuple4 t1, IntTuple4 t2) { |
350 |
– |
|
351 |
– |
return t1.first < t2.first |
352 |
– |
|| (!(t2.first < t1.first) && t1.second < t2.second) |
353 |
– |
|| (!(t2.first < t1.first) && !(t2.second < t2.second) && t1.third < t2.third) |
354 |
– |
||(!(t2.first < t1.first) && !(t2.second < t2.second) && !(t2.third < t1.third) && t1.fourth < t2.fourth); |
355 |
– |
} |
356 |
– |
|
357 |
– |
|
345 |
|
|
359 |
– |
}; |
360 |
– |
|
361 |
– |
|
346 |
|
void MoleculeStamp::checkTorsions() { |
347 |
|
for(int i = 0; i < getNTorsions(); ++i) { |
348 |
|
TorsionStamp* torsionStamp = getTorsionStamp(i); |
369 |
|
} |
370 |
|
} |
371 |
|
|
372 |
< |
std::set<IntTuple4, TorsionLessThan> allTorsions; |
373 |
< |
std::set<IntTuple4, TorsionLessThan>::iterator iter; |
372 |
> |
std::set<IntTuple4> allTorsions; |
373 |
> |
std::set<IntTuple4>::iterator iter; |
374 |
|
for(int i = 0; i < getNTorsions(); ++i) { |
375 |
|
TorsionStamp* torsionStamp= getTorsionStamp(i); |
376 |
|
std::vector<int> torsion = torsionStamp->getMembers(); |
407 |
|
AtomStamp::AtomIter ai2; |
408 |
|
AtomStamp::AtomIter ai3; |
409 |
|
|
410 |
< |
for(int a = atomB->getFirstBonedAtom(ai2);a != -1;a = atomB->getNextBonedAtom(ai2)) |
410 |
> |
for(int a = atomB->getFirstBondedAtom(ai2);a != -1;a = atomB->getNextBondedAtom(ai2)) |
411 |
|
{ |
412 |
|
if(a == c) |
413 |
|
continue; |
414 |
|
|
415 |
< |
for(int d = atomC->getFirstBonedAtom(ai3);d != -1;d = atomC->getNextBonedAtom(ai3)) |
415 |
> |
for(int d = atomC->getFirstBondedAtom(ai3);d != -1;d = atomC->getNextBondedAtom(ai3)) |
416 |
|
{ |
417 |
|
if(d == b) |
418 |
|
continue; |