votca 2024.2-dev
Loading...
Searching...
No Matches
energy_terms.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_ENERGY_TERMS_H
22#define VOTCA_XTP_ENERGY_TERMS_H
23
24// Local VOTCA includes
25#include "eeinteractor.h"
26#include "eigen.h"
27
34namespace votca {
35namespace xtp {
36
38 public:
40 this->data_ += right.data_;
41 return *this;
42 }
43
45 right.data_ += this->data_;
46 return right;
47 }
48
50 right.data_ *= (-1);
51 right.data_ += this->data_;
52 return right;
53 }
54
55 void addInternalPolarContrib(const eeInteractor::E_terms& induction_terms) {
56 data_.segment<3>(0) += induction_terms.data();
57 }
58
59 double Etotal() const { return data_.sum(); } // total energy
60 double Epolar() const {
61 return data_.segment<4>(0).sum();
62 } // all polar inside region and from outside contributions
63 // dQ-dQ,Q-dQ,E_internal
64 double Estatic() const {
65 return data_.segment<2>(4).sum();
66 } // all static contributions Q-Q inside region and from outside
67 double Eextern() const {
68 return data_.segment<2>(3).sum();
69 } // all external contributions
70 double Eintern() const {
71 return Etotal() - Eextern();
72 } // all internal contributions
73
74 double& E_indu_indu() { return data_[0]; } // dQ-dQ inside region
75 double& E_indu_stat() { return data_[1]; } // dQ-Q inside region
76 double& E_internal() { return data_[2]; } // e_internal
77 double& E_polar_ext() {
78 return data_[3];
79 } // dQ-Q and dQ-dQ from outside regions
80 double& E_static_ext() { return data_[4]; } // Q-Q from outside regions
81 double& E_static_static() { return data_[5]; } // Q-Q inside region
82
83 const Eigen::Matrix<double, 6, 1>& data() const { return data_; }
84 Eigen::Matrix<double, 6, 1>& data() { return data_; }
85
86 private:
87 Eigen::Matrix<double, 6, 1> data_ = Eigen::Matrix<double, 6, 1>::Zero();
88};
89
90} // namespace xtp
91} // namespace votca
92
93#endif // VOTCA_XTP_ENERGY_TERMS_H
Eigen::Matrix< double, 6, 1 > data_
Energy_terms & operator+=(const Energy_terms &right)
void addInternalPolarContrib(const eeInteractor::E_terms &induction_terms)
const Eigen::Matrix< double, 6, 1 > & data() const
Energy_terms operator-(Energy_terms right) const
Energy_terms operator+(Energy_terms right) const
Eigen::Matrix< double, 6, 1 > & data()
const Eigen::Vector3d & data() const
base class for all analysis tools
Definition basebead.h:33