21#include <boost/format.hpp>
24#include <boost/format.hpp>
53 namespace propt = boost::program_options;
55 "options,o", propt::value<std::string>(),
59 " number of threads to create");
61 "memory,M", propt::value<double>()->default_value(0.0),
62 " memory in GB for the whole process, used to choose caches and batch "
63 "sizes (shared equally by concurrent jobs; 0: built-in defaults)");
66 "execute,e", propt::value<std::string>(),
70 std::string(
"Lists all available " +
CalculatorType() +
"s").c_str());
72 "description,d", propt::value<std::string>(),
73 std::string(
"Short description of a " +
CalculatorType() +
"s").c_str());
76 "cite", propt::value<std::string>(),
78 " (the end of each run lists those actually used)")
82 "cmdoptions,c", propt::value<std::vector<std::string>>()->multitoken(),
83 "Modify options via command line by e.g. '-c xmltag.subtag=value'. "
84 "Use whitespace to separate multiple options");
87 "printoptions,p", propt::value<std::string>(),
88 std::string(
"Prints xml options of a " +
CalculatorType()).c_str());
106 std::string calcname =
OptionsMap()[
"description"].as<std::string>();
111 std::cout <<
CalculatorType() <<
" " << calcname <<
" does not exist\n";
118 std::string calcname =
OptionsMap()[
"cite"].as<std::string>();
122 std::cout <<
CalculatorType() <<
" " << calcname <<
" does not exist\n";
128 std::string calcname =
OptionsMap()[
"printoptions"].as<std::string>();
130 std::string optionsFile;
132 optionsFile =
OptionsMap()[
"options"].as<std::string>();
134 throw std::runtime_error(
135 "Please specify a --options file to print options for calculator "
139 out.open(optionsFile);
140 std::cout <<
"Writing options for calculator " << calcname <<
" to "
141 << optionsFile << std::endl;
142 out <<
"<options>\n";
144 out <<
"</options>\n" << std::endl;
146 std::cout <<
CalculatorType() <<
" " << calcname <<
" does not exist\n";
154 std::string calcname =
OptionsMap()[
"execute"].as<std::string>();
159 std::cout <<
CalculatorType() <<
" " << calcname <<
" does not exist\n";
167 std::string optionsFile =
OptionsMap()[
"options"].as<std::string>();
172 opts.
add(calcname,
"");
176 for (
const std::string &opt :
177 OptionsMap()[
"cmdoptions"].as<std::vector<std::string>>()) {
179 if (entries.size() != 2) {
180 throw std::runtime_error(opt +
" is not well formated!");
182 useroptions.
getOradd(
"options." + calcname +
"." + entries[0]).
value() =
192 if (calcname ==
"qmmm") {
196 .
get(
"options." + calcname);
211 const std::string calcname =
OptionsMap()[
"execute"].as<std::string>();
233 const std::string &calculator_name)
const {
234 std::string xmlfile =
239 std::string help_string = options.
get(
"options." + calculator_name)
241 boost::format format(
"%|3t|%1% %|20t|%2% \n");
242 out << format % calculator_name % help_string;
246 std::ostream &out,
const std::string &calculator_name,
251 out << iom << options;
static void Set(double total_gb, Index concurrent_jobs=1)
total_gb <= 0: no budget given
virtual void CreateCalculator(const std::string &name)=0
virtual std::vector< std::string > CalculatorNames() const =0
void PrintLongHelp(std::ostream &out, const std::string &calculator_name, tools::PropertyIOManipulator::Type format) const
void Initialize() final
Adds program options to the executable.
bool CalcExists(const std::string &name) const
virtual std::string CalculatorType() const =0
votca::tools::Property options_
~XtpApplication() override
void ShowHelpText(std::ostream &out) final
void Run() final
Main body of application.
virtual void EvaluateSpecificOptions()=0
virtual void AddCommandLineOptions()=0
void PrintShortHelp(std::ostream &out, const std::string &calculator_name) const
bool EvaluateOptions() final
Process command line options.
CalculatorEntry ForCalculator(const std::string &name)
the references of a calculator or tool (empty for unknown names)
std::string CalculatorReport(const std::string &name)
the text printed by –cite
void Cite(const std::string &key)
marks a reference as used (thread safe; unknown keys are printed as such)
std::string Report()
the block printed at the end of a run (empty if nothing was cited)
Charge transport classes.
void HelpTextHeader(const std::string &tool_name)
Provides a means for comparing floating point numbers.