votca 2024-dev
Loading...
Searching...
No Matches
xtp_run.cc
Go to the documentation of this file.
1
2/*
3 * Copyright 2009-2023 The VOTCA Development Team
4 * (http://www.votca.org)
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License")
7 *
8 * You may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 */
20
21// Local VOTCA includes
24#include <memory>
25
26using namespace votca;
27
28class XtpRun final : public xtp::StateApplication {
29 public:
30 XtpRun() = default;
31
32 ~XtpRun() = default;
33 std::string ProgramName() final { return "xtp_run"; }
34
35 void HelpText(std::ostream& out) final {
36 out << "Runs excitation/charge transport calculators\n";
37 }
38
39 protected:
40 void CreateCalculator(const std::string& name);
41 void ConfigCalculator();
42 bool savetoStateFile() const final { return calc_->WriteToStateFile(); }
43
44 bool EvaluateFrame(votca::xtp::Topology& top) final;
45 std::string CalculatorType() const { return "Calculator"; }
46 void CheckOptions() final{};
47 std::vector<std::string> CalculatorNames() const {
49 }
50
51 void AddCommandLineOpt() final{};
52
53 private:
54 std::unique_ptr<xtp::QMCalculator> calc_ = nullptr;
55};
56
57void XtpRun::CreateCalculator(const std::string& name) {
59}
60
62 std::cout << "... " << calc_->Identify() << std::endl;
63 Index nThreads = OptionsMap()["nthreads"].as<Index>();
64 calc_->setnThreads(nThreads);
65 calc_->Initialize(options_);
66}
67
69 std::cout << "... " << calc_->Identify() << std::endl;
70 return calc_->EvaluateFrame(top);
71}
72
73int main(int argc, char** argv) {
74
75 XtpRun xtprun;
76 return xtprun.Exec(argc, argv);
77}
std::vector< std::string > CalculatorNames() const
Definition xtp_run.cc:47
void CreateCalculator(const std::string &name)
Definition xtp_run.cc:57
void AddCommandLineOpt() final
Definition xtp_run.cc:51
bool EvaluateFrame(votca::xtp::Topology &top) final
Definition xtp_run.cc:68
void HelpText(std::ostream &out) final
help text of application without version information
Definition xtp_run.cc:35
std::string CalculatorType() const
Definition xtp_run.cc:45
void ConfigCalculator()
Definition xtp_run.cc:61
std::unique_ptr< xtp::QMCalculator > calc_
Definition xtp_run.cc:54
void CheckOptions() final
Definition xtp_run.cc:46
std::string ProgramName() final
program name
Definition xtp_run.cc:33
bool savetoStateFile() const final
Definition xtp_run.cc:42
XtpRun()=default
~XtpRun()=default
int Exec(int argc, char **argv)
executes the program
boost::program_options::variables_map & OptionsMap()
get available program options & descriptions
virtual std::unique_ptr< T > Create(const key_t &key, args_t &&...arguments)
std::vector< key_t > getKeys() const
Container for segments and box and atoms.
Definition topology.h:41
votca::tools::Property options_
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26
int main(int argc, char **argv)
Definition xtp_run.cc:73