votca 2024.2-dev
Loading...
Searching...
No Matches
qmpackage.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2022 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
22#ifndef VOTCA_XTP_QMPACKAGE_H
23#define VOTCA_XTP_QMPACKAGE_H
24
25#include <memory>
26// VOTCA includes
28
29// Local VOTCA includes
30#include "aobasis.h"
31#include "classicalsegment.h"
32#include "logger.h"
33#include "staticsite.h"
35
36namespace votca {
37namespace xtp {
38
39class Orbitals;
40
41class QMPackage {
42 public:
43 virtual ~QMPackage() = default;
44
45 virtual std::string getPackageName() const = 0;
46
47 void Initialize(const tools::Property& options);
48
50 virtual bool WriteInputFile(const Orbitals& orbitals) = 0;
51
52 bool Run();
53 bool RunActiveRegion();
54 virtual bool ParseLogFile(Orbitals& orbitals) = 0;
55
56 virtual bool ParseMOsFile(Orbitals& orbitals) = 0;
57
58 virtual void CleanUp() = 0;
59
60 template <class MMRegion>
61 void AddRegion(const MMRegion& mmregion) {
62
63 using Segmenttype = typename MMRegion::SegmentType;
64 using Sitetype = typename Segmenttype::Atom_Type;
65 for (const Segmenttype& segment : mmregion) {
66 for (const Sitetype& site : segment) {
67 externalsites_.push_back(std::make_unique<Sitetype>(site));
68 }
69 }
71 }
72
73 void setRunDir(const std::string& run_dir) { run_dir_ = run_dir; }
74
75 void setInputFileName(const std::string& input_file_name) {
76 input_file_name_ = input_file_name;
77 }
78
79 void setLogFileName(const std::string& log_file_name) {
80 log_file_name_ = log_file_name;
81 }
82
83 void setMOsFileName(const std::string& mo_file) { mo_file_name_ = mo_file; }
84
85 void setLog(Logger* pLog) { pLog_ = pLog; }
86
87 void setCharge(Index charge) {
88 charge_ = charge;
89 spin_ = std::abs(charge) + 1;
90 }
91
92 bool GuessRequested() const {
93 return options_.get("initial_guess").as<std::string>() == "orbfile";
94 }
95
96 virtual StaticSegment GetCharges() const = 0;
97
98 virtual Eigen::Matrix3d GetPolarizability() const = 0;
99
100 std::string getLogFile() const { return log_file_name_; };
101
102 std::string getMOFile() const { return mo_file_name_; };
103
104 protected:
105 virtual void ParseSpecificOptions(const tools::Property& options) = 0;
107 MinimalMMCharge(const Eigen::Vector3d& pos, double q) : pos_(pos), q_(q) {};
108 Eigen::Vector3d pos_;
109 double q_;
110 };
111
112 virtual bool RunDFT() = 0;
113 virtual bool RunActiveDFT() = 0;
114 virtual void WriteChargeOption() = 0;
115 std::vector<MinimalMMCharge> SplitMultipoles(const StaticSite& site) const;
116 void ReorderOutput(Orbitals& orbitals) const;
117 Eigen::MatrixXd ReorderMOsBack(const Orbitals& orbitals) const;
118 bool isLinker(std::string name, std::vector<std::string> linker_names);
119
120 std::vector<std::string> GetLineAndSplit(std::ifstream& input_file,
121 const std::string separators) const;
122
123 // ShellReorder() and ShellMulitplier() specify the order for each
124 // QMPackage. Some codes also use different normalisation conditions which
125 // lead to other signs for some of the entries, which can be changed via the
126 // multipliers.
127 virtual const std::array<Index, 49>& ShellMulitplier() const = 0;
128 virtual const std::array<Index, 49>& ShellReorder() const = 0;
129
131 Index spin_; // 2S+1mem
132 std::string basisset_name_;
133 std::string cleanup_ = "";
134 std::string input_file_name_;
135 std::string log_file_name_;
136 std::string mo_file_name_;
137 std::string run_dir_;
138 std::string scratch_dir_;
139 std::string shell_file_name_;
141
143
144 std::vector<std::unique_ptr<StaticSite> > externalsites_;
145};
146
147} // namespace xtp
148} // namespace votca
149
150#endif // VOTCA_XTP_QMPACKAGE_H
class to manage program options with xml serialization functionality
Definition property.h:55
Property & get(const std::string &key)
get existing property
Definition property.cc:79
T as() const
return value as type
Definition property.h:283
Logger is used for thread-safe output of messages.
Definition logger.h:164
container for molecular orbitals
Definition orbitals.h:46
virtual ~QMPackage()=default
virtual void WriteChargeOption()=0
void setCharge(Index charge)
Definition qmpackage.h:87
std::string log_file_name_
Definition qmpackage.h:135
virtual Eigen::Matrix3d GetPolarizability() const =0
virtual const std::array< Index, 49 > & ShellReorder() const =0
void setLog(Logger *pLog)
Definition qmpackage.h:85
virtual void CleanUp()=0
std::vector< std::string > GetLineAndSplit(std::ifstream &input_file, const std::string separators) const
Definition qmpackage.cc:144
std::string run_dir_
Definition qmpackage.h:137
bool GuessRequested() const
Definition qmpackage.h:92
std::vector< std::unique_ptr< StaticSite > > externalsites_
Definition qmpackage.h:144
virtual std::string getPackageName() const =0
Eigen::MatrixXd ReorderMOsBack(const Orbitals &orbitals) const
Definition qmpackage.cc:97
std::vector< MinimalMMCharge > SplitMultipoles(const StaticSite &site) const
Definition qmpackage.cc:109
void setLogFileName(const std::string &log_file_name)
Definition qmpackage.h:79
std::string mo_file_name_
Definition qmpackage.h:136
virtual void ParseSpecificOptions(const tools::Property &options)=0
std::string getMOFile() const
Definition qmpackage.h:102
virtual bool RunDFT()=0
virtual bool RunActiveDFT()=0
virtual StaticSegment GetCharges() const =0
virtual bool WriteInputFile(const Orbitals &orbitals)=0
writes a coordinate file WITHOUT taking into account PBCs
void setRunDir(const std::string &run_dir)
Definition qmpackage.h:73
void AddRegion(const MMRegion &mmregion)
Definition qmpackage.h:61
virtual bool ParseLogFile(Orbitals &orbitals)=0
std::string basisset_name_
Definition qmpackage.h:132
std::string cleanup_
Definition qmpackage.h:133
bool isLinker(std::string name, std::vector< std::string > linker_names)
void Initialize(const tools::Property &options)
Definition qmpackage.cc:35
virtual const std::array< Index, 49 > & ShellMulitplier() const =0
tools::Property options_
Definition qmpackage.h:140
virtual bool ParseMOsFile(Orbitals &orbitals)=0
std::string shell_file_name_
Definition qmpackage.h:139
void setMOsFileName(const std::string &mo_file)
Definition qmpackage.h:83
std::string scratch_dir_
Definition qmpackage.h:138
std::string input_file_name_
Definition qmpackage.h:134
void setInputFileName(const std::string &input_file_name)
Definition qmpackage.h:75
std::string getLogFile() const
Definition qmpackage.h:100
void ReorderOutput(Orbitals &orbitals) const
Definition qmpackage.cc:74
Class to represent Atom/Site in electrostatic.
Definition staticsite.h:37
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26
MinimalMMCharge(const Eigen::Vector3d &pos, double q)
Definition qmpackage.h:107