votca 2024.2-dev
Loading...
Searching...
No Matches
gnode.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// Standard includes
19#include <queue>
20
21// Local VOTCA includes
22#include "votca/xtp/gnode.h"
23
24using namespace std;
25
26namespace votca {
27namespace xtp {
28void GNode::AddDecayEvent(double decayrate) {
29 events_.push_back(GLink(decayrate));
30 hasdecay_ = true;
31}
32
33void GNode::AddEvent(GNode* seg2, const Eigen::Vector3d& dr, double rate) {
34 events_.push_back(GLink(seg2, rate, dr));
35}
36
38 escape_rate_ = 0.0;
39 for (const auto& event : events_) {
40 escape_rate_ += event.getRate();
41 }
42}
43
45 return hTree.findHoppingDestination(p);
46}
47
49 hTree.setEvents(&events_);
50 hTree.makeTree();
51}
52
53void GNode::AddEventfromQmPair(const QMPair& pair, std::vector<GNode>& nodes,
54 double rate) {
55 Index destination = 0;
56 Eigen::Vector3d dr = Eigen::Vector3d::Zero();
57 if (id_ == pair.Seg1()->getId()) {
58 destination = pair.Seg2()->getId();
59 dr = pair.R();
60 } else {
61 destination = pair.Seg1()->getId();
62 dr = -pair.R();
63 }
64
65 AddEvent(&nodes[destination], dr, rate);
66
67 return;
68}
69
70} // namespace xtp
71} // namespace votca
void AddEventfromQmPair(const QMPair &pair, std::vector< GNode > &nodes, double rate)
Definition gnode.cc:53
void InitEscapeRate()
Definition gnode.cc:37
void AddEvent(GNode *seg2, const Eigen::Vector3d &dr, double rate)
Definition gnode.cc:33
double escape_rate_
Definition gnode.h:65
huffmanTree< GLink > hTree
Definition gnode.h:72
void AddDecayEvent(double decayrate)
Definition gnode.cc:28
void MakeHuffTree()
Definition gnode.cc:48
GLink * findHoppingDestination(double p) const
Definition gnode.cc:44
std::vector< GLink > events_
Definition gnode.h:70
STL namespace.
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26