votca 2026-dev
Loading...
Searching...
No Matches
region.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#pragma once
20#ifndef VOTCA_XTP_REGION_H
21#define VOTCA_XTP_REGION_H
22
23// Standard includes
24#include <iostream>
25
26// VOTCA includes
27#include <votca/csg/pdbwriter.h>
28
29// Local VOTCA includes
30#include "checkpoint.h"
31#include "logger.h"
32
39
40namespace votca {
41namespace xtp {
42
43class QMRegion;
44class PolarRegion;
45class StaticRegion;
46class EwaldRegion;
47
48class Region {
49
50 public:
51 Region(Index id, Logger& log) : id_(id), log_(log) {};
52 virtual ~Region() = default;
53
54 virtual void WriteToCpt(CheckpointWriter& w) const = 0;
55
56 virtual void ReadFromCpt(CheckpointReader& r) = 0;
57
58 virtual void Initialize(const tools::Property& prop) = 0;
59
60 virtual bool Converged() const = 0;
61
62 virtual void Evaluate(std::vector<std::unique_ptr<Region> >& regions) = 0;
63
64 virtual Index size() const = 0;
65
66 virtual std::string identify() const = 0;
67
68 virtual void WritePDB(csg::PDBWriter& writer) const = 0;
69
70 virtual void Reset() = 0;
71
72 virtual double charge() const = 0;
73
74 bool Successful() const { return info_; }
75
76 std::string ErrorMsg() const { return errormsg_; }
77
78 void AddResults(tools::Property& prop) const;
79
80 Index getId() const { return id_; }
81
82 virtual double Etotal() const = 0;
83
84 friend std::ostream& operator<<(std::ostream& out, const Region& region) {
85 out << "Id: " << region.getId() << " type: " << region.identify()
86 << " size: " << region.size() << " charge[e]= " << region.charge();
87 return out;
88 }
89
90 protected:
91 bool info_ = true;
92 std::string errormsg_ = "";
93 std::vector<double> ApplyInfluenceOfOtherRegions(
94 std::vector<std::unique_ptr<Region> >& regions);
95 virtual void AppendResult(tools::Property& prop) const = 0;
96 virtual double InteractwithQMRegion(const QMRegion& region) = 0;
97 virtual double InteractwithPolarRegion(const PolarRegion& region) = 0;
98 virtual double InteractwithStaticRegion(const StaticRegion& region) = 0;
99 // The periodic Ewald background. Unlike the three above, the
100 // relationship is one-way: EwaldRegion is frozen, so its own
101 // Interactwith* overrides all return 0.0, while every other region
102 // implements this to receive the background's field.
103 virtual double InteractwithEwaldRegion(const EwaldRegion& region) = 0;
104
105 Index id_ = -1;
107};
108
109} // namespace xtp
110} // namespace votca
111
112#endif // VOTCA_XTP_REGION_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
virtual void WriteToCpt(CheckpointWriter &w) const =0
std::vector< double > ApplyInfluenceOfOtherRegions(std::vector< std::unique_ptr< Region > > &regions)
Definition region.cc:33
virtual void Reset()=0
virtual double charge() const =0
void AddResults(tools::Property &prop) const
Definition region.cc:72
virtual double InteractwithQMRegion(const QMRegion &region)=0
virtual Index size() const =0
virtual void Initialize(const tools::Property &prop)=0
Index getId() const
Definition region.h:80
virtual void AppendResult(tools::Property &prop) const =0
friend std::ostream & operator<<(std::ostream &out, const Region &region)
Definition region.h:84
Region(Index id, Logger &log)
Definition region.h:51
std::string errormsg_
Definition region.h:92
virtual double InteractwithStaticRegion(const StaticRegion &region)=0
virtual void ReadFromCpt(CheckpointReader &r)=0
virtual double InteractwithPolarRegion(const PolarRegion &region)=0
bool Successful() const
Definition region.h:74
virtual bool Converged() const =0
virtual double InteractwithEwaldRegion(const EwaldRegion &region)=0
virtual ~Region()=default
Logger & log_
Definition region.h:106
virtual void WritePDB(csg::PDBWriter &writer) const =0
virtual void Evaluate(std::vector< std::unique_ptr< Region > > &regions)=0
std::string ErrorMsg() const
Definition region.h:76
virtual double Etotal() const =0
virtual std::string identify() const =0
Provides a means for comparing floating point numbers.
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26