--- trunk/OOPSE-4/src/visitors/OtherVisitor.cpp 2005/04/15 22:04:00 2204 +++ trunk/OOPSE-4/src/visitors/OtherVisitor.cpp 2008/09/10 19:51:45 3446 @@ -5,7 +5,6 @@ * non-exclusive, royalty free, license to use, modify and * redistribute this software in source and binary code form, provided * that the following conditions are met: - * * 1. Acknowledgement of the program authors must be made in any * publication of scientific results based in part on use of the * program. An acceptable form of acknowledgement is citation of @@ -77,10 +76,18 @@ namespace oopse { Snapshot* currSnapshot = info->getSnapshotManager()->getCurrentSnapshot(); for( atomInfo = atomData->beginAtomInfo(i); atomInfo; atomInfo = atomData->nextAtomInfo(i) ) { - currSnapshot->wrapVector(atomInfo->pos); + Vector3d newPos = atomInfo->pos - origin_; + currSnapshot->wrapVector(newPos); + atomInfo->pos = newPos; } } + void WrappingVisitor::update() { + if (useCom_){ + origin_ = info->getCom(); + } + } + const std::string WrappingVisitor::toString() { char buffer[65535]; std::string result; @@ -227,7 +234,7 @@ namespace oopse { if (!evaluator.isDynamic()) { seleMan.setSelectionSet(evaluator.evaluate()); } - + posOnly_ = false; } XYZVisitor::XYZVisitor(SimInfo *info, const std::string& script) : @@ -240,7 +247,7 @@ namespace oopse { if (!evaluator.isDynamic()) { seleMan.setSelectionSet(evaluator.evaluate()); } - + posOnly_ = false; } void XYZVisitor::visit(Atom *atom) { @@ -283,18 +290,57 @@ namespace oopse { } else return; - for( atomInfo = atomData->beginAtomInfo(i); atomInfo; - atomInfo = atomData->nextAtomInfo(i) ) { - sprintf(buffer, - "%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f", - atomInfo->atomTypeName.c_str(), - atomInfo->pos[0], - atomInfo->pos[1], - atomInfo->pos[2], - atomInfo->dipole[0], - atomInfo->dipole[1], - atomInfo->dipole[2]); - frame.push_back(buffer); + AtomType* at = dynamic_cast(sd)->getAtomType(); + std::string bn = baseTypeName(at); + + if (posOnly_){ + for( atomInfo = atomData->beginAtomInfo(i); atomInfo; + atomInfo = atomData->nextAtomInfo(i) ) { + if (atomInfo->hasCharge) { + sprintf(buffer, + "%s%15.8f%15.8f%15.8f%15.8f", + bn.c_str(), + atomInfo->pos[0], + atomInfo->pos[1], + atomInfo->pos[2], + atomInfo->charge); + } else { + sprintf(buffer, + "%s%15.8f%15.8f%15.8f", + bn.c_str(), + atomInfo->pos[0], + atomInfo->pos[1], + atomInfo->pos[2]); + } + frame.push_back(buffer); + } + }else{ + for( atomInfo = atomData->beginAtomInfo(i); atomInfo; + atomInfo = atomData->nextAtomInfo(i) ) { + if (atomInfo->hasCharge) { + sprintf(buffer, + "%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f", + bn.c_str(), + atomInfo->pos[0], + atomInfo->pos[1], + atomInfo->pos[2], + atomInfo->charge, + atomInfo->dipole[0], + atomInfo->dipole[1], + atomInfo->dipole[2]); + } else { + sprintf(buffer, + "%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f", + bn.c_str(), + atomInfo->pos[0], + atomInfo->pos[1], + atomInfo->pos[2], + atomInfo->dipole[0], + atomInfo->dipole[1], + atomInfo->dipole[2]); + } + frame.push_back(buffer); + } } } @@ -329,6 +375,15 @@ namespace oopse { outStream << *i << std::endl; } + std::string XYZVisitor::trimmedName(const std::string&atomTypeName) { + return atomTypeName.substr(0, atomTypeName.find('-')); + } + + std::string XYZVisitor::baseTypeName(AtomType* at) { + std::vector ayb = at->allYourBase(); + return ayb[ayb.size()-1]->getName(); + } + const std::string XYZVisitor::toString() { char buffer[65535]; std::string result;