Loading...
Searching...
No Matches
ParametersSSOT.cpp
Go to the documentation of this file.
1/*
2** Apply defaults originating from schema/eon_params.capnp (via codegen).
3*/
7
8#include <string>
9#include <unordered_set>
10
11namespace eonc::config {
12namespace {
13
14// Catalog field index for ssot_has_field (mirrors generated catalog sections).
15const std::unordered_set<std::string> &field_index() {
16 static const std::unordered_set<std::string> idx = {
17#include "eon/generated/ParametersSSOTFieldIndex.inc"
18 };
19 return idx;
20}
21
22} // namespace
23
24JobType job_from_ssot(std::string_view j) {
25 if (j == "process_search")
27 if (j == "minimization")
29 if (j == "saddle_search")
31 if (j == "basin_hopping")
33 if (j == "parallel_replica" || j == "unbiased_parallel_replica")
35 if (j == "nudged_elastic_band")
37 if (j == "dynamics" || j == "molecular_dynamics")
38 return JobType::Dynamics;
39 if (j == "hessian")
40 return JobType::Hessian;
41 if (j == "point")
42 return JobType::Point;
43 if (j == "prefactor")
44 return JobType::Prefactor;
45 if (j == "monte_carlo")
47 if (j == "structure_comparison")
49 if (j == "gp_surrogate")
51 if (j == "safe_hyperdynamics")
53 if (j == "tad")
54 return JobType::TAD;
55 if (j == "replica_exchange")
57 if (j == "finite_difference" || j == "finite_differences")
59 if (j == "global_optimization")
61 if (j == "instanton")
62 return JobType::Instanton;
64}
65
66PotType pot_from_ssot(std::string_view pot) {
67 if (pot == "lj")
68 return PotType::LJ;
69 if (pot == "eam_al")
70 return PotType::EAM_AL;
71 if (pot == "emt")
72 return PotType::EMT;
73 if (pot == "lammps")
74 return PotType::LAMMPS;
75 if (pot == "morse_pt")
76 return PotType::MORSE_PT;
77 if (pot == "metatomic")
78 return PotType::METATOMIC;
79 if (pot == "xtb")
80 return PotType::XTB;
81 if (pot == "rgpot")
82 return PotType::RGPOT;
83 if (pot == "ext_pot")
84 return PotType::EXT_POT;
85 return PotType::LJ;
86}
87
88OptType opt_from_ssot(std::string_view m) {
89 if (m == "cg")
90 return OptType::CG;
91 if (m == "lbfgs")
92 return OptType::LBFGS;
93 if (m == "qm" || m == "quickmin")
94 return OptType::QM;
95 if (m == "sd")
96 return OptType::SD;
97 if (m == "fire")
98 return OptType::FIRE;
99 if (m == "xtsci")
100 return OptType::XTSCI;
101 return OptType::CG;
102}
103
105
114 std::string(GD::MAIN_INI_FILENAME);
116 std::string(GD::MAIN_CON_FILENAME);
127 std::string(GD::MAIN_INPUT_FORMAT);
131
145 std::string(GD::POTENTIAL_EXT_POT_PATH);
152
166
173
187
205 std::string(GD::OPTIMIZER_LBFGS_SECANT);
207 std::string(GD::OPTIMIZER_LBFGS_PRECON);
209 std::string(GD::OPTIMIZER_LBFGS_STEP);
211 std::string(GD::OPTIMIZER_LBFGS_H0);
213 std::string(GD::OPTIMIZER_LBFGS_ACCEPT);
227 std::string(GD::OPTIMIZER_XTSCI_METHOD);
229 std::string(GD::OPTIMIZER_XTSCI_QN_STEP);
231 std::string(GD::OPTIMIZER_XTSCI_PRECON);
233 std::string(GD::OPTIMIZER_XTSCI_ACCEPT);
237 std::string(GD::OPTIMIZER_XTSCI_MANIFOLD);
239 std::string(GD::OPTIMIZER_XTSCI_METHOD);
241 std::string(GD::OPTIMIZER_OPT_BACKEND);
242
255
261#include "eon/generated/ParametersSSOTApply.inc"
262}
263
264bool ssot_has_field(const char *section, const char *key) {
265 if (!section || !key)
266 return false;
267 std::string id = std::string(section) + "." + key;
268 return field_index().count(id) > 0;
269}
270
271} // namespace eonc::config
eonc::params_ssot::GeneratedDefaults GD
void apply_ssot_defaults(Parameters &p)
Apply SSoT defaults for covered groups (Main, Potential, Optimizer, Structure Comparison,...
PotType pot_from_ssot(std::string_view pot)
bool ssot_has_field(const char *section, const char *key)
Return true if section‍/*key* (snake_case INI name) is declared in the Cap'n Proto L0 catalog for cov...
JobType job_from_ssot(std::string_view j)
OptType opt_from_ssot(std::string_view m)
static structure_comparison_options_t & structure_comparison_options(Parameters &p)
static main_options_t & main_options(Parameters &p)
static process_search_options_t & process_search_options(Parameters &p)
static optimizer_options_t & optimizer_options(Parameters &p)
static potential_options_t & potential_options(Parameters &p)
double defaultVacuum
Vacuum (Angstrom) on every side of the box built when neither the file nor cell supplies one.
bool pbc
Periodicity of that fallback cell.
std::string inputFormat
Chemfiles format substituted for a .con request.
shared_flag writeConForces
Opt-in "Forces of Component" sections in written .con frames (enables force+energy co-load on restart...
std::string cell
Fallback cell when a foreign file carries none: "a b c" or nine row-major lattice numbers.
struct eonc::optimizer_options_t::sd_t sd
std::string backend
"eon" or "rgmin".
struct eonc::optimizer_options_t::quickmin_t quickmin
struct eonc::optimizer_options_t::xtsci_t xtsci
struct eonc::optimizer_options_t::cg_t cg
struct eonc::optimizer_options_t::lbfgs_t lbfgs
static constexpr auto PROCESS_SEARCH_MINIMIZATION_OFFSET
static constexpr auto STRUCTURE_COMPARISON_CHECK_ROTATION
static constexpr auto STRUCTURE_COMPARISON_DISTANCE_DIFFERENCE
static constexpr auto STRUCTURE_COMPARISON_NEIGHBOR_CUTOFF
static constexpr auto OPTIMIZER_LBFGS_MAX_INVERSE_CURVATURE
static constexpr auto STRUCTURE_COMPARISON_REMOVE_TRANSLATION
static constexpr auto STRUCTURE_COMPARISON_INDISTINGUISHABLE_ATOMS
static constexpr auto OPTIMIZER_QUICKMIN_STEEPEST_DESCENT
static constexpr auto OPTIMIZER_CG_MAX_ITER_BEFORE_RESET
static constexpr auto OPTIMIZER_LBFGS_INVERSE_CURVATURE
static constexpr auto STRUCTURE_COMPARISON_ENERGY_DIFFERENCE
static constexpr auto OPTIMIZER_CG_LINE_SEARCH_MAX_ITER
static constexpr auto OPTIMIZER_CG_KNOCK_OUT_MAX_MOVE
double pairSwitchWidth
Width (Angstrom) of the C^2 quintic switch that takes the lj, ljcluster and morse_pt pair terms to ze...
double pairCutoff
Cutoff (Angstrom) of the lj, ljcluster and morse_pt pair terms.