| 35 |
|
* |
| 36 |
|
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
| 37 |
|
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
| 38 |
< |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
| 39 |
< |
* [4] Vardeman & Gezelter, in progress (2009). |
| 38 |
> |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). |
| 39 |
> |
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
| 40 |
> |
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
| 41 |
|
*/ |
| 42 |
|
#include "selection/SelectionManager.hpp" |
| 43 |
|
#include "visitors/OtherVisitor.hpp" |
| 45 |
|
#include "primitives/RigidBody.hpp" |
| 46 |
|
#include "primitives/Molecule.hpp" |
| 47 |
|
#include "brains/SimInfo.hpp" |
| 48 |
+ |
#include "brains/Thermo.hpp" |
| 49 |
+ |
|
| 50 |
|
namespace OpenMD { |
| 51 |
|
|
| 52 |
|
void WrappingVisitor::visit(Atom *atom) { |
| 79 |
|
|
| 80 |
|
Snapshot* currSnapshot = info->getSnapshotManager()->getCurrentSnapshot(); |
| 81 |
|
|
| 82 |
< |
for( atomInfo = atomData->beginAtomInfo(i); atomInfo; atomInfo = atomData->nextAtomInfo(i) ) { |
| 82 |
> |
for( atomInfo = atomData->beginAtomInfo(i); atomInfo; |
| 83 |
> |
atomInfo = atomData->nextAtomInfo(i) ) { |
| 84 |
> |
|
| 85 |
|
Vector3d newPos = atomInfo->pos - origin_; |
| 86 |
|
currSnapshot->wrapVector(newPos); |
| 87 |
|
atomInfo->pos = newPos; |
| 88 |
+ |
|
| 89 |
|
} |
| 90 |
|
} |
| 91 |
|
|
| 92 |
|
void WrappingVisitor::update() { |
| 93 |
|
if (useCom_){ |
| 94 |
< |
origin_ = info->getCom(); |
| 94 |
> |
Thermo thermo(info); |
| 95 |
> |
origin_ = thermo.getCom(); |
| 96 |
|
} |
| 97 |
|
} |
| 98 |
|
|
| 121 |
|
//----------------------------------------------------------------------------// |
| 122 |
|
|
| 123 |
|
ReplicateVisitor::ReplicateVisitor(SimInfo *info, Vector3i opt) : |
| 124 |
< |
BaseVisitor() { |
| 124 |
> |
BaseVisitor(), replicateOpt(opt) { |
| 125 |
|
this->info = info; |
| 126 |
|
visitorName = "ReplicateVisitor"; |
| 120 |
– |
this->replicateOpt = opt; |
| 127 |
|
|
| 128 |
|
//generate the replicate directions |
| 129 |
|
for( int i = 0; i <= replicateOpt[0]; i++ ) { |
| 184 |
|
std::vector<AtomInfo *>::iterator i; |
| 185 |
|
|
| 186 |
|
for( dirIter = dir.begin(); dirIter != dir.end(); ++dirIter ) { |
| 187 |
< |
for( i = infoList.begin(); i != infoList.end(); i++ ) { |
| 187 |
> |
for( i = infoList.begin(); i != infoList.end(); ++i ) { |
| 188 |
|
newAtomInfo = new AtomInfo(); |
| 189 |
|
*newAtomInfo = *(*i); |
| 190 |
|
|
| 199 |
|
const std::string ReplicateVisitor::toString() { |
| 200 |
|
char buffer[65535]; |
| 201 |
|
std::string result; |
| 196 |
– |
std::set<std::string>::iterator i; |
| 202 |
|
|
| 203 |
+ |
|
| 204 |
|
sprintf(buffer, |
| 205 |
< |
"------------------------------------------------------------------\n"); |
| 205 |
> |
"--------------------------------------------------------------\n"); |
| 206 |
|
result += buffer; |
| 207 |
|
|
| 208 |
|
sprintf(buffer, "Visitor name: %s\n", visitorName.c_str()); |
| 223 |
|
result += buffer; |
| 224 |
|
|
| 225 |
|
sprintf(buffer, |
| 226 |
< |
"------------------------------------------------------------------\n"); |
| 226 |
> |
"--------------------------------------------------------------\n"); |
| 227 |
|
result += buffer; |
| 228 |
|
|
| 229 |
|
return result; |
| 235 |
|
evaluator(info), doPositions_(true), |
| 236 |
|
doVelocities_(false), |
| 237 |
|
doForces_(false), doVectors_(false), |
| 238 |
< |
doCharges_(false) { |
| 238 |
> |
doCharges_(false), |
| 239 |
> |
doElectricFields_(false) { |
| 240 |
|
this->info = info; |
| 241 |
|
visitorName = "XYZVisitor"; |
| 242 |
|
|
| 250 |
|
XYZVisitor::XYZVisitor(SimInfo *info, const std::string& script) : |
| 251 |
|
BaseVisitor(), seleMan(info), evaluator(info), doPositions_(true), |
| 252 |
|
doVelocities_(false), doForces_(false), doVectors_(false), |
| 253 |
< |
doCharges_(false) { |
| 253 |
> |
doCharges_(false), doElectricFields_(false) { |
| 254 |
|
|
| 255 |
|
this->info = info; |
| 256 |
|
visitorName = "XYZVisitor"; |
| 333 |
|
atomInfo->frc[1], atomInfo->frc[2]); |
| 334 |
|
line += buffer; |
| 335 |
|
} |
| 336 |
+ |
if (doElectricFields_ && atomInfo->hasElectricField) { |
| 337 |
+ |
sprintf(buffer, "%15.8f%15.8f%15.8f", atomInfo->eField[0], |
| 338 |
+ |
atomInfo->eField[1], atomInfo->eField[2]); |
| 339 |
+ |
line += buffer; |
| 340 |
+ |
} |
| 341 |
|
frame.push_back(line); |
| 342 |
|
} |
| 343 |
|
} |
| 350 |
|
std::vector<std::string>::iterator i; |
| 351 |
|
char buffer[1024]; |
| 352 |
|
|
| 353 |
< |
if (frame.size() == 0) |
| 353 |
> |
if (frame.empty()) |
| 354 |
|
std::cerr << "Current Frame does not contain any atoms" << std::endl; |
| 355 |
|
|
| 356 |
|
//total number of atoms |
| 403 |
|
|
| 404 |
|
void PrepareVisitor::internalVisit(Atom *atom) { |
| 405 |
|
GenericData *data; |
| 394 |
– |
AtomData * atomData; |
| 406 |
|
|
| 407 |
|
//if visited property is existed, remove it |
| 408 |
|
data = atom->getPropertyByName("VISITED"); |
| 415 |
|
data = atom->getPropertyByName("ATOMDATA"); |
| 416 |
|
|
| 417 |
|
if (data != NULL) { |
| 418 |
< |
atomData = dynamic_cast<AtomData *>(data); |
| 418 |
> |
AtomData* atomData = dynamic_cast<AtomData *>(data); |
| 419 |
|
|
| 420 |
|
if (atomData != NULL) |
| 421 |
|
atom->removeProperty("ATOMDATA"); |
| 490 |
|
std::string rbName; |
| 491 |
|
std::vector<Atom *> myAtoms; |
| 492 |
|
std::vector<Atom *>::iterator atomIter; |
| 493 |
< |
GenericData* data; |
| 493 |
> |
std::vector<AtomInfo *>::iterator i; |
| 494 |
|
AtomData* atomData; |
| 484 |
– |
AtomInfo* atomInfo; |
| 485 |
– |
std::vector<AtomInfo *>::iterator i; |
| 495 |
|
|
| 496 |
|
rbName = rb->getType(); |
| 497 |
|
|
| 498 |
|
if (waterTypeList.find(rbName) != waterTypeList.end()) { |
| 499 |
|
myAtoms = rb->getAtoms(); |
| 500 |
< |
|
| 500 |
> |
|
| 501 |
|
for( atomIter = myAtoms.begin(); atomIter != myAtoms.end(); |
| 502 |
|
++atomIter ) { |
| 503 |
< |
data = (*atomIter)->getPropertyByName("ATOMDATA"); |
| 503 |
> |
GenericData* data = (*atomIter)->getPropertyByName("ATOMDATA"); |
| 504 |
|
|
| 505 |
|
if (data != NULL) { |
| 506 |
|
atomData = dynamic_cast<AtomData *>(data); |
| 510 |
|
} else |
| 511 |
|
continue; |
| 512 |
|
|
| 513 |
< |
for( atomInfo = atomData->beginAtomInfo(i); atomInfo; |
| 513 |
> |
for( AtomInfo* atomInfo = atomData->beginAtomInfo(i); atomInfo; |
| 514 |
|
atomInfo = atomData->nextAtomInfo(i) ) { |
| 515 |
|
atomInfo->atomTypeName = trimmedName(atomInfo->atomTypeName); |
| 516 |
< |
} //end for(atomInfo) |
| 517 |
< |
} //end for(atomIter) |
| 518 |
< |
} //end if (waterTypeList.find(rbName) != waterTypeList.end()) |
| 516 |
> |
} |
| 517 |
> |
} |
| 518 |
> |
} |
| 519 |
|
} |
| 520 |
|
|
| 521 |
|
std::string WaterTypeVisitor::trimmedName(const std::string&atomTypeName) { |