votca 2026-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
31// Local VOTCA includes
33#include "votca/xtp/logger.h"
34
35namespace votca {
36namespace xtp {
37
38class Partialcharges final : public QMTool {
39 public:
40 Partialcharges() = default;
41 ~Partialcharges() = default;
42
43 std::string Identify() const { return "partialcharges"; }
44
45 protected:
46 void ParseOptions(const tools::Property& user_options);
47 bool Run();
48
49 private:
50 std::string orbfile_;
51 std::string output_file_;
53
55};
56
58
59 orbfile_ = options.ifExistsReturnElseReturnDefault<std::string>(
60 ".input", job_name_ + ".orb");
61 output_file_ = options.ifExistsReturnElseReturnDefault<std::string>(
62 ".output", job_name_ + ".mps");
63 esp_options_ = options.get(".esp2multipole");
64}
65
67 log_.setReportLevel(Log::current_level);
68 log_.setMultithreading(true);
69
70 log_.setCommonPreface("\n... ...");
71
72 Orbitals orbitals;
74 << " Loading QM data from " << orbfile_ << std::flush;
75 orbitals.ReadFromCpt(orbfile_);
76 Esp2multipole esp2multipole = Esp2multipole(log_);
77 esp2multipole.Initialize(esp_options_);
78 StaticSegment seg = esp2multipole.Extractingcharges(orbitals);
79 seg.WriteMPS(output_file_, esp2multipole.GetStateString());
80
82 << "Written charges to " << output_file_ << std::flush;
83
84 return true;
85}
86
87} // namespace xtp
88} // namespace votca
89
90#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:332
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
Container for molecular orbitals and derived one-particle data.
Definition orbitals.h:47
void ReadFromCpt(const std::string &filename)
Read the orbital container from a checkpoint file on disk.
Definition orbitals.cc:1215
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
ClassicalSegment< StaticSite > StaticSegment
Provides a means for comparing floating point numbers.
Definition basebead.h:33
static Level current_level
Definition globals.h:30