51 "Usage: scale [OPTION] <E> <alpha> <dim>\n\n" 52 "Print action under a change of units.\n\n" 53 "Example: scale 1.0 0.6 2.0\n\n" 55 " -h, --help print this help message\n" 56 " -v, --verbose produce verbose output" 60 bool starts_with(
const std::string& option,
const std::string& prefix)
62 return !option.compare(0, prefix.size(), prefix);
68 const auto n_positional_args = args.size();
70 if (n_positional_args == 0) {
72 "value of E must be provided");
73 }
else if (n_positional_args == 1) {
75 "value of alpha must be provided");
76 }
else if (n_positional_args == 2) {
78 "scale factor must be provided");
79 }
else if (n_positional_args > 3) {
81 "unrecognized command line argument '" 86 options.
E = std::stod(args[0]);
87 }
catch (
const std::invalid_argument& e) {
89 "invalid value for E, '" + args[0] +
"'");
93 options.
alpha = std::stod(args[1]);
94 }
catch (
const std::invalid_argument& e) {
96 "invalid value for alpha, '" + args[1] +
"'");
100 options.
scale = std::stod(args[2]);
101 }
catch (
const std::invalid_argument& e) {
103 "invalid value for scale factor '" + args[2] +
"'");
111 std::vector<std::string> positional_args;
113 bool finished_optionals{
false};
115 const std::string opt(argv[i++]);
118 finished_optionals =
true;
122 if (!
starts_with(opt,
"-") || finished_optionals) {
123 positional_args.push_back(opt);
127 if (opt ==
"-h" || opt ==
"--help") {
132 if (opt ==
"-v" || opt ==
"--verbose") {
138 "unrecognized command line argument '" + opt +
"'");
148 int main(
int argc,
const char* argv[])
153 std::cerr <<
"Usage: scale [OPTION] <E> <alpha> <scale>\n" 154 <<
"Try 'scale --help' for more information." 168 const double E = options.
E;
172 const double false_min = 0.;
173 const double true_min =
scale;
174 const double barrier = (0.75 / alpha - 1.) *
scale;
176 const auto potential = [
E,
alpha,
scale](
double phi) {
178 return -pow(scale, 4) * E * (-alpha * phi * phi * phi * phi
180 + 0.5 * (4. * alpha - 3.) * phi * phi);
183 const auto potential_first = [
E,
alpha,
scale](
double phi) {
185 return -pow(scale, 3) * E * (-4. * alpha * phi * phi * phi
187 + (4. * alpha - 3.) * phi);
190 const auto potential_second = [
E,
alpha,
scale](
double phi) {
192 return -pow(scale, 2) * E * (-12. * alpha * phi * phi
193 + 6. * phi + (4. * alpha - 3.));
197 one_dim.
solve(potential, potential_first, potential_second,
198 false_min, true_min, barrier,
199 4, Shooting::Solver_options::Compute_action);
202 }
catch (
const Error& e) {
203 std::cerr <<
"Error: " << e.what() << std::endl;
204 exit_code = EXIT_FAILURE;
206 std::cerr <<
"Error: unrecognized error occurred." 208 exit_code = EXIT_FAILURE;
void parse_positional_args(const std::vector< std::string > &args, Fubini_options &options)
Functions for calculating action for one-dimensional potential parameterized by and ...
Bubble_profiler_inputs parse_cmd_line_args(int argc, const char *argv[])
void solve(const std::function< double(double)> &potential_, const std::function< double(double)> &potential_first_, const std::function< double(double)> &potential_second_, double false_min_, double true_min_, double barrier_, int dim_=3, unsigned int options=(Solver_options::Compute_action|Solver_options::Compute_profile))
static Logging_manager & get_manager()
double get_euclidean_action() const
int main(int argc, const char *argv[])
void set_minimum_log_level(Log_level level)
Solve the one-dimensional problem using the shooting method.
Exception indicating general setup error.
One-dimensional shooting method.
bool starts_with(const std::string &option, const std::string &prefix)