5 |
|
* non-exclusive, royalty free, license to use, modify and |
6 |
|
* redistribute this software in source and binary code form, provided |
7 |
|
* that the following conditions are met: |
8 |
– |
* |
8 |
|
* 1. Acknowledgement of the program authors must be made in any |
9 |
|
* publication of scientific results based in part on use of the |
10 |
|
* program. An acceptable form of acknowledgement is citation of |
76 |
|
Snapshot* currSnapshot = info->getSnapshotManager()->getCurrentSnapshot(); |
77 |
|
|
78 |
|
for( atomInfo = atomData->beginAtomInfo(i); atomInfo; atomInfo = atomData->nextAtomInfo(i) ) { |
79 |
< |
currSnapshot->wrapVector(atomInfo->pos); |
79 |
> |
Vector3d newPos = atomInfo->pos - origin_; |
80 |
> |
currSnapshot->wrapVector(newPos); |
81 |
> |
atomInfo->pos = newPos; |
82 |
|
} |
83 |
|
} |
84 |
|
|
85 |
+ |
void WrappingVisitor::update() { |
86 |
+ |
if (useCom_){ |
87 |
+ |
origin_ = info->getCom(); |
88 |
+ |
} |
89 |
+ |
} |
90 |
+ |
|
91 |
|
const std::string WrappingVisitor::toString() { |
92 |
|
char buffer[65535]; |
93 |
|
std::string result; |
234 |
|
if (!evaluator.isDynamic()) { |
235 |
|
seleMan.setSelectionSet(evaluator.evaluate()); |
236 |
|
} |
237 |
< |
|
237 |
> |
posOnly_ = false; |
238 |
|
} |
239 |
|
|
240 |
|
XYZVisitor::XYZVisitor(SimInfo *info, const std::string& script) : |
247 |
|
if (!evaluator.isDynamic()) { |
248 |
|
seleMan.setSelectionSet(evaluator.evaluate()); |
249 |
|
} |
250 |
< |
|
250 |
> |
posOnly_ = false; |
251 |
|
} |
252 |
|
|
253 |
|
void XYZVisitor::visit(Atom *atom) { |
290 |
|
} else |
291 |
|
return; |
292 |
|
|
293 |
< |
for( atomInfo = atomData->beginAtomInfo(i); atomInfo; |
294 |
< |
atomInfo = atomData->nextAtomInfo(i) ) { |
295 |
< |
sprintf(buffer, |
296 |
< |
"%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f", |
297 |
< |
atomInfo->atomTypeName.c_str(), |
298 |
< |
atomInfo->pos[0], |
299 |
< |
atomInfo->pos[1], |
300 |
< |
atomInfo->pos[2], |
301 |
< |
atomInfo->dipole[0], |
302 |
< |
atomInfo->dipole[1], |
303 |
< |
atomInfo->dipole[2]); |
304 |
< |
frame.push_back(buffer); |
293 |
> |
AtomType* at = dynamic_cast<Atom *>(sd)->getAtomType(); |
294 |
> |
std::string bn = baseTypeName(at); |
295 |
> |
|
296 |
> |
if (posOnly_){ |
297 |
> |
for( atomInfo = atomData->beginAtomInfo(i); atomInfo; |
298 |
> |
atomInfo = atomData->nextAtomInfo(i) ) { |
299 |
> |
if (atomInfo->hasCharge) { |
300 |
> |
sprintf(buffer, |
301 |
> |
"%s%15.8f%15.8f%15.8f%15.8f", |
302 |
> |
bn.c_str(), |
303 |
> |
atomInfo->pos[0], |
304 |
> |
atomInfo->pos[1], |
305 |
> |
atomInfo->pos[2], |
306 |
> |
atomInfo->charge); |
307 |
> |
} else { |
308 |
> |
sprintf(buffer, |
309 |
> |
"%s%15.8f%15.8f%15.8f", |
310 |
> |
bn.c_str(), |
311 |
> |
atomInfo->pos[0], |
312 |
> |
atomInfo->pos[1], |
313 |
> |
atomInfo->pos[2]); |
314 |
> |
} |
315 |
> |
frame.push_back(buffer); |
316 |
> |
} |
317 |
> |
}else{ |
318 |
> |
for( atomInfo = atomData->beginAtomInfo(i); atomInfo; |
319 |
> |
atomInfo = atomData->nextAtomInfo(i) ) { |
320 |
> |
if (atomInfo->hasCharge) { |
321 |
> |
sprintf(buffer, |
322 |
> |
"%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f", |
323 |
> |
bn.c_str(), |
324 |
> |
atomInfo->pos[0], |
325 |
> |
atomInfo->pos[1], |
326 |
> |
atomInfo->pos[2], |
327 |
> |
atomInfo->charge, |
328 |
> |
atomInfo->dipole[0], |
329 |
> |
atomInfo->dipole[1], |
330 |
> |
atomInfo->dipole[2]); |
331 |
> |
} else { |
332 |
> |
sprintf(buffer, |
333 |
> |
"%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f", |
334 |
> |
bn.c_str(), |
335 |
> |
atomInfo->pos[0], |
336 |
> |
atomInfo->pos[1], |
337 |
> |
atomInfo->pos[2], |
338 |
> |
atomInfo->dipole[0], |
339 |
> |
atomInfo->dipole[1], |
340 |
> |
atomInfo->dipole[2]); |
341 |
> |
} |
342 |
> |
frame.push_back(buffer); |
343 |
> |
} |
344 |
|
} |
345 |
|
} |
346 |
|
|
375 |
|
outStream << *i << std::endl; |
376 |
|
} |
377 |
|
|
378 |
+ |
std::string XYZVisitor::trimmedName(const std::string&atomTypeName) { |
379 |
+ |
return atomTypeName.substr(0, atomTypeName.find('-')); |
380 |
+ |
} |
381 |
+ |
|
382 |
+ |
std::string XYZVisitor::baseTypeName(AtomType* at) { |
383 |
+ |
std::vector<AtomType*> ayb = at->allYourBase(); |
384 |
+ |
return ayb[ayb.size()-1]->getName(); |
385 |
+ |
} |
386 |
+ |
|
387 |
|
const std::string XYZVisitor::toString() { |
388 |
|
char buffer[65535]; |
389 |
|
std::string result; |