votca 2024.2-dev
Loading...
Searching...
No Matches
einternal.cc
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 The VOTCA Development Team (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18// Local VOTCA includes
19#include "votca/xtp/topology.h"
20
21// Local private VOTCA includes
22#include "einternal.h"
23
24namespace votca {
25namespace xtp {
26
28
29 energies_file_ = options.get(".energies_file").as<std::string>();
30}
31
33
34 std::cout << "\n... ... Site, reorg. energies from " << energies_file_
35 << ".\n";
36
37 tools::Property alloc;
39
40 std::string key = "topology.molecules.molecule";
41 std::vector<tools::Property *> mols = alloc.Select(key);
42 for (tools::Property *molprop : mols) {
43
44 key = "segments.segment";
45 std::vector<tools::Property *> segs = molprop->Select(key);
46 for (tools::Property *segprop : segs) {
47
48 std::string segName = segprop->get("name").as<std::string>();
49
50 bool has_seg = true;
51
56 double eV2hrt = tools::conv::ev2hrt;
57
58 std::vector<QMStateType> types = {QMStateType::Electron,
61 for (QMStateType type : types) {
62 std::string u_xX_nN = "U_xX_nN_" + type.ToString();
63 std::string u_nX_nN = "U_nX_nN_" + type.ToString();
64 std::string u_xN_xX = "U_xN_xX_" + type.ToString();
65 if (segprop->exists(u_xX_nN) && segprop->exists(u_nX_nN) &&
66 segprop->exists(u_xN_xX)) {
67 U_xX_nN.setValue(segprop->get(u_xX_nN).as<double>() * eV2hrt, type);
68 U_nX_nN.setValue(segprop->get(u_nX_nN).as<double>() * eV2hrt, type);
69 U_xN_xX.setValue(segprop->get(u_xN_xX).as<double>() * eV2hrt, type);
70 has_state.setValue(true, type);
71 }
72 }
73 seg_has_state_[segName] = has_state;
74 seg_U_xX_nN_[segName] = U_xX_nN;
75 seg_U_nX_nN_[segName] = U_nX_nN;
76 seg_U_xN_xX_[segName] = U_xN_xX;
77
78 has_seg_[segName] = has_seg;
79 }
80 }
81}
82
84
86
87 Index count = 0;
88 for (Segment &seg : top.Segments()) {
89
90 std::string segName = seg.getType();
91
92 if (!has_seg_.count(segName)) {
93 std::cout << std::endl
94 << "... ... WARNING: No energy information for seg [" << segName
95 << "]. Skipping... ";
96 continue;
97 }
98
99 ++count;
100
101 std::vector<QMStateType> types = {QMStateType::Electron, QMStateType::Hole,
104 for (QMStateType type : types) {
105
106 if (seg_has_state_[segName].getValue(type.Type())) {
107 seg.setU_xX_nN(seg_U_xX_nN_[segName].getValue(type.Type()),
108 type.Type());
109 seg.setU_nX_nN(seg_U_nX_nN_[segName].getValue(type.Type()),
110 type.Type());
111 seg.setU_xN_xX(seg_U_xN_xX_[segName].getValue(type.Type()),
112 type.Type());
113 }
114 }
115 }
116
117 std::cout << std::endl
118 << "... ... Read in site, reorg. energies for " << count
119 << " segments. " << std::flush;
120
121 return true;
122}
123
124} // namespace xtp
125} // namespace votca
class to manage program options with xml serialization functionality
Definition property.h:55
Property & get(const std::string &key)
get existing property
Definition property.cc:79
T as() const
return value as type
Definition property.h:283
std::vector< Property * > Select(const std::string &filter)
select property based on a filter
Definition property.cc:185
void LoadFromXML(std::string filename)
Definition property.cc:238
void ParseOptions(const tools::Property &user_options)
Definition einternal.cc:27
std::map< std::string, bool > has_seg_
Definition einternal.h:53
std::map< std::string, QMStateCarrierStorage< double > > seg_U_xN_xX_
Definition einternal.h:49
std::map< std::string, QMStateCarrierStorage< double > > seg_U_xX_nN_
Definition einternal.h:47
bool Evaluate(Topology &top)
Definition einternal.cc:83
std::string energies_file_
Definition einternal.h:55
std::map< std::string, QMStateCarrierStorage< bool > > seg_has_state_
Definition einternal.h:51
std::map< std::string, QMStateCarrierStorage< double > > seg_U_nX_nN_
Definition einternal.h:48
Storage class for properties of QMStateTypes, which can be used in KMC.
Definition qmstate.h:105
void setValue(T value, QMStateType t)
Definition qmstate.h:109
Container for segments and box and atoms.
Definition topology.h:41
std::vector< Segment > & Segments()
Definition topology.h:58
const double ev2hrt
Definition constants.h:54
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26