votca 2024.2-dev
Loading...
Searching...
No Matches
qmpair.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 */
21
22// Local VOTCA includes
23#include "votca/xtp/qmpair.h"
25#include "votca/xtp/segment.h"
26
27namespace votca {
28namespace xtp {
29
30QMPair::QMPair(Index id, const Segment* seg1, const Segment* seg2,
31 const Eigen::Vector3d& delta_R)
32 : id_(id), R_(delta_R) {
33 segments_.first = seg1;
34 segments_.second = seg2;
35}
36
38 const Eigen::Vector3d& r1 = segments_.first->getPos();
39 const Eigen::Vector3d& r2 = segments_.second->getPos();
40 Segment seg2pbc = Segment(*(segments_.second));
41 // Check whether pair formed across periodic boundary
42 if ((r2 - r1 - R_).norm() > 1e-8) {
43 seg2pbc.Translate(r1 - r2 + R_);
44 }
45
46 return seg2pbc;
47}
48
50 table.addCol<Index>("index", HOFFSET(data, id));
51 table.addCol<Index>("Seg1Id", HOFFSET(data, Seg1Id));
52 table.addCol<Index>("Seg2Id", HOFFSET(data, Seg2Id));
53
54 table.addCol<double>("delta_Rx", HOFFSET(data, RX));
55 table.addCol<double>("delta_Ry", HOFFSET(data, RY));
56 table.addCol<double>("delta_Rz", HOFFSET(data, RZ));
57 table.addCol<std::string>("pair_type", HOFFSET(data, pair_type));
58
59 table.addCol<double>("lambda0e", HOFFSET(data, lambda0e));
60 table.addCol<double>("lambda0h", HOFFSET(data, lambda0h));
61 table.addCol<double>("lambda0s", HOFFSET(data, lambda0s));
62 table.addCol<double>("lambda0t", HOFFSET(data, lambda0t));
63
64 table.addCol<double>("jeff2e", HOFFSET(data, jeff2e));
65 table.addCol<double>("jeff2h", HOFFSET(data, jeff2h));
66 table.addCol<double>("jeff2s", HOFFSET(data, jeff2s));
67 table.addCol<double>("jeff2t", HOFFSET(data, jeff2t));
68}
69
70void QMPair::WriteData(data& d) const {
71 d.id = id_;
72 d.Seg1Id = segments_.first->getId();
73 d.Seg2Id = segments_.second->getId();
74 d.RX = R_[0];
75 d.RY = R_[1];
76 d.RZ = R_[2];
77 std::string ptype = get_name(pair_type_);
78 d.pair_type = new char[ptype.length() + 1];
79 strcpy(d.pair_type, ptype.c_str());
80
85
90}
91
92void QMPair::ReadData(const data& d, const std::vector<Segment>& segments) {
93 id_ = d.id;
94 R_[0] = d.RX;
95 R_[1] = d.RY;
96 R_[2] = d.RZ;
97
98 std::string type_enum = std::string(d.pair_type);
99 pair_type_ = QMPair::get_Enum(type_enum);
100 free(d.pair_type);
101
106
111
112 segments_.first = &segments[d.Seg1Id];
113 segments_.second = &segments[d.Seg2Id];
114}
115
116} // namespace xtp
117} // namespace votca
const Eigen::Vector3d & getPos() const
void Translate(const Eigen::Vector3d &shift)
void addCol(const std::string &name, const size_t &offset)
Eigen::Vector3d R_
Definition qmpair.h:141
static PairType get_Enum(std::string type)
Definition qmpair.h:73
static std::string get_name(PairType type)
Definition qmpair.h:41
QMPair(Index id, const Segment *seg1, const Segment *seg2, const Eigen::Vector3d &delta_R)
Definition qmpair.cc:30
PairType pair_type_
Definition qmpair.h:143
Segment Seg2PbCopy() const
Definition qmpair.cc:37
std::pair< const Segment *, const Segment * > segments_
Definition qmpair.h:139
void WriteData(data &d) const
Definition qmpair.cc:70
static void SetupCptTable(CptTable &table)
Definition qmpair.cc:49
QMStateCarrierStorage< double > lambda0_
Definition qmpair.h:145
void ReadData(const data &d, const std::vector< Segment > &segments)
Definition qmpair.cc:92
QMStateCarrierStorage< double > Jeff2_
Definition qmpair.h:146
T getValue(QMStateType t) const
Definition qmstate.h:115
void setValue(T value, QMStateType t)
Definition qmstate.h:109
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26