12 |
|
myBonds = NULL; |
13 |
|
myBends = NULL; |
14 |
|
myTorsions = NULL; |
15 |
– |
|
15 |
|
} |
16 |
|
|
17 |
|
Molecule::~Molecule( void ){ |
42 |
|
|
43 |
|
void Molecule::initialize( molInit &theInit ){ |
44 |
|
|
45 |
+ |
CutoffGroup* curCutoffGroup; |
46 |
+ |
vector<CutoffGroup*>::iterator iterCutoff; |
47 |
+ |
Atom* cutoffAtom; |
48 |
+ |
vector<Atom*>::iterator iterAtom; |
49 |
+ |
int atomIndex; |
50 |
+ |
|
51 |
|
nAtoms = theInit.nAtoms; |
52 |
|
nMembers = nAtoms; |
53 |
|
nBonds = theInit.nBonds; |
55 |
|
nTorsions = theInit.nTorsions; |
56 |
|
nRigidBodies = theInit.nRigidBodies; |
57 |
|
nOriented = theInit.nOriented; |
58 |
+ |
nCutoffGroups = theInit.nCutoffGroups; |
59 |
|
|
60 |
|
myAtoms = theInit.myAtoms; |
61 |
|
myBonds = theInit.myBonds; |
67 |
|
|
68 |
|
for (int i = 0; i < myRigidBodies.size(); i++) |
69 |
|
myRigidBodies[i]->calcRefCoords(); |
70 |
< |
|
70 |
> |
|
71 |
> |
myCutoffGroups = theInit.myCutoffGroups; |
72 |
> |
|
73 |
> |
//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) |
90 |
> |
|
91 |
|
} |
92 |
|
|
93 |
|
void Molecule::calcForces( void ){ |
94 |
|
|
95 |
|
int i; |
96 |
+ |
double com[3]; |
97 |
|
|
98 |
|
for(i=0; i<myRigidBodies.size(); i++) { |
99 |
|
myRigidBodies[i]->updateAtoms(); |
100 |
|
} |
101 |
|
|
102 |
+ |
//calculate the center of mass of the molecule |
103 |
+ |
//getCOM(com); |
104 |
+ |
//for(int i = 0; i < nAtoms; i ++) |
105 |
+ |
// myAtoms[i]->setRc(com); |
106 |
+ |
|
107 |
+ |
|
108 |
|
for(i=0; i<nBonds; i++){ |
109 |
|
myBonds[i]->calc_forces(); |
110 |
|
} |