votca 2026-dev
Loading...
Searching...
No Matches
eeinteractor.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_EEINTERACTOR_H
22#define VOTCA_XTP_EEINTERACTOR_H
23
24// Local VOTCA includes
25#include "classicalsegment.h"
26#include "eigen.h"
27
28namespace votca {
29namespace xtp {
30
31enum Estatic : bool {
32 noE_V = true,
33 V = false,
34};
35
40 public:
41 explicit eeInteractor() = default;
42 explicit eeInteractor(double expdamping) : expdamping_(expdamping) {};
43
44 Eigen::Matrix3d FillTholeInteraction(const PolarSite& site1,
45 const PolarSite& site2) const;
46
47 // Induced dipole-dipole tensor T of two sites of different segments
48 // (grad phi at site2 = T mu1): FillTholeInteraction for two Thole sites;
49 // with a charge-response site the Gaussian dipole kernel of width
50 // PairWidth, or Thole damping if that site has CRTholeDipoles().
51 Eigen::Matrix3d FillDipoleInteraction(const PolarSite& site1,
52 const PolarSite& site2) const;
53 // sqrt(s1^2 + s2^2) of the charge-response widths (0 for Thole sites)
54 static double PairWidth(const PolarSite& site1, const PolarSite& site2);
55
56 Eigen::VectorXd Cholesky_IntraSegment(const PolarSegment& seg) const;
57
58 template <class T, enum Estatic>
59 double ApplyStaticField(const T& segment1, PolarSegment& segment2) const;
60
61 template <enum Estatic>
62 double ApplyInducedField(const PolarSegment& segment1,
63 PolarSegment& segment2) const;
64
65 template <class S1, class S2>
66 double CalcStaticEnergy(const S1& segment1, const S2& segment2) const;
67
68 class E_terms {
69 public:
70 E_terms& operator+=(const E_terms& right) {
71 this->data_ += right.data_;
72 return *this;
73 }
74
75 E_terms operator+(E_terms right) const {
76 right.data_ += this->data_;
77 return right;
78 }
79
80 double sum() { return data_.sum(); }
81
82 double& E_indu_indu() { return data_.x(); }
83 double& E_indu_stat() { return data_.y(); }
84 double& E_internal() { return data_.z(); }
85
86 const Eigen::Vector3d& data() const { return data_; }
87
88 private:
89 Eigen::Vector3d data_ = Eigen::Vector3d::Zero();
90 };
91
92 template <class S1, class S2>
93 E_terms CalcPolarEnergy(const S1& segment1, const S2& segment2) const;
94
95 template <class S>
96 double CalcStaticEnergy_IntraSegment(const S& seg) const;
97
98 double CalcPolarEnergy_IntraSegment(const PolarSegment& seg) const;
99
100 double CalcStaticEnergy_site(const StaticSite& site1,
101 const StaticSite& site2) const;
102
103 private:
104 template <int N>
105 Eigen::Matrix<double, N, 1> VSiteA(const StaticSite& site1,
106 const StaticSite& site2) const;
107 template <enum Estatic>
108 double ApplyInducedField_site(const PolarSite& site1, PolarSite& site2) const;
109 template <enum Estatic>
110 double ApplyStaticField_site(const StaticSite& site1, PolarSite& site2) const;
111
112 double CalcPolar_stat_Energy_site(const PolarSite& site1,
113 const StaticSite& site2) const;
114
116 const StaticSite& site2) const;
117
119 const PolarSite& site2) const;
120
121 double expdamping_ = 0.39; // dimensionless
122};
123
124} // namespace xtp
125} // namespace votca
126
127#endif // VOTCA_XTP_EEINTERACTOR_H
Class to represent Atom/Site in electrostatic+polarization.
Definition polarsite.h:36
Class to represent Atom/Site in electrostatic.
Definition staticsite.h:37
const Eigen::Vector3d & data() const
E_terms & operator+=(const E_terms &right)
E_terms operator+(E_terms right) const
double ApplyStaticField_site(const StaticSite &site1, PolarSite &site2) const
double ApplyStaticField(const T &segment1, PolarSegment &segment2) const
Eigen::Matrix3d FillDipoleInteraction(const PolarSite &site1, const PolarSite &site2) const
double ApplyInducedField(const PolarSegment &segment1, PolarSegment &segment2) const
double CalcStaticEnergy_site(const StaticSite &site1, const StaticSite &site2) const
eeInteractor(double expdamping)
Eigen::Matrix< double, N, 1 > VSiteA(const StaticSite &site1, const StaticSite &site2) const
E_terms CalcPolarEnergy(const S1 &segment1, const S2 &segment2) const
Eigen::VectorXd Cholesky_IntraSegment(const PolarSegment &seg) const
double CalcPolar_stat_Energy_site(const PolarSite &site1, const StaticSite &site2) const
E_terms CalcPolarEnergy_site(const PolarSite &site1, const StaticSite &site2) const
static double PairWidth(const PolarSite &site1, const PolarSite &site2)
Eigen::Matrix3d FillTholeInteraction(const PolarSite &site1, const PolarSite &site2) const
double CalcStaticEnergy_IntraSegment(const S &seg) const
double ApplyInducedField_site(const PolarSite &site1, PolarSite &site2) const
double CalcStaticEnergy(const S1 &segment1, const S2 &segment2) const
double CalcPolarEnergy_IntraSegment(const PolarSegment &seg) const
ClassicalSegment< PolarSite > PolarSegment
Provides a means for comparing floating point numbers.
Definition basebead.h:33