votca 2024.1-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
40namespace votca {
41namespace xtp {
42
43class QMRegion;
44class PolarRegion;
45class StaticRegion;
46
47class Region {
48
49 public:
50 Region(Index id, Logger& log) : id_(id), log_(log) {};
51 virtual ~Region() = default;
52
53 virtual void WriteToCpt(CheckpointWriter& w) const = 0;
54
55 virtual void ReadFromCpt(CheckpointReader& r) = 0;
56
57 virtual void Initialize(const tools::Property& prop) = 0;
58
59 virtual bool Converged() const = 0;
60
61 virtual void Evaluate(std::vector<std::unique_ptr<Region> >& regions) = 0;
62
63 virtual Index size() const = 0;
64
65 virtual std::string identify() const = 0;
66
67 virtual void WritePDB(csg::PDBWriter& writer) const = 0;
68
69 virtual void Reset() = 0;
70
71 virtual double charge() const = 0;
72
73 bool Successful() const { return info_; }
74
75 std::string ErrorMsg() const { return errormsg_; }
76
77 void AddResults(tools::Property& prop) const;
78
79 Index getId() const { return id_; }
80
81 virtual double Etotal() const = 0;
82
83 friend std::ostream& operator<<(std::ostream& out, const Region& region) {
84 out << "Id: " << region.getId() << " type: " << region.identify()
85 << " size: " << region.size() << " charge[e]= " << region.charge();
86 return out;
87 }
88
89 protected:
90 bool info_ = true;
91 std::string errormsg_ = "";
92 std::vector<double> ApplyInfluenceOfOtherRegions(
93 std::vector<std::unique_ptr<Region> >& regions);
94 virtual void AppendResult(tools::Property& prop) const = 0;
95 virtual double InteractwithQMRegion(const QMRegion& region) = 0;
96 virtual double InteractwithPolarRegion(const PolarRegion& region) = 0;
97 virtual double InteractwithStaticRegion(const StaticRegion& region) = 0;
98
99 Index id_ = -1;
101};
102
103} // namespace xtp
104} // namespace votca
105
106#endif // VOTCA_XTP_REGION_H
class to manage program options with xml serialization functionality
Definition property.h:55
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:32
virtual void Reset()=0
virtual double charge() const =0
void AddResults(tools::Property &prop) const
Definition region.cc:67
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:79
virtual void AppendResult(tools::Property &prop) const =0
friend std::ostream & operator<<(std::ostream &out, const Region &region)
Definition region.h:83
Region(Index id, Logger &log)
Definition region.h:50
std::string errormsg_
Definition region.h:91
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:73
virtual bool Converged() const =0
virtual ~Region()=default
Logger & log_
Definition region.h:100
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:75
virtual double Etotal() const =0
virtual std::string identify() const =0
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26