31 Eigen::Vector3d pos, std::string type)
32 : id_(atom_id), name_(md_atom_name), resnr_(resnr), pos_(pos) {
37 bool found_element_name =
true;
38 bool found_element_type =
true;
41 }
catch (std::runtime_error&) {
42 found_element_name =
false;
47 }
catch (std::runtime_error&) {
48 found_element_type =
false;
51 if (found_element_name && found_element_type) {
52 if (elename != eletype) {
53 throw std::runtime_error(
"Elements " + elename +
" and" + eletype +
54 " from atom name: " + md_atom_name +
55 " and atom type:" + type +
" do not match.");
58 }
else if (found_element_name) {
60 }
else if (found_element_type) {
63 throw std::runtime_error(
"Could not get Element from atom name:" +
64 md_atom_name +
" or atom type:" + type);
69 :
Atom(-1, element, atom_id, pos, element) {}
72 std::string element = MDName.substr(0, 1);
74 if (MDName.size() > 1) {
75 if (std::islower(MDName[1])) {
82void Atom::Rotate(
const Eigen::Matrix3d& R,
const Eigen::Vector3d& refPos) {
83 Eigen::Vector3d dir =
pos_ - refPos;
90 table.
addCol<std::string>(
"element", HOFFSET(
data, element));
91 table.
addCol<std::string>(
"name", HOFFSET(
data, name));
92 table.
addCol<
double>(
"pos.x", HOFFSET(
data, x));
93 table.
addCol<
double>(
"pos.y", HOFFSET(
data, y));
94 table.
addCol<
double>(
"pos.z", HOFFSET(
data, z));
101 d.
name =
const_cast<char*
>(
name_.c_str());
static void SetupCptTable(CptTable &table)
void ReadData(const data &d)
void WriteData(data &d) const
static std::string GetElementFromString(const std::string &MDName)
Atom(Index resnr, std::string md_atom_name, Index atom_id, Eigen::Vector3d pos, std::string element)
void Rotate(const Eigen::Matrix3d &R, const Eigen::Vector3d &refPos)
void addCol(const std::string &name, const size_t &offset)
base class for all analysis tools