21#include <boost/format.hpp>
24#include <boost/format.hpp>
52 namespace propt = boost::program_options;
54 "options,o", propt::value<std::string>(),
58 " number of threads to create");
60 "memory,M", propt::value<double>()->default_value(0.0),
61 " memory in GB for the whole process, used to choose caches and batch "
62 "sizes (shared equally by concurrent jobs; 0: built-in defaults)");
65 "execute,e", propt::value<std::string>(),
69 std::string(
"Lists all available " +
CalculatorType() +
"s").c_str());
71 "description,d", propt::value<std::string>(),
72 std::string(
"Short description of a " +
CalculatorType() +
"s").c_str());
75 "cmdoptions,c", propt::value<std::vector<std::string>>()->multitoken(),
76 "Modify options via command line by e.g. '-c xmltag.subtag=value'. "
77 "Use whitespace to separate multiple options");
80 "printoptions,p", propt::value<std::string>(),
81 std::string(
"Prints xml options of a " +
CalculatorType()).c_str());
99 std::string calcname =
OptionsMap()[
"description"].as<std::string>();
104 std::cout <<
CalculatorType() <<
" " << calcname <<
" does not exist\n";
111 std::string calcname =
OptionsMap()[
"printoptions"].as<std::string>();
113 std::string optionsFile;
115 optionsFile =
OptionsMap()[
"options"].as<std::string>();
117 throw std::runtime_error(
118 "Please specify a --options file to print options for calculator "
122 out.open(optionsFile);
123 std::cout <<
"Writing options for calculator " << calcname <<
" to "
124 << optionsFile << std::endl;
125 out <<
"<options>\n";
127 out <<
"</options>\n" << std::endl;
129 std::cout <<
CalculatorType() <<
" " << calcname <<
" does not exist\n";
137 std::string calcname =
OptionsMap()[
"execute"].as<std::string>();
142 std::cout <<
CalculatorType() <<
" " << calcname <<
" does not exist\n";
150 std::string optionsFile =
OptionsMap()[
"options"].as<std::string>();
155 opts.
add(calcname,
"");
159 for (
const std::string &opt :
160 OptionsMap()[
"cmdoptions"].as<std::vector<std::string>>()) {
162 if (entries.size() != 2) {
163 throw std::runtime_error(opt +
" is not well formated!");
165 useroptions.
getOradd(
"options." + calcname +
"." + entries[0]).
value() =
175 if (calcname ==
"qmmm") {
179 .
get(
"options." + calcname);
205 const std::string &calculator_name)
const {
206 std::string xmlfile =
211 std::string help_string = options.
get(
"options." + calculator_name)
213 boost::format format(
"%|3t|%1% %|20t|%2% \n");
214 out << format % calculator_name % help_string;
218 std::ostream &out,
const std::string &calculator_name,
223 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.
Charge transport classes.
void HelpTextHeader(const std::string &tool_name)
Provides a means for comparing floating point numbers.