votca
2024.2-dev
Loading...
Searching...
No Matches
xtp
src
libxtp
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
24
using namespace
std
;
25
26
namespace
votca
{
27
namespace
xtp {
28
void
GNode::AddDecayEvent
(
double
decayrate) {
29
events_
.push_back(
GLink
(decayrate));
30
hasdecay_
=
true
;
31
}
32
33
void
GNode::AddEvent
(
GNode
* seg2,
const
Eigen::Vector3d& dr,
double
rate) {
34
events_
.push_back(
GLink
(seg2, rate, dr));
35
}
36
37
void
GNode::InitEscapeRate
() {
38
escape_rate_
= 0.0;
39
for
(
const
auto
& event :
events_
) {
40
escape_rate_
+=
event
.getRate();
41
}
42
}
43
44
GLink
*
GNode::findHoppingDestination
(
double
p)
const
{
45
return
hTree
.findHoppingDestination(p);
46
}
47
48
void
GNode::MakeHuffTree
() {
49
hTree
.setEvents(&
events_
);
50
hTree
.makeTree();
51
}
52
53
void
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
votca::xtp::GLink
Definition
glink.h:29
votca::xtp::GNode
Definition
gnode.h:31
votca::xtp::GNode::AddEventfromQmPair
void AddEventfromQmPair(const QMPair &pair, std::vector< GNode > &nodes, double rate)
Definition
gnode.cc:53
votca::xtp::GNode::id_
Index id_
Definition
gnode.h:62
votca::xtp::GNode::InitEscapeRate
void InitEscapeRate()
Definition
gnode.cc:37
votca::xtp::GNode::AddEvent
void AddEvent(GNode *seg2, const Eigen::Vector3d &dr, double rate)
Definition
gnode.cc:33
votca::xtp::GNode::escape_rate_
double escape_rate_
Definition
gnode.h:65
votca::xtp::GNode::hTree
huffmanTree< GLink > hTree
Definition
gnode.h:72
votca::xtp::GNode::AddDecayEvent
void AddDecayEvent(double decayrate)
Definition
gnode.cc:28
votca::xtp::GNode::MakeHuffTree
void MakeHuffTree()
Definition
gnode.cc:48
votca::xtp::GNode::findHoppingDestination
GLink * findHoppingDestination(double p) const
Definition
gnode.cc:44
votca::xtp::GNode::hasdecay_
bool hasdecay_
Definition
gnode.h:66
votca::xtp::GNode::events_
std::vector< GLink > events_
Definition
gnode.h:70
votca::xtp::QMPair
Definition
qmpair.h:37
gnode.h
std
STL namespace.
votca
base class for all analysis tools
Definition
basebead.h:33
votca::Index
Eigen::Index Index
Definition
types.h:26
Generated by
1.12.0