12 |
|
myBonds = NULL; |
13 |
|
myBends = NULL; |
14 |
|
myTorsions = NULL; |
15 |
– |
hasMassRatio = false; |
15 |
|
} |
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 |
|
|
49 |
|
void Molecule::initialize( molInit &theInit ){ |
50 |
|
|
51 |
+ |
CutoffGroup* curCutoffGroup; |
52 |
+ |
vector<CutoffGroup*>::iterator iterCutoff; |
53 |
+ |
Atom* cutoffAtom; |
54 |
+ |
vector<Atom*>::iterator iterAtom; |
55 |
+ |
int atomIndex; |
56 |
+ |
|
57 |
|
nAtoms = theInit.nAtoms; |
58 |
|
nMembers = nAtoms; |
59 |
|
nBonds = theInit.nBonds; |
73 |
|
for (int i = 0; i < myRigidBodies.size(); i++) |
74 |
|
myRigidBodies[i]->calcRefCoords(); |
75 |
|
|
76 |
+ |
myCutoffGroups = theInit.myCutoffGroups; |
77 |
+ |
nCutoffGroups = myCutoffGroups.size(); |
78 |
+ |
|
79 |
+ |
myConstraintPairs = theInit.myConstraintPairs; |
80 |
+ |
|
81 |
|
} |
82 |
|
|
83 |
|
void Molecule::calcForces( void ){ |
89 |
|
myRigidBodies[i]->updateAtoms(); |
90 |
|
} |
91 |
|
|
76 |
– |
//the mass ratio will never change during the simulation. Thus, we could |
77 |
– |
//just calculate it at the begining of the simulation |
78 |
– |
if (!hasMassRatio){ |
79 |
– |
double totMass = getTotalMass(); |
80 |
– |
for(int i = 0; i < nAtoms; i ++) |
81 |
– |
myAtoms[i]->setMassRatio(myAtoms[i]->getMass()/totMass); |
82 |
– |
hasMassRatio = true; |
83 |
– |
} |
84 |
– |
|
92 |
|
//calculate the center of mass of the molecule |
93 |
< |
getCOM(com); |
94 |
< |
for(int i = 0; i < nAtoms; i ++) |
95 |
< |
myAtoms[i]->setRc(com); |
93 |
> |
//getCOM(com); |
94 |
> |
//for(int i = 0; i < nAtoms; i ++) |
95 |
> |
// myAtoms[i]->setRc(com); |
96 |
|
|
97 |
|
|
98 |
|
for(i=0; i<nBonds; i++){ |