18 |
|
|
19 |
|
void BaseAtomVisitor::setVisited(Atom* atom){ |
20 |
|
GenericData* data; |
21 |
< |
data = atom->getProperty("VISITED"); |
21 |
> |
data = atom->getPropertyByName("VISITED"); |
22 |
|
|
23 |
|
//if visited property is not existed, add it as new property |
24 |
|
if(data == NULL){ |
30 |
|
|
31 |
|
bool BaseAtomVisitor::isVisited(Atom* atom){ |
32 |
|
GenericData* data; |
33 |
< |
data = atom->getProperty("VISITED"); |
33 |
> |
data = atom->getPropertyByName("VISITED"); |
34 |
|
return data == NULL ? false : true; |
35 |
|
} |
36 |
|
|
55 |
|
Vector3d h2(0.0, 0.75695, 0.5206); |
56 |
|
Vector3d ox(0.0, 0.0, -0.0654); |
57 |
|
Vector3d u(0, 0, 1); |
58 |
< |
double rotMatrix[3][3]; |
59 |
< |
double rotTrans[3][3]; |
58 |
> |
RotMat3x3d rotMatrix; |
59 |
> |
RotMat3x3d rotTrans; |
60 |
|
AtomInfo* atomInfo; |
61 |
|
Vector3d pos; |
62 |
|
Vector3d newVec; |
69 |
|
if(!isSSDAtom(datom->getType())) |
70 |
|
return; |
71 |
|
|
72 |
< |
data = datom->getProperty("ATOMDATA"); |
72 |
> |
data = datom->getPropertyByName("ATOMDATA"); |
73 |
|
if(data != NULL){ |
74 |
|
|
75 |
|
atomData = dynamic_cast<AtomData*>(data); |
89 |
|
|
90 |
|
pos = datom->getPos(); |
91 |
|
q = datom->getQ(); |
92 |
< |
datom->getA(rotMatrix); |
92 |
> |
rotMatrix= datom->getA(); |
93 |
|
|
94 |
|
// We need A^T to convert from body-fixed to space-fixed: |
95 |
< |
transposeMat3(rotMatrix, rotTrans); |
95 |
> |
//transposeMat3(rotMatrix, rotTrans); |
96 |
> |
rotTrans = rotMatrix.transpose(); |
97 |
|
|
98 |
|
//center of mass of the water molecule |
99 |
< |
matVecMul3(rotTrans, u, newVec); |
99 |
> |
//matVecMul3(rotTrans, u, newVec); |
100 |
> |
newVec = rotTrans * u; |
101 |
> |
|
102 |
|
atomInfo = new AtomInfo; |
103 |
|
atomInfo->AtomType = "X"; |
104 |
|
atomInfo->pos[0] = pos[0]; |
111 |
|
atomData->addAtomInfo(atomInfo); |
112 |
|
|
113 |
|
//oxygen |
114 |
< |
matVecMul3(rotTrans, ox, newVec); |
114 |
> |
//matVecMul3(rotTrans, ox, newVec); |
115 |
> |
newVec = rotTrans * ox; |
116 |
> |
|
117 |
|
atomInfo = new AtomInfo; |
118 |
|
atomInfo->AtomType = "O"; |
119 |
|
atomInfo->pos[0] = pos[0] + newVec[0]; |
126 |
|
|
127 |
|
|
128 |
|
//hydrogen1 |
129 |
< |
matVecMul3(rotTrans, h1, newVec); |
129 |
> |
//matVecMul3(rotTrans, h1, newVec); |
130 |
> |
newVec = rotTrans * h1; |
131 |
|
atomInfo = new AtomInfo; |
132 |
|
atomInfo->AtomType = "H"; |
133 |
|
atomInfo->pos[0] = pos[0] + newVec[0]; |
139 |
|
atomData->addAtomInfo(atomInfo); |
140 |
|
|
141 |
|
//hydrogen2 |
142 |
< |
matVecMul3(rotTrans, h2, newVec); |
142 |
> |
//matVecMul3(rotTrans, h2, newVec); |
143 |
> |
newVec = rotTrans * h2; |
144 |
|
atomInfo = new AtomInfo; |
145 |
|
atomInfo->AtomType = "H"; |
146 |
|
atomInfo->pos[0] = pos[0] + newVec[0]; |
186 |
|
void DefaultAtomVisitor::visit(Atom* atom){ |
187 |
|
AtomData* atomData; |
188 |
|
AtomInfo* atomInfo; |
189 |
< |
double pos[3]; |
189 |
> |
Vector3d pos; |
190 |
|
|
191 |
|
if(isVisited(atom)) |
192 |
|
return; |
215 |
|
void DefaultAtomVisitor::visit(DirectionalAtom* datom){ |
216 |
|
AtomData* atomData; |
217 |
|
AtomInfo* atomInfo; |
218 |
< |
double pos[3]; |
219 |
< |
double u[3]; |
218 |
> |
Vector3d pos; |
219 |
> |
Vector3d u; |
220 |
|
|
221 |
|
if(isVisited(datom)) |
222 |
|
return; |
223 |
|
|
224 |
|
pos = datom->getPos(); |
225 |
< |
u = datom->getU(); |
225 |
> |
u = datom->getUnitVector(); |
226 |
|
|
227 |
|
atomData = new AtomData; |
228 |
|
atomData->setID("ATOMDATA"); |