votca 2024.1-dev
Loading...
Searching...
No Matches
qmmolecule.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2023 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 */
19
20#pragma once
21#ifndef VOTCA_XTP_QMMOLECULE_H
22#define VOTCA_XTP_QMMOLECULE_H
23
24// Local VOTCA includes
25#include "atomcontainer.h"
26#include "qmatom.h"
27
28namespace votca {
29namespace xtp {
30
31class QMMolecule : public AtomContainer<QMAtom> {
32 public:
33 QMMolecule(std::string name, Index id) : AtomContainer<QMAtom>(name, id) {};
34
36 void LoadFromFile(std::string filename);
37
38 void WriteXYZ(std::string filename, std::string header) const;
39
40 void AddContainer(const AtomContainer<QMAtom>& container) {
41 Index offset = atomlist_.size();
42 type_ += "_" + container.getType();
43 for (const auto& at : container) {
44 // Update atom IDs to make sure they are unique
45 QMAtom atom(at.getId() + offset, at.getElement(), at.getPos());
46 atomlist_.push_back(atom);
47 }
48 calcPos();
49 }
50
52 Index id = 0;
53 for (auto& at : atomlist_) {
54 at.setID(id);
55 id++;
56 }
57 }
58
59 friend std::ostream& operator<<(std::ostream& out,
60 const QMMolecule& container) {
61 out << container.getId() << " " << container.getType() << "\n";
62 for (const QMAtom& atom : container) {
63 out << atom;
64 }
65 out << std::endl;
66 return out;
67 }
68};
69
70} // namespace xtp
71} // namespace votca
72
73#endif // VOTCA_XTP_QMMOLECULE_H
const std::string & getType() const
const QMAtom & at(Index index) const
container for QM atoms
Definition qmatom.h:37
const Eigen::Vector3d & getPos() const
Definition qmatom.h:55
Index getId() const
Definition qmatom.h:65
const std::string & getElement() const
Definition qmatom.h:63
void setID(const Index index)
Definition qmatom.h:67
QMMolecule(std::string name, Index id)
Definition qmmolecule.h:33
void LoadFromFile(std::string filename)
Definition qmmolecule.cc:45
friend std::ostream & operator<<(std::ostream &out, const QMMolecule &container)
Definition qmmolecule.h:59
void WriteXYZ(std::string filename, std::string header) const
Definition qmmolecule.cc:37
void AddContainer(const AtomContainer< QMAtom > &container)
Definition qmmolecule.h:40
QMMolecule(CheckpointReader &r)
Definition qmmolecule.h:35
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26