votca 2024.2-dev
Loading...
Searching...
No Matches
rate_engine.cc
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// Local VOTCA includes
22
23namespace votca {
24namespace xtp {
25
26std::ostream& operator<<(std::ostream& out, const Rate_Engine& rate_engine) {
27 out << "Rate engine initialized:\n";
28 out << " Ratetype:" << rate_engine.ratetype_ << "\n";
29 out << " Temperature T[k] = "
31 << "\n";
32 Eigen::Vector3d field =
34 out << " Electric field[V/nm](x,y,z) =" << field.x() << " " << field.y()
35 << " " << field.z() << " ||F|| " << field.norm() << std::endl;
36 return out;
37}
38
40 QMStateType carriertype) const {
41 double charge = 0.0;
42 if (carriertype == QMStateType::Electron) {
43 charge = -1.0;
44 } else if (carriertype == QMStateType::Hole) {
45 charge = 1.0;
46 }
47
48 double reorg12 = pair.getReorg12(carriertype) + pair.getLambdaO(carriertype);
49 double reorg21 = pair.getReorg21(carriertype) - pair.getLambdaO(carriertype);
50 if (std::abs(reorg12) < 1e-12 || std::abs(reorg21) < 1e-12) {
51 throw std::runtime_error(
52 "Reorganisation energy for a pair is extremely close to zero,\n"
53 " you probably forgot to import reorganisation energies into your "
54 "state "
55 "file.");
56 }
57 double dG_Field = 0.0;
58 if (charge != 0.0) {
59 dG_Field = charge * pair.R().dot(field_);
60 }
61 double dG_Site = pair.getdE12(carriertype);
62 double dG = dG_Site + dG_Field;
63 double J2 = pair.getJeff2(carriertype);
64 PairRates result;
65 if (ratetype_ == "marcus") {
66 result.rate12 = Marcusrate(J2, dG, reorg12);
67 result.rate21 = Marcusrate(J2, -dG, reorg21);
68 } else {
69 throw std::runtime_error("Only marcus rates implemented.");
70 }
71 return result;
72}
73
74double Rate_Engine::Marcusrate(double Jeff2, double deltaG,
75 double reorg) const {
76
78 return 2 * tools::conv::Pi / hbar * Jeff2 /
79 std::sqrt(4 * tools::conv::Pi * reorg * temperature_) *
80 std::exp(-(deltaG - reorg) * (deltaG - reorg) /
81 (4 * reorg * temperature_));
82}
83} // namespace xtp
84} // namespace votca
Eigen::Vector3d field_
Definition rate_engine.h:52
double Marcusrate(double Jeff2, double deltaG, double reorg) const
PairRates Rate(const QMPair &pair, QMStateType carriertype) const
const double ev2hrt
Definition constants.h:54
const double hbar
Definition constants.h:42
const double kB
Definition constants.h:40
const double bohr2nm
Definition constants.h:46
const double hrt2ev
Definition constants.h:53
const double Pi
Definition constants.h:36
std::ostream & operator<<(std::ostream &out, const Correlate &c)
Definition correlate.h:53
base class for all analysis tools
Definition basebead.h:33