--- trunk/OOPSE-4/src/visitors/OtherVisitor.cpp 2007/01/16 22:18:04 3116 +++ 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 @@ -290,30 +289,56 @@ namespace oopse { return; } else return; + + AtomType* at = dynamic_cast(sd)->getAtomType(); + std::string bn = baseTypeName(at); if (posOnly_){ for( atomInfo = atomData->beginAtomInfo(i); atomInfo; atomInfo = atomData->nextAtomInfo(i) ) { - sprintf(buffer, + 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", - atomInfo->atomTypeName.c_str(), - atomInfo->pos[0], - atomInfo->pos[1], - atomInfo->pos[2]); + 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", - atomInfo->atomTypeName.c_str(), + 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); } } @@ -350,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;