45#include "visitors/AtomVisitor.hpp"
52#include "types/FixedChargeAdapter.hpp"
53#include "types/FluctuatingChargeAdapter.hpp"
54#include "types/GayBerneAdapter.hpp"
55#include "types/MultipoleAdapter.hpp"
73 void BaseAtomVisitor::setVisited(
Atom* atom) {
74 std::shared_ptr<GenericData> data;
78 if (data ==
nullptr) {
79 data = std::make_shared<GenericData>();
80 data->setID(
"VISITED");
85 bool BaseAtomVisitor::isVisited(
Atom* atom) {
86 std::shared_ptr<GenericData> data;
88 return data ==
nullptr ? false :
true;
93 void DefaultAtomVisitor::visit(
Atom* atom) {
94 std::shared_ptr<AtomData> atomData;
95 std::shared_ptr<AtomInfo> atomInfo;
98 if (isVisited(atom))
return;
100 atomInfo = std::make_shared<AtomInfo>();
101 atomInfo->atomTypeName = atom->
getType();
103 atomInfo->pos = atom->
getPos();
104 atomInfo->vel = atom->
getVel();
105 atomInfo->frc = atom->
getFrc();
106 atomInfo->vec = V3Zero;
107 atomInfo->hasVelocity =
true;
108 atomInfo->hasForce =
true;
109 atomInfo->hasGlobalID =
true;
112 if (fca.isFixedCharge()) {
113 atomInfo->hasCharge =
true;
114 atomInfo->charge = fca.getCharge();
118 if (fqa.isFluctuatingCharge()) {
119 atomInfo->hasCharge =
true;
123 if ((storageLayout_ & DataStorage::dslElectricField) &&
124 (atype->isElectrostatic())) {
125 atomInfo->hasElectricField =
true;
129 atomData = std::make_shared<AtomData>();
130 atomData->setID(
"ATOMDATA");
131 atomData->addAtomInfo(atomInfo);
139 std::shared_ptr<AtomData> atomData;
140 std::shared_ptr<AtomInfo> atomInfo;
143 if (isVisited(datom))
return;
145 atomInfo = std::make_shared<AtomInfo>();
146 atomInfo->atomTypeName = datom->
getType();
148 atomInfo->pos = datom->
getPos();
149 atomInfo->vel = datom->
getVel();
150 atomInfo->frc = datom->
getFrc();
151 atomInfo->hasVelocity =
true;
152 atomInfo->hasForce =
true;
153 atomInfo->hasGlobalID =
true;
156 if (fca.isFixedCharge()) {
157 atomInfo->hasCharge =
true;
158 atomInfo->charge = fca.getCharge();
162 if (fqa.isFluctuatingCharge()) {
163 atomInfo->hasCharge =
true;
167 if ((storageLayout_ & DataStorage::dslElectricField) &&
168 (atype->isElectrostatic())) {
169 atomInfo->hasElectricField =
true;
176 if (gba.isGayBerne()) {
177 atomInfo->hasVector =
true;
178 atomInfo->vec = datom->
getA().transpose() * V3Z;
179 }
else if (ma.isDipole()) {
180 atomInfo->hasVector =
true;
182 }
else if (ma.isQuadrupole()) {
183 atomInfo->hasVector =
true;
184 atomInfo->vec = datom->
getA().transpose() * V3Z;
187 atomData = std::make_shared<AtomData>();
188 atomData->setID(
"ATOMDATA");
189 atomData->addAtomInfo(atomInfo);
196 const std::string DefaultAtomVisitor::toString() {
202 "--------------------------------------------------------------\n");
205 snprintf(buffer, 65535,
"Visitor name: %s\n", visitorName.c_str());
208 snprintf(buffer, 65535,
209 "Visitor Description: copy atom infomation into atom data\n");
214 "--------------------------------------------------------------\n");
virtual std::string getType()
Returns the name of this stuntDouble.
AtomType * getAtomType()
Returns the AtomType of this Atom.
AtomType is what OpenMD looks to for unchanging data about an atom.
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
int getAtomStorageLayout()
Returns the storage layouts (computed by SimCreator)
RotMat3x3d getA()
Returns the current rotation matrix of this stuntDouble.
Vector3d getVel()
Returns the current velocity of this stuntDouble.
std::shared_ptr< GenericData > getPropertyByName(const std::string &propName)
Returns property.
void addProperty(std::shared_ptr< GenericData > genData)
Adds property into property map.
Vector3d getPos()
Returns the current position of this stuntDouble.
RealType getFlucQPos()
Returns the current fluctuating charge of this stuntDouble.
Vector3d getDipole()
Returns the current dipole vector of this stuntDouble.
Vector3d getElectricField()
Returns the current electric field of this stuntDouble.
int getGlobalIndex()
Returns the global index of this stuntDouble.
Vector3d getFrc()
Returns the current force of this stuntDouble.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.