1 |
< |
/* |
1 |
> |
/* |
2 |
|
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
|
* |
4 |
|
* The University of Notre Dame grants you ("Licensee") a |
94 |
|
RigidBodyStamp* rbStamp; |
95 |
|
int nAtoms; |
96 |
|
int nRigidBodies; |
97 |
< |
std::vector<double> mass; |
97 |
> |
std::vector<RealType> mass; |
98 |
|
Vector3d coor; |
99 |
|
Vector3d refMolCom; |
100 |
|
int nAtomsInRb; |
101 |
< |
double totMassInRb; |
102 |
< |
double currAtomMass; |
103 |
< |
double molMass; |
101 |
> |
RealType totMassInRb; |
102 |
> |
RealType currAtomMass; |
103 |
> |
RealType molMass; |
104 |
|
|
105 |
|
nAtoms= myStamp->getNAtoms(); |
106 |
|
nRigidBodies = myStamp->getNRigidBodies(); |
107 |
|
|
108 |
|
for(size_t i=0; i<nAtoms; i++){ |
109 |
|
|
110 |
< |
currAtomStamp = myStamp->getAtom(i); |
110 |
> |
currAtomStamp = myStamp->getAtomStamp(i); |
111 |
|
|
112 |
|
if( !currAtomStamp->havePosition() ){ |
113 |
|
sprintf( painCave.errMsg, |
114 |
|
"MoLocator error.\n" |
115 |
|
" Component %s, atom %s does not have a position specified.\n" |
116 |
|
" This means MoLocator cannot initalize it's position.\n", |
117 |
< |
myStamp->getID(), |
118 |
< |
currAtomStamp->getType() ); |
117 |
> |
myStamp->getName().c_str(), |
118 |
> |
currAtomStamp->getType().c_str()); |
119 |
|
|
120 |
|
painCave.isFatal = 1; |
121 |
|
simError(); |
138 |
|
|
139 |
|
for(int i = 0; i < nRigidBodies; i++){ |
140 |
|
|
141 |
< |
rbStamp = myStamp->getRigidBody(i); |
141 |
> |
rbStamp = myStamp->getRigidBodyStamp(i); |
142 |
|
nAtomsInRb = rbStamp->getNMembers(); |
143 |
|
|
144 |
|
coor.x() = 0.0; |
148 |
|
|
149 |
|
for(int j = 0; j < nAtomsInRb; j++){ |
150 |
|
|
151 |
< |
currAtomStamp = myStamp->getAtom(rbStamp->getMember(j)); |
151 |
> |
currAtomStamp = myStamp->getAtomStamp(rbStamp->getMemberAt(j)); |
152 |
|
currAtomMass = getAtomMass(currAtomStamp->getType(), myFF); |
153 |
|
totMassInRb += currAtomMass; |
154 |
|
|
178 |
|
|
179 |
|
//move the reference center of mass to (0,0,0) and adjust the reference coordinate |
180 |
|
//of the integrabel objects |
181 |
< |
for(int i = 0; i < nIntegrableObjects; i++) |
182 |
< |
refCoords[i] -= refMolCom; |
181 |
> |
for(int i = 0; i < nIntegrableObjects; i++) |
182 |
> |
refCoords[i] -= refMolCom; |
183 |
|
} |
184 |
|
|
185 |
< |
double getAtomMass(const std::string& at, ForceField* myFF) { |
186 |
< |
double mass; |
185 |
> |
RealType getAtomMass(const std::string& at, ForceField* myFF) { |
186 |
> |
RealType mass; |
187 |
|
AtomType* atomType= myFF->getAtomType(at); |
188 |
|
if (atomType != NULL) { |
189 |
|
mass = atomType->getMass(); |
194 |
|
return mass; |
195 |
|
} |
196 |
|
|
197 |
< |
double getMolMass(MoleculeStamp *molStamp, ForceField *myFF) { |
197 |
> |
RealType getMolMass(MoleculeStamp *molStamp, ForceField *myFF) { |
198 |
|
int nAtoms; |
199 |
< |
double totMass = 0; |
199 |
> |
RealType totMass = 0; |
200 |
|
nAtoms = molStamp->getNAtoms(); |
201 |
|
|
202 |
|
for(size_t i = 0; i < nAtoms; i++) { |
203 |
< |
AtomStamp *currAtomStamp = molStamp->getAtom(i); |
203 |
> |
AtomStamp *currAtomStamp = molStamp->getAtomStamp(i); |
204 |
|
totMass += getAtomMass(currAtomStamp->getType(), myFF); |
205 |
|
} |
206 |
|
return totMass; |
207 |
|
} |
208 |
|
RotMat3x3d latVec2RotMat(const Vector3d& lv){ |
209 |
|
|
210 |
< |
double theta =acos(lv[2]); |
211 |
< |
double phi = atan2(lv[1], lv[0]); |
212 |
< |
double psi = 0; |
210 |
> |
RealType theta =acos(lv[2]); |
211 |
> |
RealType phi = atan2(lv[1], lv[0]); |
212 |
> |
RealType psi = 0; |
213 |
|
|
214 |
|
return RotMat3x3d(phi, theta, psi); |
215 |
|
|