16 |
|
|
17 |
|
Molecule::~Molecule( void ){ |
18 |
|
int i; |
19 |
+ |
CutoffGroup* cg; |
20 |
+ |
vector<CutoffGroup*>::iterator iter; |
21 |
|
|
22 |
|
if( myAtoms != NULL ){ |
23 |
|
for(i=0; i<nAtoms; i++) if(myAtoms[i] != NULL ) delete myAtoms[i]; |
39 |
|
delete[] myTorsions; |
40 |
|
} |
41 |
|
|
42 |
+ |
for(cg = beginCutoffGroup(iter); cg != NULL; cg = nextCutoffGroup(iter)) |
43 |
+ |
delete cg; |
44 |
+ |
myCutoffGroups.clear(); |
45 |
+ |
|
46 |
|
} |
47 |
|
|
48 |
|
|
61 |
|
nTorsions = theInit.nTorsions; |
62 |
|
nRigidBodies = theInit.nRigidBodies; |
63 |
|
nOriented = theInit.nOriented; |
58 |
– |
nCutoffGroups = theInit.nCutoffGroups; |
64 |
|
|
65 |
|
myAtoms = theInit.myAtoms; |
66 |
|
myBonds = theInit.myBonds; |
74 |
|
myRigidBodies[i]->calcRefCoords(); |
75 |
|
|
76 |
|
myCutoffGroups = theInit.myCutoffGroups; |
77 |
+ |
nCutoffGroups = myCutoffGroups.size(); |
78 |
|
|
79 |
< |
//creat a global index set of atoms which belong to cutoff group. |
74 |
< |
//it will be use to speed up the query whether an atom belongs to cutoff group or not |
75 |
< |
cutoffAtomSet.clear(); |
76 |
< |
|
77 |
< |
for(curCutoffGroup = beginCutoffGroup(iterCutoff); curCutoffGroup != NULL; |
78 |
< |
curCutoffGroup = nextCutoffGroup(iterCutoff)){ |
79 |
< |
|
80 |
< |
for(cutoffAtom = curCutoffGroup->beginAtom(iterAtom); cutoffAtom != NULL; |
81 |
< |
cutoffAtom = curCutoffGroup->nextAtom(iterAtom)){ |
82 |
< |
#ifdef IS_MPI |
83 |
< |
atomIndex = cutoffAtom->getGlobalIndex(); |
84 |
< |
#else |
85 |
< |
atomIndex = cutoffAtom->getIndex(); |
86 |
< |
#endif |
87 |
< |
cutoffAtomSet.insert(atomIndex); |
88 |
< |
}// end for(cutoffAtom) |
89 |
< |
}//end for(curCutoffGroup) |
79 |
> |
myConstraintPairs = theInit.myConstraintPairs; |
80 |
|
|
81 |
|
} |
82 |
|
|