48#include "types/AtomType.hpp"
55#include "types/MultipoleAdapter.hpp"
56#include "types/StickyAdapter.hpp"
61 AtomType::AtomType() {
71 myResponsibilities_[
"mass"] =
false;
74 void AtomType::useBase(
AtomType* base) {
80 void AtomType::copyAllData(
AtomType* orig) {
85 hasBase_ = orig->hasBase_;
88 name_ = string(orig->name_);
89 ident_ = orig->ident_;
91 map<string, bool>::iterator i;
93 map<string, RealType>::iterator j;
95 for (i = orig->myResponsibilities_.begin();
96 i != orig->myResponsibilities_.end(); ++i) {
97 myResponsibilities_[(*i).first] = orig->myResponsibilities_[(*i).first];
100 for (j = orig->myValues_.begin(); j != orig->myValues_.end(); ++j) {
101 myValues_[(*j).first] = orig->myValues_[(*j).first];
104 std::vector<std::shared_ptr<GenericData>> oprops = orig->getProperties();
105 std::vector<std::shared_ptr<GenericData>>::iterator it;
107 for (it = oprops.begin(); it != oprops.end(); ++it) {
113 myResponsibilities_[genData->getID()] =
true;
114 properties_.addProperty(genData);
118 properties_.removeProperty(propName);
119 myResponsibilities_[propName] =
false;
123 return properties_.getPropertyNames();
127 return properties_.getProperties();
131 if (hasBase_ && !myResponsibilities_[propName]) {
132 return base_->hasProperty(propName);
134 return properties_.hasProperty(propName);
138 const string& propName) {
139 if (hasBase_ && !myResponsibilities_[propName]) {
140 return base_->getPropertyByName(propName);
142 return properties_.getPropertyByName(propName);
145 void AtomType::setMass(RealType m) {
146 myResponsibilities_[
"mass"] =
true;
150 RealType AtomType::getMass(
void) {
151 if (hasBase_ && !myResponsibilities_[
"mass"])
152 return base_->getMass();
157 void AtomType::setIdent(
int id) { ident_ = id; }
159 int AtomType::getIdent() {
return ident_; }
161 void AtomType::setName(
const string& name) { name_ = name; }
163 string AtomType::getName() {
return name_; }
165 bool AtomType::isLennardJones() {
return hasProperty(
"LJ"); }
167 bool AtomType::isElectrostatic() {
return isCharge() || isMultipole(); }
169 bool AtomType::isEAM() {
return hasProperty(
"EAM"); }
171 bool AtomType::isCharge() {
return isFixedCharge() || isFluctuatingCharge(); }
173 bool AtomType::isDirectional() {
return hasProperty(
"Directional"); }
175 bool AtomType::isFluctuatingCharge() {
return hasProperty(
"FlucQ"); }
177 bool AtomType::isFixedCharge() {
return hasProperty(
"Charge"); }
179 bool AtomType::isDipole() {
180 MultipoleAdapter ma = MultipoleAdapter(
this);
181 if (ma.isMultipole()) {
182 return ma.isDipole();
187 bool AtomType::isQuadrupole() {
188 MultipoleAdapter ma = MultipoleAdapter(
this);
189 if (ma.isMultipole()) {
190 return ma.isQuadrupole();
195 bool AtomType::isMultipole() {
return hasProperty(
"Multipole"); }
197 bool AtomType::isGayBerne() {
return hasProperty(
"GB"); }
199 bool AtomType::isSticky() {
return hasProperty(
"Sticky"); }
201 bool AtomType::isStickyPower() {
202 StickyAdapter sa = StickyAdapter(
this);
203 return sa.isStickyPower();
206 bool AtomType::isShape() {
return hasProperty(
"Shape"); }
208 bool AtomType::isSC() {
return hasProperty(
"SC"); }
210 bool AtomType::isMetal() {
return isSC() || isEAM(); }
212 std::vector<AtomType*> AtomType::allYourBase() {
213 std::vector<AtomType*> myChain;
216 myChain = base_->allYourBase();
217 myChain.insert(myChain.begin(),
this);
219 myChain.push_back(
this);
AtomType is what OpenMD looks to for unchanging data about an atom.
std::shared_ptr< GenericData > getPropertyByName(const string &propName)
Returns property.
std::vector< std::shared_ptr< GenericData > > getProperties()
Returns all of the properties in PropertyMap.
void removeProperty(const string &propName)
Removes property from PropertyMap by name.
bool hasProperty(const string &propName)
Checks if property is in this PropertyMap.
std::vector< string > getPropertyNames()
Returns all names of properties.
void addProperty(std::shared_ptr< GenericData > genData)
Adds property into property map.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.