votca 2024.2-dev
Loading...
Searching...
No Matches
mmregion.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_MMREGION_H
22#define VOTCA_XTP_MMREGION_H
23
24// Local VOTCA includes
25#include "classicalsegment.h"
26#include "region.h"
27
28namespace votca {
29namespace xtp {
30
31class QMRegion;
32class PolarRegion;
33class StaticRegion;
34
35template <class T>
36class MMRegion : public Region {
37 public:
38 MMRegion(Index id, Logger& log) : Region(id, log) {};
39 void WriteToCpt(CheckpointWriter& w) const override;
40
41 using SegmentType = T;
42
43 void ReadFromCpt(CheckpointReader& r) override;
44
45 Index size() const override { return Index(segments_.size()); }
46
47 using iterator = typename std::vector<T>::iterator;
48
49 void Initialize(const tools::Property& prop) override = 0;
50
51 bool Converged() const override = 0;
52
53 void Evaluate(std::vector<std::unique_ptr<Region> >& regions) override = 0;
54
55 std::string identify() const override = 0;
56
57 const T& operator[](Index index) const { return segments_[index]; }
58 T& operator[](Index index) { return segments_[index]; }
59
60 typename std::vector<T>::iterator begin() { return segments_.begin(); }
61 typename std::vector<T>::iterator end() { return segments_.end(); }
62
63 typename std::vector<T>::const_iterator begin() const {
64 return segments_.begin();
65 }
66 typename std::vector<T>::const_iterator end() const {
67 return segments_.end();
68 }
69
70 double Etotal() const override = 0;
71
72 void Reset() override = 0;
73
74 double charge() const override;
75
76 void WritePDB(csg::PDBWriter& writer) const override;
77
78 void push_back(const T& seg) { segments_.push_back(seg); }
79
80 protected:
81 void AppendResult(tools::Property& prop) const override = 0;
82 double InteractwithQMRegion(const QMRegion& region) override = 0;
83 double InteractwithPolarRegion(const PolarRegion& region) override = 0;
84 double InteractwithStaticRegion(const StaticRegion& region) override = 0;
85
86 std::vector<T> segments_;
87};
88
89} // namespace xtp
90} // namespace votca
91
92#endif // VOTCA_XTP_MMREGION_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
T & operator[](Index index)
Definition mmregion.h:58
typename std::vector< T >::iterator iterator
Definition mmregion.h:47
double InteractwithPolarRegion(const PolarRegion &region) override=0
std::vector< T >::iterator begin()
Definition mmregion.h:60
Index size() const override
Definition mmregion.h:45
void Reset() override=0
void push_back(const T &seg)
Definition mmregion.h:78
std::vector< T > segments_
Definition mmregion.h:86
void WriteToCpt(CheckpointWriter &w) const override
Definition mmregion.cc:45
void Evaluate(std::vector< std::unique_ptr< Region > > &regions) override=0
void WritePDB(csg::PDBWriter &writer) const override
Definition mmregion.cc:38
MMRegion(Index id, Logger &log)
Definition mmregion.h:38
void Initialize(const tools::Property &prop) override=0
double InteractwithStaticRegion(const StaticRegion &region) override=0
std::vector< T >::const_iterator end() const
Definition mmregion.h:66
void ReadFromCpt(CheckpointReader &r) override
Definition mmregion.cc:58
void AppendResult(tools::Property &prop) const override=0
const T & operator[](Index index) const
Definition mmregion.h:57
std::string identify() const override=0
double charge() const override
Definition mmregion.cc:27
std::vector< T >::const_iterator begin() const
Definition mmregion.h:63
double InteractwithQMRegion(const QMRegion &region) override=0
bool Converged() const override=0
double Etotal() const override=0
std::vector< T >::iterator end()
Definition mmregion.h:61
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26