votca 2024.1-dev
Loading...
Searching...
No Matches
partialcharges.h
Go to the documentation of this file.
1
2
3/*
4 * Copyright 2009-2020 The VOTCA Development Team
5 * (http://www.votca.org)
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License")
8 *
9 * You may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 */
21
22#pragma once
23#ifndef VOTCA_XTP_PARTIALCHARGES_H
24#define VOTCA_XTP_PARTIALCHARGES_H
25
26// Standard includes
27#include <cstdio>
28
29// Third party includes
30#include <boost/filesystem.hpp>
31
32// Local VOTCA includes
34#include "votca/xtp/logger.h"
35
36namespace votca {
37namespace xtp {
38
39class Partialcharges final : public QMTool {
40 public:
41 Partialcharges() = default;
42 ~Partialcharges() = default;
43
44 std::string Identify() const { return "partialcharges"; }
45
46 protected:
47 void ParseOptions(const tools::Property& user_options);
48 bool Run();
49
50 private:
51 std::string orbfile_;
52 std::string output_file_;
54
56};
57
59
60 orbfile_ = options.ifExistsReturnElseReturnDefault<std::string>(
61 ".input", job_name_ + ".orb");
62 output_file_ = options.ifExistsReturnElseReturnDefault<std::string>(
63 ".output", job_name_ + ".mps");
64 esp_options_ = options.get(".esp2multipole");
65}
66
70
71 log_.setCommonPreface("\n... ...");
72
73 Orbitals orbitals;
75 << " Loading QM data from " << orbfile_ << std::flush;
76 orbitals.ReadFromCpt(orbfile_);
77 Esp2multipole esp2multipole = Esp2multipole(log_);
78 esp2multipole.Initialize(esp_options_);
79 StaticSegment seg = esp2multipole.Extractingcharges(orbitals);
80 seg.WriteMPS(output_file_, esp2multipole.GetStateString());
81
83 << "Written charges to " << output_file_ << std::flush;
84
85 return true;
86}
87
88} // namespace xtp
89} // namespace votca
90
91#endif // VOTCA_XTP_PARTIALCHARGES_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 ifExistsReturnElseReturnDefault(const std::string &key, T defaultvalue) const
Definition property.h:321
void WriteMPS(std::string filename, std::string header) const
void Initialize(tools::Property &options)
std::string GetStateString() const
StaticSegment Extractingcharges(const Orbitals &orbitals) const
Logger is used for thread-safe output of messages.
Definition logger.h:164
void setReportLevel(Log::Level ReportLevel)
Definition logger.h:185
void setMultithreading(bool maverick)
Definition logger.h:186
void setCommonPreface(const std::string &preface)
Definition logger.h:198
container for molecular orbitals
Definition orbitals.h:46
void ReadFromCpt(const std::string &filename)
Definition orbitals.cc:692
std::string Identify() const
Calculator name.
void ParseOptions(const tools::Property &user_options)
std::string job_name_
Definition qmtool.h:50
#define XTP_LOG(level, log)
Definition logger.h:40
base class for all analysis tools
Definition basebead.h:33
static Level current_level
Definition globals.h:30