votca 2024.2-dev
Loading...
Searching...
No Matches
segment.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 */
19
20#pragma once
21#ifndef VOTCA_XTP_SEGMENT_H
22#define VOTCA_XTP_SEGMENT_H
23
24// Standard includes
25#include <map>
26#include <vector>
27
28// Local VOTCA includes
29#include "atom.h"
30#include "atomcontainer.h"
31#include "qmstate.h"
32
33namespace votca {
34namespace xtp {
35
36class Segment : public AtomContainer<Atom> {
37 public:
38 Segment(std::string name, Index id) : AtomContainer<Atom>(name, id) {};
39 // cannot use standard AtomContainer constructor because ReadFromCpt is
40 // different.
42
43 ~Segment() override = default;
44
51
53 void setU_xX_nN(double dU, QMStateType state) {
54 U_xX_nN_.setValue(dU, state);
55 }
57 void setU_nX_nN(double dU, QMStateType state) {
58 U_nX_nN_.setValue(dU, state);
59 }
61 void setU_xN_xX(double dU, QMStateType state) {
62 U_xN_xX_.setValue(dU, state);
63 }
64
65 const Atom* getAtom(Index id) const;
66
67 double getU_xX_nN(QMStateType state) const {
68 return U_xX_nN_.getValue(state);
69 }
70
71 double getU_nX_nN(QMStateType state) const {
72 return U_nX_nN_.getValue(state);
73 }
74
75 double getU_xN_xX(QMStateType state) const {
76 return U_xN_xX_.getValue(state);
77 }
78
79 double getSiteEnergy(QMStateType state) const {
80 return site_eng_.getValue(state) + U_xX_nN_.getValue(state);
81 }
82
83 double getEMpoles(QMStateType state) const {
84 return site_eng_.getValue(state);
85 }
86
87 void setEMpoles(QMStateType state, double energy) {
88 site_eng_.setValue(energy, state);
89 }
90
91 void AddMoleculeId(Index id) { molecule_ids_.push_back(int(id)); }
92
93 const std::vector<Index>& getMoleculeIds() const { return molecule_ids_; }
94
95 double getApproxSize() const;
96
97 void WriteToCpt(CheckpointWriter& w) const override;
98
99 void ReadFromCpt(CheckpointReader& r) override;
100
101 friend std::ostream& operator<<(std::ostream& out, const Segment& container) {
102 out << container.getId() << " " << container.getType() << "\n";
103 for (const Atom& atom : container) {
104 out << atom;
105 }
106 out << std::endl;
107 return out;
108 }
109
110 private:
111 std::vector<Index> molecule_ids_ = std::vector<Index>(0);
112
117};
118
119} // namespace xtp
120} // namespace votca
121
122#endif // VOTCA_XTP_SEGMENT_H
const std::string & getType() const
Storage class for properties of QMStateTypes, which can be used in KMC.
Definition qmstate.h:105
T getValue(QMStateType t) const
Definition qmstate.h:115
void setValue(T value, QMStateType t)
Definition qmstate.h:109
QMStateCarrierStorage< double > U_nX_nN_
Definition segment.h:114
std::vector< Index > molecule_ids_
Definition segment.h:111
double getU_nX_nN(QMStateType state) const
Definition segment.h:71
void setU_xX_nN(double dU, QMStateType state)
UxX - UnN.
Definition segment.h:53
double getApproxSize() const
Definition segment.cc:27
double getEMpoles(QMStateType state) const
Definition segment.h:83
~Segment() override=default
QMStateCarrierStorage< double > U_xX_nN_
Definition segment.h:113
friend std::ostream & operator<<(std::ostream &out, const Segment &container)
Definition segment.h:101
double getU_xX_nN(QMStateType state) const
Definition segment.h:67
QMStateCarrierStorage< double > U_xN_xX_
Definition segment.h:115
void AddMoleculeId(Index id)
Definition segment.h:91
void setU_nX_nN(double dU, QMStateType state)
UnX - UnN.
Definition segment.h:57
double getSiteEnergy(QMStateType state) const
Definition segment.h:79
void ReadFromCpt(CheckpointReader &r) override
Definition segment.cc:64
Segment(std::string name, Index id)
Definition segment.h:38
double getU_xN_xX(QMStateType state) const
Definition segment.h:75
QMStateCarrierStorage< double > site_eng_
Definition segment.h:116
void WriteToCpt(CheckpointWriter &w) const override
Definition segment.cc:42
void setEMpoles(QMStateType state, double energy)
Definition segment.h:87
const std::vector< Index > & getMoleculeIds() const
Definition segment.h:93
Segment(CheckpointReader &r)
Definition segment.h:41
void setU_xN_xX(double dU, QMStateType state)
UxN - UxX.
Definition segment.h:61
const Atom * getAtom(Index id) const
Definition segment.cc:32
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26