votca 2025.1-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 <cassert>
26#include <string>
27
28// VOTCA includes
29#include <votca/tools/types.h>
30
31namespace votca {
32namespace xtp {
33
35 public:
36 enum statetype { // never change the values
38 Hole = 1,
41 Gstate = 4,
46 };
47
48 QMStateType(const statetype& type) : type_(type) { ; }
50 QMStateType(const std::string& s) { FromString(s); }
51
52 statetype Type() const { return type_; }
53
54 void FromString(const std::string& statetypestring);
55
56 std::string ToString() const;
57
58 std::string ToLongString() const;
59
60 bool operator==(const QMStateType& rhs) const { return type_ == rhs.Type(); }
61
62 bool operator!=(const QMStateType& rhs) const { return type_ != rhs.Type(); }
63
64 bool operator==(const QMStateType::statetype& rhs) const {
65 return type_ == rhs;
66 }
67
68 bool operator!=(const QMStateType::statetype& rhs) const {
69 return type_ != rhs;
70 }
71
72 bool isExciton() const {
74 }
75
80
85
86 bool isGWState() const {
88 }
89
90 bool isKSState() const { return (type_ == statetype::KSstate); }
91
92 bool isPQPState() const { return (type_ == statetype::PQPstate); }
93
94 private:
96};
97
104
105template <class T>
107 public:
108 QMStateCarrierStorage() { content_ = {0, 0, 0, 0}; }
109
110 void setValue(T value, QMStateType t) {
111 assert(t.isKMCState() &&
112 "QMStateCarrierStorage QMStateType is not for KMC simulations");
113 content_[t.Type()] = value;
114 }
115
117 assert(t.isKMCState() &&
118 "QMStateCarrierStorage QMStateType is not for KMC simulations");
119 return content_[t.Type()];
120 }
121
122 private:
123 std::array<T, 4> content_;
124};
125
132
133class QMState {
134
135 public:
136 QMState(const QMStateType::statetype& type, Index index, bool transition)
137 : type_(QMStateType(type)), index_(index), transition_(transition) {
138 ;
139 }
140 QMState(const QMStateType& type, Index index, bool transition)
141 : type_(type), index_(index), transition_(transition) {
142 ;
143 }
144 QMState() { ; }
145 QMState(const std::string& statestring) { FromString(statestring); }
146 void FromString(const std::string& statestring);
147
148 std::string ToString() const;
149
150 std::string ToLongString() const;
151
152 const QMStateType& Type() const { return type_; }
153
154 bool isTransition() const { return transition_; }
155 Index StateIdx() const { return index_; }
156
157 bool operator==(const QMState& rhs) const {
158 return (type_ == rhs.Type() && index_ == rhs.StateIdx());
159 }
160
161 bool operator!=(const QMState& rhs) const {
162 return (type_ != rhs.Type() || index_ != rhs.StateIdx());
163 }
164
165 private:
166 Index DetermineIndex(const std::string& statestring);
167 QMStateType DetermineType(const std::string& statestring);
169
171
173};
174
175} // namespace xtp
176} // namespace votca
177
178#endif // VOTCA_XTP_QMSTATE_H
T getValue(QMStateType t) const
Definition qmstate.h:116
std::array< T, 4 > content_
Definition qmstate.h:123
void setValue(T value, QMStateType t)
Definition qmstate.h:110
statetype Type() const
Definition qmstate.h:52
std::string ToLongString() const
Definition qmstate.cc:69
bool operator!=(const QMStateType::statetype &rhs) const
Definition qmstate.h:68
bool isKSState() const
Definition qmstate.h:90
bool isPQPState() const
Definition qmstate.h:92
bool isGWState() const
Definition qmstate.h:86
QMStateType(const statetype &type)
Definition qmstate.h:48
bool isKMCState() const
Definition qmstate.h:76
bool operator==(const QMStateType::statetype &rhs) const
Definition qmstate.h:64
QMStateType(const std::string &s)
Definition qmstate.h:50
bool operator==(const QMStateType &rhs) const
Definition qmstate.h:60
bool isSingleParticleState() const
Definition qmstate.h:81
std::string ToString() const
Definition qmstate.cc:35
bool isExciton() const
Definition qmstate.h:72
void FromString(const std::string &statetypestring)
Definition qmstate.cc:103
bool operator!=(const QMStateType &rhs) const
Definition qmstate.h:62
bool operator==(const QMState &rhs) const
Definition qmstate.h:157
std::string ToLongString() const
Definition qmstate.cc:130
bool operator!=(const QMState &rhs) const
Definition qmstate.h:161
QMStateType type_
Definition qmstate.h:168
void FromString(const std::string &statestring)
Definition qmstate.cc:203
QMState(const std::string &statestring)
Definition qmstate.h:145
std::string ToString() const
Definition qmstate.cc:146
Index StateIdx() const
Definition qmstate.h:155
QMState(const QMStateType::statetype &type, Index index, bool transition)
Definition qmstate.h:136
bool isTransition() const
Definition qmstate.h:154
const QMStateType & Type() const
Definition qmstate.h:152
QMState(const QMStateType &type, Index index, bool transition)
Definition qmstate.h:140
QMStateType DetermineType(const std::string &statestring)
Definition qmstate.cc:188
Index DetermineIndex(const std::string &statestring)
Definition qmstate.cc:161
Provides a means for comparing floating point numbers.
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26