votca 2024.2-dev
Loading...
Searching...
No Matches
xtp_tools.cc
Go to the documentation of this file.
1/*
2 * Copyright 2009-2023 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// VOTCA includes
22
23// Local VOTCA includes
24#include "votca/xtp/qmtool.h"
26#include "votca/xtp/version.h"
28
29using namespace votca;
30
31class XtpTools final : public xtp::XtpApplication {
32 public:
34
35 ~XtpTools() = default;
36
37 std::string ProgramName() final { return "xtp_tools"; }
38
39 void HelpText(std::ostream& out) final {
40 out << "Runs excitation/charge transport tools\n";
41 }
42
43 protected:
44 void CreateCalculator(const std::string& name) final;
45
46 void execute() final;
47 std::string CalculatorType() const final { return "Tool"; }
48 void EvaluateSpecificOptions() final;
49 std::vector<std::string> CalculatorNames() const final {
50 return xtp::QMToolFactory().getKeys();
51 }
52
53 void AddCommandLineOptions() final;
54
55 private:
56 std::unique_ptr<xtp::QMTool> tool_;
57};
58
59void XtpTools::CreateCalculator(const std::string& name) {
61}
63
65
67
68 Index nThreads = OptionsMap()["nthreads"].as<Index>();
69
70 std::cout << "Initializing tool\n";
71 std::cout << "... " << tool_->Identify() << " " << std::flush;
72 tool_->setnThreads(nThreads);
74
75 std::cout << "Evaluating tool\n";
76 std::cout << "... " << tool_->Identify() << " " << std::flush;
77 tool_->Evaluate();
78}
79
80int main(int argc, char** argv) {
81
82 XtpTools xtpapp;
83 return xtpapp.Exec(argc, argv);
84}
void EvaluateSpecificOptions() final
Definition xtp_tools.cc:64
~XtpTools()=default
std::vector< std::string > CalculatorNames() const final
Definition xtp_tools.cc:49
std::string ProgramName() final
program name
Definition xtp_tools.cc:37
std::unique_ptr< xtp::QMTool > tool_
Definition xtp_tools.cc:56
void AddCommandLineOptions() final
Definition xtp_tools.cc:62
void execute() final
Definition xtp_tools.cc:66
void CreateCalculator(const std::string &name) final
Definition xtp_tools.cc:59
void HelpText(std::ostream &out) final
help text of application without version information
Definition xtp_tools.cc:39
std::string CalculatorType() const final
Definition xtp_tools.cc:47
int Exec(int argc, char **argv)
executes the program
boost::program_options::variables_map & OptionsMap()
get available program options & descriptions
void setnThreads(Index nThreads)
Sets number of threads to use.
Definition calculator.h:83
virtual std::unique_ptr< T > Create(const key_t &key, args_t &&...arguments)
std::vector< key_t > getKeys() const
std::string Identify() const override=0
Calculator name.
void Initialize(const tools::Property &options) final
Initializes a calculator from an XML file with options.
Definition qmtool.cc:27
votca::tools::Property options_
STL namespace.
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_tools.cc:80