130 |
|
|
131 |
|
void ZConsVisitor::visit(Atom* atom){ |
132 |
|
string prefix; |
133 |
< |
if(isZconstraint(atom->getIndex(), prefix)) |
133 |
> |
if(isZconstraint(atom->getLocalIndex(), prefix)) |
134 |
|
internalVisit(atom, prefix); |
135 |
|
} |
136 |
|
|
137 |
|
void ZConsVisitor::visit(DirectionalAtom* datom){ |
138 |
|
string prefix; |
139 |
|
|
140 |
< |
if(isZconstraint(datom->getIndex(), prefix)) |
140 |
> |
if(isZconstraint(datom->getLocalIndex(), prefix)) |
141 |
|
internalVisit(datom, prefix); |
142 |
|
} |
143 |
|
|
147 |
|
|
148 |
|
atoms = rb->getAtoms(); |
149 |
|
|
150 |
< |
if(isZconstraint(atoms[0]->getIndex(), prefix)) |
150 |
> |
if(isZconstraint(atoms[0]->getLocalIndex(), prefix)) |
151 |
|
internalVisit(rb, prefix); |
152 |
|
} |
153 |
|
|
155 |
|
Molecule* mols; |
156 |
|
mols = info->molecules; |
157 |
|
for(int i =0; i < info->n_mol; i++) |
158 |
< |
if(index == mols[i].getMyIndex()) |
158 |
> |
if(index == mols[i].getGlobalIndex()) |
159 |
|
return &mols[i]; |
160 |
|
|
161 |
|
return NULL; |
163 |
|
|
164 |
|
void ZConsVisitor::update(){ |
165 |
|
Molecule* mol; |
166 |
< |
double com[3]; |
166 |
> |
Vector3d com; |
167 |
|
ZConsState state; |
168 |
< |
Atom** atoms; |
169 |
< |
int natoms; |
168 |
> |
//Atom** atoms; |
169 |
> |
//int natoms; |
170 |
|
|
171 |
|
getZconsPos(info->currentTime); |
172 |
|
|
173 |
|
for(size_t i = 0; i < zconsMol.size(); i++){ |
174 |
< |
zconsMol[i]->getCOM(com); |
174 |
> |
com = zconsMol[i]->getCom(); |
175 |
|
|
176 |
|
if(fabs(com[2] - zconsPos[i]) < zconsTol) |
177 |
|
state = zsFixed; |
179 |
|
state = zsMoving; |
180 |
|
|
181 |
|
//update the state of zconstraint atom |
182 |
< |
natoms = zconsMol[i]->getNAtoms(); |
183 |
< |
atoms = zconsMol[i]->getMyAtoms(); |
184 |
< |
for(int j =0; j < natoms; j++) |
185 |
< |
zconsState[atoms[j]->getIndex()] = state; |
182 |
> |
//natoms = zconsMol[i]->getNAtoms(); |
183 |
> |
//atoms = zconsMol[i]->getMyAtoms(); |
184 |
> |
//for(int j =0; j < natoms; j++) |
185 |
> |
// zconsState[atoms[j]->getLocalIndex()] = state; |
186 |
> |
|
187 |
> |
std::vector<Atom*>::iterator j; |
188 |
> |
for (Atom* atom = zconsMol[i]->beginAtom(j); atom != NULL; atom = zconsMol[i]->nextAtom(j)) { |
189 |
> |
zconsState[atom->getLocalIndex()] = state; |
190 |
> |
} |
191 |
|
} |
192 |
|
|
193 |
|
} |
272 |
|
result += buffer; |
273 |
|
|
274 |
|
for(size_t i = 0; i < zconsMol.size(); ++i){ |
275 |
< |
sprintf(buffer ,"zconstraint molecule[%d] = %d\n", i, zconsMol[i]->getMyIndex()); |
275 |
> |
sprintf(buffer ,"zconstraint molecule[%d] = %d\n", i, zconsMol[i]->getGlobalIndex()); |
276 |
|
result += buffer; |
277 |
|
|
278 |
|
} |