23#ifndef VOTCA_XTP_ATOMCONTAINER_H
24#define VOTCA_XTP_ATOMCONTAINER_H
57 using iterator =
typename std::vector<T>::iterator;
85 typename std::vector<T>::iterator
end() {
return atomlist_.end(); }
87 typename std::vector<T>::const_iterator
begin()
const {
90 typename std::vector<T>::const_iterator
end()
const {
99 std::pair<Eigen::Vector3d, Eigen::Vector3d> result;
100 Eigen::Vector3d min =
101 std::numeric_limits<double>::max() * Eigen::Vector3d::Ones();
102 Eigen::Vector3d max =
103 std::numeric_limits<double>::min() * Eigen::Vector3d::Ones();
105 const Eigen::Vector3d& pos = atom.getPos();
106 if (pos.x() < min.x()) {
109 if (pos.x() > max.x()) {
112 if (pos.y() < min.y()) {
115 if (pos.y() > max.y()) {
118 if (pos.z() < min.z()) {
121 if (pos.z() > max.z()) {
131 std::vector<std::string> result;
133 if (std::find(result.begin(), result.end(), atom.getElement()) ==
135 result.push_back(atom.getElement());
143 atom.Translate(shift);
148 void Rotate(
const Eigen::Matrix3d& R,
const Eigen::Vector3d& ref_pos) {
150 atom.Rotate(R, ref_pos);
159 T element(0,
"H", Eigen::Vector3d::Zero());
161 std::vector<typename T::data> dataVec(
atomlist_.size());
162 for (std::size_t i = 0; i <
atomlist_.size(); ++i) {
166 table.
write(dataVec);
176 T element(0,
"H", Eigen::Vector3d::Zero());
181 std::vector<typename T::data> dataVec(table.
numRows());
183 for (std::size_t i = 0; i < table.
numRows(); ++i) {
191 Eigen::Vector3d pos = Eigen::Vector3d::Zero();
192 double totalmass = 0.0;
194 double mass = element.getMass(atom.getElement());
196 pos += mass * atom.getPos();
198 pos_ = pos / totalmass;
207 Eigen::Vector3d
pos_ = Eigen::Vector3d::Zero();
const std::string & getType() const
virtual void WriteToCpt(CheckpointWriter &w) const
void Rotate(const Eigen::Matrix3d &R, const Eigen::Vector3d &ref_pos)
void push_back(const T &atom)
std::vector< T >::const_iterator begin() const
std::vector< T >::iterator end()
std::vector< T >::const_iterator end() const
virtual void ReadFromCpt(CheckpointReader &r)
const T & at(Index index) const
void setType(std::string type)
std::pair< Eigen::Vector3d, Eigen::Vector3d > CalcSpatialMinMax() const
std::vector< T >::iterator begin()
AtomContainer(std::string type, Index id)
const T & operator[](Index index) const
AtomContainer(CheckpointReader &r)
std::vector< std::string > FindUniqueElements() const
T & operator[](Index index)
typename std::vector< T >::iterator iterator
const Eigen::Vector3d & getPos() const
virtual ~AtomContainer()=default
std::vector< T > atomlist_
void Translate(const Eigen::Vector3d &shift)
CptTable openTable(const std::string &name)
CptTable openTable(const std::string &name, std::size_t nRows, bool compact=false)
void write(void *buffer, const std::size_t &startIdx, const std::size_t &endIdx)
void read(void *buffer, const std::size_t &startIdx, const std::size_t &endIdx)
base class for all analysis tools