votca 2026-dev
Loading...
Searching...
No Matches
polarregion.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_POLARREGION_H
22#define VOTCA_XTP_POLARREGION_H
23
24// VOTCA includes
26
27// Local VOTCA includes
28#include "eeinteractor.h"
29#include "energy_terms.h"
30#include "hist.h"
31#include "mmregion.h"
32
40
41namespace votca {
42namespace xtp {
43class QMRegion;
44class PolarRegion;
45class StaticRegion;
46class EwaldRegion;
47
48class PolarRegion : public MMRegion<PolarSegment> {
49 public:
50 PolarRegion(Index id, Logger& log) : MMRegion<PolarSegment>(id, log) {}
51
52 std::string identify() const override { return "polarregion"; }
53
54 void Initialize(const tools::Property& prop) override;
55
56 bool Converged() const override;
57
58 void Evaluate(std::vector<std::unique_ptr<Region> >& regions) override;
59
60 void Reset() override;
61
62 double Etotal() const override { return E_hist_.back().Etotal(); }
63
64 // Thole damping of this region's induced dipoles, which environment
65 // screening must reuse to respond exactly as this region does.
66 double ExpDamp() const { return exp_damp_; }
67
68 // charge-response segments (see ChargeResponse) in this region
69 bool hasChargeResponse() const;
70 double CRWidth() const { return cr_width_; }
71 bool CRTholeDipoles() const { return cr_thole_dipoles_; }
72
73 void WriteToCpt(CheckpointWriter& w) const override;
74
75 void ReadFromCpt(CheckpointReader& r) override;
76
77 protected:
78 void AppendResult(tools::Property& prop) const override;
79 double InteractwithQMRegion(const QMRegion& region) override;
80 double InteractwithPolarRegion(const PolarRegion& region) override;
81 double InteractwithStaticRegion(const StaticRegion& region) override;
82 double InteractwithEwaldRegion(const EwaldRegion& region) override;
83
84 private:
86 double StaticInteraction();
88
89 double PolarEnergy_extern() const;
91 Index CalcPolDoF() const;
92
93 Eigen::VectorXd CalcInducedDipoleInsideSegments() const;
94 Eigen::VectorXd ReadInducedDipolesFromLastIteration() const;
95
96 Eigen::VectorXd CalcInducedDipolesViaPCG(
97 const Eigen::VectorXd& initial_guess);
98 void WriteInducedDipolesToSegments(const Eigen::VectorXd& x);
99
101 double deltaE_ = 1e-5;
102 double deltaD_ = 1e-5;
104 double exp_damp_ = 0.39;
105 // charge-response options (bohr; Thole damping of their dipoles)
107 bool cr_thole_dipoles_ = false;
108
109 // marks the sites of the charge-response segments with the options above
111 void LogAndStoreEnergies(Energy_terms e_contrib);
112};
113
114} // namespace xtp
115} // namespace votca
116
117#endif // VOTCA_XTP_POLARREGION_H
class to manage program options with xml serialization functionality
Definition property.h:55
The periodic Ewald background, as a Region.
Definition ewaldregion.h:76
Logger is used for thread-safe output of messages.
Definition logger.h:164
MMRegion(Index id, Logger &log)
Definition mmregion.h:38
Eigen::VectorXd CalcInducedDipoleInsideSegments() const
PolarRegion(Index id, Logger &log)
Definition polarregion.h:50
void AppendResult(tools::Property &prop) const override
void WriteInducedDipolesToSegments(const Eigen::VectorXd &x)
double InteractwithEwaldRegion(const EwaldRegion &region) override
double CRWidth() const
Definition polarregion.h:70
void ReadFromCpt(CheckpointReader &r) override
bool CRTholeDipoles() const
Definition polarregion.h:71
double InteractwithQMRegion(const QMRegion &region) override
void Initialize(const tools::Property &prop) override
bool Converged() const override
eeInteractor::E_terms PolarEnergy() const
Eigen::VectorXd CalcInducedDipolesViaPCG(const Eigen::VectorXd &initial_guess)
bool hasChargeResponse() const
Eigen::VectorXd ReadInducedDipolesFromLastIteration() const
std::string identify() const override
Definition polarregion.h:52
hist< Energy_terms > E_hist_
void WriteToCpt(CheckpointWriter &w) const override
void LogAndStoreEnergies(Energy_terms e_contrib)
double InteractwithPolarRegion(const PolarRegion &region) override
double ExpDamp() const
Definition polarregion.h:66
void Evaluate(std::vector< std::unique_ptr< Region > > &regions) override
void Reset() override
double Etotal() const override
Definition polarregion.h:62
double InteractwithStaticRegion(const StaticRegion &region) override
double PolarEnergy_extern() const
const double ang2bohr
Definition constants.h:48
ClassicalSegment< PolarSite > PolarSegment
Provides a means for comparing floating point numbers.
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26