44#include "visitors/AtomNameVisitor.hpp"
54 AtomNameVisitor::AtomNameVisitor(SimInfo* info) : BaseVisitor(), info_(info) {
55 visitorName =
"AtomNameVisitor";
56 ff_ = info_->getForceField();
59 void AtomNameVisitor::visitAtom(Atom* atom) {
60 std::shared_ptr<AtomData> atomData;
61 std::shared_ptr<GenericData> data = atom->getPropertyByName(
"ATOMDATA");
63 if (data !=
nullptr) {
64 atomData = std::dynamic_pointer_cast<AtomData>(data);
65 if (atomData ==
nullptr) {
66 std::cerr <<
"can not get Atom Data from " << atom->getType()
68 atomData = std::make_shared<AtomData>();
71 atomData = std::make_shared<AtomData>();
74 std::vector<std::shared_ptr<AtomInfo>>::iterator i;
75 for (std::shared_ptr<AtomInfo> atomInfo = atomData->beginAtomInfo(i);
76 atomInfo !=
nullptr; atomInfo = atomData->nextAtomInfo(i)) {
79 AtomType* at = ff_->getAtomType(atomInfo->atomTypeName);
81 std::vector<AtomType*> ayb = at->allYourBase();
83 std::string bn = ayb[ayb.size() - 1]->getName();
85 atomInfo->atomTypeName = bn;
89 void AtomNameVisitor::visit(RigidBody* rb) {
90 std::vector<Atom*>::iterator i;
92 for (Atom* atom = rb->beginAtom(i); atom != NULL; atom = rb->nextAtom(i)) {
97 const std::string AtomNameVisitor::toString() {
103 "------------------------------------------------------------------\n");
106 snprintf(buffer, 65535,
"Visitor name: %s\n", visitorName.c_str());
109 snprintf(buffer, 65535,
"Visitor Description: print base atom types\n");
114 "------------------------------------------------------------------\n");
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.