21#include <boost/format.hpp>
24#include <boost/filesystem.hpp>
25#include <boost/format.hpp>
53 namespace propt = boost::program_options;
55 "options,o", propt::value<std::string>(),
59 " number of threads to create");
62 "execute,e", propt::value<std::string>(),
66 std::string(
"Lists all available " +
CalculatorType() +
"s").c_str());
68 "description,d", propt::value<std::string>(),
69 std::string(
"Short description of a " +
CalculatorType() +
"s").c_str());
72 "cmdoptions,c", propt::value<std::vector<std::string>>()->multitoken(),
73 "Modify options via command line by e.g. '-c xmltag.subtag=value'. "
74 "Use whitespace to separate multiple options");
77 "printoptions,p", propt::value<std::string>(),
78 std::string(
"Prints xml options of a " +
CalculatorType()).c_str());
82 " Number of gpus to use");
103 std::string calcname =
OptionsMap()[
"description"].as<std::string>();
108 std::cout <<
CalculatorType() <<
" " << calcname <<
" does not exist\n";
115 std::string calcname =
OptionsMap()[
"printoptions"].as<std::string>();
117 std::string optionsFile;
119 optionsFile =
OptionsMap()[
"options"].as<std::string>();
121 throw std::runtime_error(
122 "Please specify a --options file to print options for calculator "
126 out.open(optionsFile);
127 std::cout <<
"Writing options for calculator " << calcname <<
" to "
128 << optionsFile << std::endl;
129 out <<
"<options>\n";
131 out <<
"</options>\n" << std::endl;
133 std::cout <<
CalculatorType() <<
" " << calcname <<
" does not exist\n";
141 std::string calcname =
OptionsMap()[
"execute"].as<std::string>();
146 std::cout <<
CalculatorType() <<
" " << calcname <<
" does not exist\n";
154 std::string optionsFile =
OptionsMap()[
"options"].as<std::string>();
159 opts.
add(calcname,
"");
163 for (
const std::string &opt :
164 OptionsMap()[
"cmdoptions"].as<std::vector<std::string>>()) {
166 if (entries.size() != 2) {
167 throw std::runtime_error(opt +
" is not well formated!");
169 useroptions.
getOradd(
"options." + calcname +
"." + entries[0]).
value() =
179 if (calcname ==
"qmmm") {
183 .
get(
"options." + calcname);
209 const std::string &calculator_name)
const {
210 std::string xmlfile =
215 std::string help_string = options.
get(
"options." + calculator_name)
217 boost::format format(
"%|3t|%1% %|20t|%2% \n");
218 out << format % calculator_name % help_string;
222 std::ostream &out,
const std::string &calculator_name,
227 out << iom << options;
static void SetNoGPUs(Index number)
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.
void HelpTextHeader(const std::string &tool_name)
base class for all analysis tools