votca 2024.2-dev
Loading...
Searching...
No Matches
atom.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 The VOTCA Development Team
3 * (http://www.votca.org)
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License")
6 *
7 * You may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
21
22#pragma once
23#ifndef VOTCA_XTP_ATOM_H
24#define VOTCA_XTP_ATOM_H
25
26// Standard includes
27#include "eigen.h"
28#include <exception>
29#include <map>
30#include <string>
31#include <votca/tools/types.h>
32namespace votca {
33namespace xtp {
34class CptTable;
35class Atom {
36 public:
37 struct data {
39 char* element;
40 char* name;
41 double x;
42 double y;
43 double z;
45 };
46 Atom(Index resnr, std::string md_atom_name, Index atom_id,
47 Eigen::Vector3d pos, std::string element);
48
49 Atom(Index atom_id, std::string element, Eigen::Vector3d pos);
50
51 Atom(data& d) { ReadData(d); }
52
53 static std::string GetElementFromString(const std::string& MDName);
54
55 Index getId() const { return id_; }
56 const std::string& getName() const { return name_; }
57 std::string getElement() const { return element_; }
58
59 Index getResnr() const { return resnr_; }
60
61 void setResnr(Index resnr) { resnr_ = resnr; }
62 void Translate(const Eigen::Vector3d& shift) { pos_ = pos_ + shift; }
63
64 void Rotate(const Eigen::Matrix3d& R, const Eigen::Vector3d& refPos);
65
66 const Eigen::Vector3d& getPos() const { return pos_; }
67 void setPos(const Eigen::Vector3d& r) { pos_ = r; }
68
69 std::string identify() const { return "atom"; }
70
71 friend std::ostream& operator<<(std::ostream& out, const Atom& atom) {
72 out << atom.getId() << " " << atom.getName() << " " << atom.getElement()
73 << " " << atom.getResnr();
74 out << " " << atom.getPos().x() << "," << atom.getPos().y() << ","
75 << atom.getPos().z() << "\n";
76 return out;
77 }
78
79 static void SetupCptTable(CptTable& table);
80
81 void WriteData(data& d) const;
82
83 void ReadData(const data& d);
84
85 private:
86 Index id_ = -1;
87 std::string name_ = "";
88
89 std::string element_ = "";
91 Eigen::Vector3d pos_ = Eigen::Vector3d::Zero();
92};
93
94} // namespace xtp
95} // namespace votca
96
97#endif // VOTCA_XTP_ATOM_H
Atom(data &d)
Definition atom.h:51
Index resnr_
Definition atom.h:90
void setResnr(Index resnr)
Definition atom.h:61
static void SetupCptTable(CptTable &table)
Definition atom.cc:88
void ReadData(const data &d)
Definition atom.cc:108
std::string name_
Definition atom.h:87
void setPos(const Eigen::Vector3d &r)
Definition atom.h:67
void WriteData(data &d) const
Definition atom.cc:98
Eigen::Vector3d pos_
Definition atom.h:91
static std::string GetElementFromString(const std::string &MDName)
Definition atom.cc:71
Index id_
Definition atom.h:86
Index getId() const
Definition atom.h:55
const Eigen::Vector3d & getPos() const
Definition atom.h:66
void Translate(const Eigen::Vector3d &shift)
Definition atom.h:62
Atom(Index resnr, std::string md_atom_name, Index atom_id, Eigen::Vector3d pos, std::string element)
Definition atom.cc:30
const std::string & getName() const
Definition atom.h:56
void Rotate(const Eigen::Matrix3d &R, const Eigen::Vector3d &refPos)
Definition atom.cc:82
friend std::ostream & operator<<(std::ostream &out, const Atom &atom)
Definition atom.h:71
Index getResnr() const
Definition atom.h:59
std::string identify() const
Definition atom.h:69
std::string getElement() const
Definition atom.h:57
std::string element_
Definition atom.h:89
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26