votca 2024.2-dev
Loading...
Searching...
No Matches
excitoncoupling.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_EXCITONCOUPLING_H
22#define VOTCA_XTP_EXCITONCOUPLING_H
23
24// VOTCA includes
26
27// Local VOTCA includes
31#include "votca/xtp/logger.h"
33#include "votca/xtp/qmtool.h"
34
35namespace votca {
36namespace xtp {
37
38class ExcitonCoupling final : public QMTool {
39 public:
40 std::string Identify() const { return "excitoncoupling"; }
41
42 protected:
43 void ParseOptions(const tools::Property& user_options);
44 bool Run();
45
46 private:
47 std::string orbA_, orbB_, orbAB_;
48
50 std::string output_file_;
52 std::string mpsA_;
53 std::string mpsB_;
55};
56
58
59 classical_ = options.get(".use_classical").as<bool>();
60
61 if (!classical_) {
62
63 coupling_options_.get(".bsecoupling_options");
64
65 orbA_ = options.get(".orbitalsA").as<std::string>();
66 orbB_ = options.get(".orbitalsB").as<std::string>();
67 orbAB_ = options.get(".orbitalsAB").as<std::string>();
68
69 } else {
70 mpsA_ = options.get(".mpsA").as<std::string>();
71 mpsB_ = options.get(".mpsB").as<std::string>();
72 }
73 output_file_ = job_name_ + "_excitoncoupling.xml";
74}
75
77
80
81 log_.setCommonPreface("\n... ...");
82 tools::Property summary;
83 tools::Property& job_output = summary.add("output", "");
84 // get the corresponding object from the QMPackageFactory
85 if (!classical_) {
86 Orbitals orbitalsA, orbitalsB, orbitalsAB;
87 // load the QM data from serialized orbitals objects
88
90 << " Loading QM data for molecule A from " << orbA_ << std::flush;
91 orbitalsA.ReadFromCpt(orbA_);
92
94 << " Loading QM data for molecule B from " << orbB_ << std::flush;
95 orbitalsB.ReadFromCpt(orbB_);
96
98 << " Loading QM data for dimer AB from " << orbAB_ << std::flush;
99 orbitalsAB.ReadFromCpt(orbAB_);
100
101 BSECoupling bsecoupling;
102 bsecoupling.setLogger(&log_);
103 bsecoupling.Initialize(coupling_options_);
104
105 bsecoupling.CalculateCouplings(orbitalsA, orbitalsB, orbitalsAB);
106 std::cout << log_;
107
108 tools::Property& pair_summary = job_output.add("pair", "");
109 tools::Property& type_summary = pair_summary.add("type", "");
110 bsecoupling.Addoutput(type_summary, orbitalsA, orbitalsB);
111
112 }
113
114 else if (classical_) {
116 << "Calculating electronic coupling using classical transition charges."
117 << orbB_ << std::flush;
118 PolarSegment seg1 = PolarSegment("A", 0);
119 PolarSegment seg2 = PolarSegment("B", 1);
120 seg1.LoadFromFile(mpsA_);
121 seg2.LoadFromFile(mpsB_);
122 eeInteractor ee;
123 double J = ee.CalcStaticEnergy(seg1, seg2);
124
125 tools::Property& pair_summary = job_output.add("pair", "");
126 pair_summary.setAttribute("idA", 1);
127 pair_summary.setAttribute("idB", 2);
128 pair_summary.setAttribute("typeA", mpsA_);
129 pair_summary.setAttribute("typeB", mpsB_);
130 tools::Property& coupling_summary = pair_summary.add("Coupling", "");
131 coupling_summary.setAttribute("jABstatic", J);
132 }
133
135
136 std::ofstream ofs(output_file_, std::ofstream::out);
137 ofs << job_output;
138 ofs.close();
139 return true;
140}
141
142} // namespace xtp
143} // namespace votca
144
145#endif // VOTCA_XTP_EXCITONCOUPLING_H
Manipulates the format state of the output stream.
class to manage program options with xml serialization functionality
Definition property.h:55
Property & add(const std::string &key, const std::string &value)
add a new property to structure
Definition property.cc:108
Property & get(const std::string &key)
get existing property
Definition property.cc:79
T as() const
return value as type
Definition property.h:283
void setAttribute(const std::string &attribute, const T &value)
set an attribute
Definition property.h:314
Evaluates electronic coupling elements.
Definition bsecoupling.h:40
void CalculateCouplings(const Orbitals &orbitalsA, const Orbitals &orbitalsB, const Orbitals &orbitalsAB) override
evaluates electronic couplings
void Addoutput(tools::Property &type_summary, const Orbitals &orbitalsA, const Orbitals &orbitalsB) const override
void Initialize(tools::Property &options) override
void LoadFromFile(std::string filename)
void setLogger(Logger *pLog)
tools::Property coupling_options_
std::string Identify() const
Calculator name.
void ParseOptions(const tools::Property &user_options)
Logger is used for thread-safe output of messages.
Definition logger.h:164
void setReportLevel(Log::Level ReportLevel)
Definition logger.h:185
void setMultithreading(bool maverick)
Definition logger.h:186
void setCommonPreface(const std::string &preface)
Definition logger.h:198
container for molecular orbitals
Definition orbitals.h:46
void ReadFromCpt(const std::string &filename)
Definition orbitals.cc:692
std::string job_name_
Definition qmtool.h:50
Mediates interaction between polar and static sites.
double CalcStaticEnergy(const S1 &segment1, const S2 &segment2) const
#define XTP_LOG(level, log)
Definition logger.h:40
ClassicalSegment< PolarSite > PolarSegment
base class for all analysis tools
Definition basebead.h:33
static Level current_level
Definition globals.h:30