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// Local VOTCA includes
25#include "eeinteractor.h"
26#include "energy_terms.h"
27#include "hist.h"
28#include "mmregion.h"
29
37
38namespace votca {
39namespace xtp {
40class QMRegion;
41class PolarRegion;
42class StaticRegion;
43class EwaldRegion;
44
45class PolarRegion : public MMRegion<PolarSegment> {
46 public:
47 PolarRegion(Index id, Logger& log) : MMRegion<PolarSegment>(id, log) {}
48
49 std::string identify() const override { return "polarregion"; }
50
51 void Initialize(const tools::Property& prop) override;
52
53 bool Converged() const override;
54
55 void Evaluate(std::vector<std::unique_ptr<Region> >& regions) override;
56
57 void Reset() override;
58
59 double Etotal() const override { return E_hist_.back().Etotal(); }
60
61 // Thole damping of this region's induced dipoles, which environment
62 // screening must reuse to respond exactly as this region does.
63 double ExpDamp() const { return exp_damp_; }
64
65 void WriteToCpt(CheckpointWriter& w) const override;
66
67 void ReadFromCpt(CheckpointReader& r) override;
68
69 protected:
70 void AppendResult(tools::Property& prop) const override;
71 double InteractwithQMRegion(const QMRegion& region) override;
72 double InteractwithPolarRegion(const PolarRegion& region) override;
73 double InteractwithStaticRegion(const StaticRegion& region) override;
74 double InteractwithEwaldRegion(const EwaldRegion& region) override;
75
76 private:
78 double StaticInteraction();
80
81 double PolarEnergy_extern() const;
83 Index CalcPolDoF() const;
84
85 Eigen::VectorXd CalcInducedDipoleInsideSegments() const;
86 Eigen::VectorXd ReadInducedDipolesFromLastIteration() const;
87
88 Eigen::VectorXd CalcInducedDipolesViaPCG(
89 const Eigen::VectorXd& initial_guess);
90 void WriteInducedDipolesToSegments(const Eigen::VectorXd& x);
91
93 double deltaE_ = 1e-5;
94 double deltaD_ = 1e-5;
96 double exp_damp_ = 0.39;
97};
98
99} // namespace xtp
100} // namespace votca
101
102#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:47
void AppendResult(tools::Property &prop) const override
void WriteInducedDipolesToSegments(const Eigen::VectorXd &x)
double InteractwithEwaldRegion(const EwaldRegion &region) override
void ReadFromCpt(CheckpointReader &r) override
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)
Eigen::VectorXd ReadInducedDipolesFromLastIteration() const
std::string identify() const override
Definition polarregion.h:49
hist< Energy_terms > E_hist_
Definition polarregion.h:92
void WriteToCpt(CheckpointWriter &w) const override
double InteractwithPolarRegion(const PolarRegion &region) override
double ExpDamp() const
Definition polarregion.h:63
void Evaluate(std::vector< std::unique_ptr< Region > > &regions) override
void Reset() override
double Etotal() const override
Definition polarregion.h:59
double InteractwithStaticRegion(const StaticRegion &region) override
double PolarEnergy_extern() const
ClassicalSegment< PolarSite > PolarSegment
Provides a means for comparing floating point numbers.
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26