votca 2024.2-dev
Loading...
Searching...
No Matches
qmstate.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_QMSTATE_H
22#define VOTCA_XTP_QMSTATE_H
23
24// Standard includes
25#include <string>
26
27// VOTCA includes
28#include <votca/tools/types.h>
29
30namespace votca {
31namespace xtp {
32
34 public:
35 enum statetype { // never change the values
37 Hole = 1,
40 Gstate = 4,
45 };
46
47 QMStateType(const statetype& type) : type_(type) { ; }
49 QMStateType(const std::string& s) { FromString(s); }
50
51 statetype Type() const { return type_; }
52
53 void FromString(const std::string& statetypestring);
54
55 std::string ToString() const;
56
57 std::string ToLongString() const;
58
59 bool operator==(const QMStateType& rhs) const { return type_ == rhs.Type(); }
60
61 bool operator!=(const QMStateType& rhs) const { return type_ != rhs.Type(); }
62
63 bool operator==(const QMStateType::statetype& rhs) const {
64 return type_ == rhs;
65 }
66
67 bool operator!=(const QMStateType::statetype& rhs) const {
68 return type_ != rhs;
69 }
70
71 bool isExciton() const {
73 }
74
79
84
85 bool isGWState() const {
87 }
88
89 bool isKSState() const { return (type_ == statetype::KSstate); }
90
91 bool isPQPState() const { return (type_ == statetype::PQPstate); }
92
93 private:
95};
96
104template <class T>
106 public:
107 QMStateCarrierStorage() { content_ = {0, 0, 0, 0}; }
108
109 void setValue(T value, QMStateType t) {
110 assert(t.isKMCState() &&
111 "QMStateCarrierStorage QMStateType is not for KMC simulations");
112 content_[t.Type()] = value;
113 }
114
116 assert(t.isKMCState() &&
117 "QMStateCarrierStorage QMStateType is not for KMC simulations");
118 return content_[t.Type()];
119 }
120
121 private:
122 std::array<T, 4> content_;
123};
124
132class QMState {
133
134 public:
135 QMState(const QMStateType::statetype& type, Index index, bool transition)
136 : type_(QMStateType(type)), index_(index), transition_(transition) {
137 ;
138 }
139 QMState(const QMStateType& type, Index index, bool transition)
140 : type_(type), index_(index), transition_(transition) {
141 ;
142 }
143 QMState() { ; }
144 QMState(const std::string& statestring) { FromString(statestring); }
145 void FromString(const std::string& statestring);
146
147 std::string ToString() const;
148
149 std::string ToLongString() const;
150
151 const QMStateType& Type() const { return type_; }
152
153 bool isTransition() const { return transition_; }
154 Index StateIdx() const { return index_; }
155
156 bool operator==(const QMState& rhs) const {
157 return (type_ == rhs.Type() && index_ == rhs.StateIdx());
158 }
159
160 bool operator!=(const QMState& rhs) const {
161 return (type_ != rhs.Type() || index_ != rhs.StateIdx());
162 }
163
164 private:
165 Index DetermineIndex(const std::string& statestring);
166 QMStateType DetermineType(const std::string& statestring);
168
170
172};
173
174} // namespace xtp
175} // namespace votca
176
177#endif // VOTCA_XTP_QMSTATE_H
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
std::array< T, 4 > content_
Definition qmstate.h:122
void setValue(T value, QMStateType t)
Definition qmstate.h:109
statetype Type() const
Definition qmstate.h:51
std::string ToLongString() const
Definition qmstate.cc:69
bool operator!=(const QMStateType::statetype &rhs) const
Definition qmstate.h:67
bool isKSState() const
Definition qmstate.h:89
bool isPQPState() const
Definition qmstate.h:91
bool isGWState() const
Definition qmstate.h:85
QMStateType(const statetype &type)
Definition qmstate.h:47
bool isKMCState() const
Definition qmstate.h:75
bool operator==(const QMStateType::statetype &rhs) const
Definition qmstate.h:63
QMStateType(const std::string &s)
Definition qmstate.h:49
bool operator==(const QMStateType &rhs) const
Definition qmstate.h:59
bool isSingleParticleState() const
Definition qmstate.h:80
std::string ToString() const
Definition qmstate.cc:35
bool isExciton() const
Definition qmstate.h:71
void FromString(const std::string &statetypestring)
Definition qmstate.cc:103
bool operator!=(const QMStateType &rhs) const
Definition qmstate.h:61
Identifier for QMstates. Strings like S1 are converted into enum +zero indexed int.
Definition qmstate.h:132
bool operator==(const QMState &rhs) const
Definition qmstate.h:156
std::string ToLongString() const
Definition qmstate.cc:130
bool operator!=(const QMState &rhs) const
Definition qmstate.h:160
QMStateType type_
Definition qmstate.h:167
void FromString(const std::string &statestring)
Definition qmstate.cc:203
QMState(const std::string &statestring)
Definition qmstate.h:144
std::string ToString() const
Definition qmstate.cc:146
Index StateIdx() const
Definition qmstate.h:154
QMState(const QMStateType::statetype &type, Index index, bool transition)
Definition qmstate.h:135
bool isTransition() const
Definition qmstate.h:153
const QMStateType & Type() const
Definition qmstate.h:151
QMState(const QMStateType &type, Index index, bool transition)
Definition qmstate.h:139
QMStateType DetermineType(const std::string &statestring)
Definition qmstate.cc:188
Index DetermineIndex(const std::string &statestring)
Definition qmstate.cc:161
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26