ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/src/types/MoleculeStamp.cpp
(Generate patch)

Comparing trunk/OOPSE-3.0/src/types/MoleculeStamp.cpp (file contents):
Revision 2493 by tim, Tue Dec 6 21:01:08 2005 UTC vs.
Revision 2543 by gezelter, Wed Jan 11 18:41:01 2006 UTC

# Line 44 | Line 44
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>
# Line 77 | Line 77 | MoleculeStamp::~MoleculeStamp() {
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) {
# Line 201 | Line 207 | void MoleculeStamp::checkBonds() {
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) {
# Line 257 | Line 255 | void MoleculeStamp::checkBends() {
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();
# Line 306 | Line 304 | void MoleculeStamp::checkBends() {
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;          
# Line 325 | Line 323 | void MoleculeStamp::checkBends() {
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;          
# Line 344 | Line 342 | void MoleculeStamp::checkBends() {
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);
# Line 385 | Line 369 | void MoleculeStamp::checkTorsions() {
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();
# Line 423 | Line 407 | void MoleculeStamp::checkTorsions() {
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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines