Loading...
Searching...
No Matches
eonc::JobResultEnvelope Struct Reference

In-memory JobResult scalars. More...

#include <JobResult.h>

Public Member Functions

std::string processSearchString () const
std::string toString () const
void writeResultsDat (const std::string &path) const

Static Public Member Functions

static JobResultEnvelope fromMinimization (RunStatus status, PotType pot, std::uint64_t fcalls, bool hasE, double energy)
static JobResultEnvelope fromProcessSearch (int status, std::string statusText, PotType pot, std::int64_t seed, std::uint64_t fMin, std::uint64_t fSaddle, std::uint64_t fPref, double eSaddle, double eReactant, double eProduct, double barrierFwd, double barrierRev, double displacement, double prefFwd, double prefRev, bool dynamics, double simTime, double mdTemp)

Public Attributes

std::string job_type
int status_code {0}
std::string status_text
std::string potential_type
std::int64_t random_seed {-1}
std::uint64_t force_calls {0}
double potential_energy {0.0}
bool has_energy {false}
double potential_energy_saddle {0.0}
double potential_energy_reactant {0.0}
double potential_energy_product {0.0}
bool has_saddle {false}
bool has_reactant {false}
bool has_product {false}
bool process_search_layout {false}
std::uint64_t force_calls_minimization {0}
std::uint64_t force_calls_saddle {0}
std::uint64_t force_calls_prefactors {0}
double barrier_reactant_to_product {0.0}
double barrier_product_to_reactant {0.0}
double prefactor_reactant_to_product {0.0}
double prefactor_product_to_reactant {0.0}
double displacement_saddle_distance {0.0}
double simulation_time {0.0}
double md_temperature {0.0}
bool has_dynamics {false}
std::optional< readcon::ConFrame > reactant_frame
std::optional< readcon::ConFrame > saddle_frame
std::optional< readcon::ConFrame > product_frame
std::vector< std::pair< std::string, double > > extras
std::vector< std::pair< std::string, std::string > > tags
JobResultProvenance provenance

Detailed Description

In-memory JobResult scalars.

Matches schema/eon_job_result.capnp field names as results.dat keys. Geometries stay on Matter until capnp codegen lands.

Definition at line 124 of file JobResult.h.

Member Function Documentation

◆ fromMinimization()

JobResultEnvelope eonc::JobResultEnvelope::fromMinimization ( RunStatus status,
PotType pot,
std::uint64_t fcalls,
bool hasE,
double energy )
inlinestatic

Definition at line 251 of file JobResult.h.

253 {
254 JobResultEnvelope e;
255 e.job_type = "minimization";
256 e.status_code = static_cast<int>(status);
257 e.status_text = std::string(magic_enum::enum_name<RunStatus>(status));
258 e.potential_type = std::string(magic_enum::enum_name<PotType>(pot));
259 e.force_calls = fcalls;
260 e.has_energy = hasE;
261 e.potential_energy = energy;
262 return e;
263 }

◆ fromProcessSearch()

JobResultEnvelope eonc::JobResultEnvelope::fromProcessSearch ( int status,
std::string statusText,
PotType pot,
std::int64_t seed,
std::uint64_t fMin,
std::uint64_t fSaddle,
std::uint64_t fPref,
double eSaddle,
double eReactant,
double eProduct,
double barrierFwd,
double barrierRev,
double displacement,
double prefFwd,
double prefRev,
bool dynamics,
double simTime,
double mdTemp )
inlinestatic

Definition at line 265 of file JobResult.h.

270 {
271 JobResultEnvelope e;
272 e.process_search_layout = true;
273 e.job_type = "process_search";
274 e.status_code = status;
275 e.status_text = std::move(statusText);
276 e.potential_type = std::string(magic_enum::enum_name<PotType>(pot));
277 e.random_seed = seed;
278 e.force_calls_minimization = fMin;
279 e.force_calls_saddle = fSaddle;
280 e.force_calls_prefactors = fPref;
281 e.force_calls = fMin + fSaddle + fPref;
282 e.has_saddle = true;
283 e.has_reactant = true;
284 e.has_product = true;
285 e.potential_energy_saddle = eSaddle;
286 e.potential_energy_reactant = eReactant;
287 e.potential_energy_product = eProduct;
288 e.barrier_reactant_to_product = barrierFwd;
289 e.barrier_product_to_reactant = barrierRev;
290 e.displacement_saddle_distance = displacement;
291 e.prefactor_reactant_to_product = prefFwd;
292 e.prefactor_product_to_reactant = prefRev;
293 e.has_dynamics = dynamics;
294 e.simulation_time = simTime;
295 e.md_temperature = mdTemp;
296 return e;
297 }

◆ processSearchString()

std::string eonc::JobResultEnvelope::processSearchString ( ) const
inline

Definition at line 158 of file JobResult.h.

158 {
159 std::ostringstream out;
160 out << status_code << " termination_reason\n";
161 if (!status_text.empty()) {
162 out << status_text << " termination_reason_text\n";
163 }
164 out << random_seed << " random_seed\n";
165 if (!potential_type.empty()) {
166 out << potential_type << " potential_type\n";
167 }
168 out << force_calls << " total_force_calls\n";
169 out << force_calls_minimization << " force_calls_minimization\n";
170 out << force_calls_saddle << " force_calls_saddle\n";
171 out << std::format("{:.12e} potential_energy_saddle\n",
173 out << std::format("{:.12e} potential_energy_reactant\n",
175 out << std::format("{:.12e} potential_energy_product\n",
177 out << std::format("{:.12e} barrier_reactant_to_product\n",
179 out << std::format("{:.12e} barrier_product_to_reactant\n",
181 out << std::format("{:.12e} displacement_saddle_distance\n",
183 if (has_dynamics) {
184 out << std::format("{:.12e} simulation_time\n", simulation_time);
185 out << std::format("{:.12e} md_temperature\n", md_temperature);
186 }
187 out << force_calls_prefactors << " force_calls_prefactors\n";
188 out << std::format("{:.12e} prefactor_reactant_to_product\n",
190 out << std::format("{:.12e} prefactor_product_to_reactant\n",
192 out << provenance.text();
193 return out.str();
194 }
std::uint64_t force_calls_minimization
Definition JobResult.h:140
std::uint64_t force_calls
Definition JobResult.h:130
double barrier_product_to_reactant
Definition JobResult.h:144
double prefactor_product_to_reactant
Definition JobResult.h:146
double prefactor_reactant_to_product
Definition JobResult.h:145
double displacement_saddle_distance
Definition JobResult.h:147
std::uint64_t force_calls_prefactors
Definition JobResult.h:142
std::string potential_type
Definition JobResult.h:128
std::uint64_t force_calls_saddle
Definition JobResult.h:141
std::string status_text
Definition JobResult.h:127
JobResultProvenance provenance
Definition JobResult.h:156
std::int64_t random_seed
Definition JobResult.h:129
double barrier_reactant_to_product
Definition JobResult.h:143

◆ toString()

std::string eonc::JobResultEnvelope::toString ( ) const
inline

Definition at line 196 of file JobResult.h.

196 {
198 return processSearchString();
199 }
200 std::ostringstream out;
201 out << status_code << " termination_reason\n";
202 if (!status_text.empty()) {
203 out << status_text << " termination_reason_text\n";
204 }
205 if (!job_type.empty()) {
206 out << job_type << " job_type\n";
207 }
208 if (!potential_type.empty()) {
209 out << potential_type << " potential_type\n";
210 }
211 if (random_seed >= 0) {
212 out << random_seed << " random_seed\n";
213 }
214 out << force_calls << " total_force_calls\n";
215 if (has_energy) {
216 out << std::format("{:.12e} potential_energy\n", potential_energy);
217 }
218 if (has_saddle) {
219 out << std::format("{:.12e} potential_energy_saddle\n",
221 }
222 if (has_reactant) {
223 out << std::format("{:.12e} potential_energy_reactant\n",
225 }
226 if (has_product) {
227 out << std::format("{:.12e} potential_energy_product\n",
229 }
230 for (const auto &kv : extras) {
231 out << std::format("{:.12e} {}\n", kv.second, kv.first);
232 }
233 for (const auto &kv : tags) {
234 out << kv.second << " " << kv.first << "\n";
235 }
236 out << provenance.text();
237 return out.str();
238 }
std::vector< std::pair< std::string, double > > extras
Definition JobResult.h:154
std::vector< std::pair< std::string, std::string > > tags
Definition JobResult.h:155
std::string processSearchString() const
Definition JobResult.h:158

◆ writeResultsDat()

void eonc::JobResultEnvelope::writeResultsDat ( const std::string & path) const
inline

Definition at line 240 of file JobResult.h.

240 {
241 std::ofstream out(path, std::ios::binary);
242 if (!out) {
243 throw std::runtime_error("JobResultEnvelope: cannot open " + path);
244 }
245 out << toString();
246 if (!out) {
247 throw std::runtime_error("JobResultEnvelope: write failed for " + path);
248 }
249 }
std::string toString() const
Definition JobResult.h:196

Member Data Documentation

◆ barrier_product_to_reactant

double eonc::JobResultEnvelope::barrier_product_to_reactant {0.0}

Definition at line 144 of file JobResult.h.

144{0.0};

◆ barrier_reactant_to_product

double eonc::JobResultEnvelope::barrier_reactant_to_product {0.0}

Definition at line 143 of file JobResult.h.

143{0.0};

◆ displacement_saddle_distance

double eonc::JobResultEnvelope::displacement_saddle_distance {0.0}

Definition at line 147 of file JobResult.h.

147{0.0};

◆ extras

std::vector<std::pair<std::string, double> > eonc::JobResultEnvelope::extras

Definition at line 154 of file JobResult.h.

◆ force_calls

std::uint64_t eonc::JobResultEnvelope::force_calls {0}

Definition at line 130 of file JobResult.h.

130{0};

◆ force_calls_minimization

std::uint64_t eonc::JobResultEnvelope::force_calls_minimization {0}

Definition at line 140 of file JobResult.h.

140{0};

◆ force_calls_prefactors

std::uint64_t eonc::JobResultEnvelope::force_calls_prefactors {0}

Definition at line 142 of file JobResult.h.

142{0};

◆ force_calls_saddle

std::uint64_t eonc::JobResultEnvelope::force_calls_saddle {0}

Definition at line 141 of file JobResult.h.

141{0};

◆ has_dynamics

bool eonc::JobResultEnvelope::has_dynamics {false}

Definition at line 150 of file JobResult.h.

150{false};

◆ has_energy

bool eonc::JobResultEnvelope::has_energy {false}

Definition at line 132 of file JobResult.h.

132{false};

◆ has_product

bool eonc::JobResultEnvelope::has_product {false}

Definition at line 138 of file JobResult.h.

138{false};

◆ has_reactant

bool eonc::JobResultEnvelope::has_reactant {false}

Definition at line 137 of file JobResult.h.

137{false};

◆ has_saddle

bool eonc::JobResultEnvelope::has_saddle {false}

Definition at line 136 of file JobResult.h.

136{false};

◆ job_type

std::string eonc::JobResultEnvelope::job_type

Definition at line 125 of file JobResult.h.

◆ md_temperature

double eonc::JobResultEnvelope::md_temperature {0.0}

Definition at line 149 of file JobResult.h.

149{0.0};

◆ potential_energy

double eonc::JobResultEnvelope::potential_energy {0.0}

Definition at line 131 of file JobResult.h.

131{0.0};

◆ potential_energy_product

double eonc::JobResultEnvelope::potential_energy_product {0.0}

Definition at line 135 of file JobResult.h.

135{0.0};

◆ potential_energy_reactant

double eonc::JobResultEnvelope::potential_energy_reactant {0.0}

Definition at line 134 of file JobResult.h.

134{0.0};

◆ potential_energy_saddle

double eonc::JobResultEnvelope::potential_energy_saddle {0.0}

Definition at line 133 of file JobResult.h.

133{0.0};

◆ potential_type

std::string eonc::JobResultEnvelope::potential_type

Definition at line 128 of file JobResult.h.

◆ prefactor_product_to_reactant

double eonc::JobResultEnvelope::prefactor_product_to_reactant {0.0}

Definition at line 146 of file JobResult.h.

146{0.0};

◆ prefactor_reactant_to_product

double eonc::JobResultEnvelope::prefactor_reactant_to_product {0.0}

Definition at line 145 of file JobResult.h.

145{0.0};

◆ process_search_layout

bool eonc::JobResultEnvelope::process_search_layout {false}

Definition at line 139 of file JobResult.h.

139{false};

◆ product_frame

std::optional<readcon::ConFrame> eonc::JobResultEnvelope::product_frame

Definition at line 153 of file JobResult.h.

◆ provenance

JobResultProvenance eonc::JobResultEnvelope::provenance

Definition at line 156 of file JobResult.h.

◆ random_seed

std::int64_t eonc::JobResultEnvelope::random_seed {-1}

Definition at line 129 of file JobResult.h.

129{-1};

◆ reactant_frame

std::optional<readcon::ConFrame> eonc::JobResultEnvelope::reactant_frame

Definition at line 151 of file JobResult.h.

◆ saddle_frame

std::optional<readcon::ConFrame> eonc::JobResultEnvelope::saddle_frame

Definition at line 152 of file JobResult.h.

◆ simulation_time

double eonc::JobResultEnvelope::simulation_time {0.0}

Definition at line 148 of file JobResult.h.

148{0.0};

◆ status_code

int eonc::JobResultEnvelope::status_code {0}

Definition at line 126 of file JobResult.h.

126{0};

◆ status_text

std::string eonc::JobResultEnvelope::status_text

Definition at line 127 of file JobResult.h.

◆ tags

std::vector<std::pair<std::string, std::string> > eonc::JobResultEnvelope::tags

Definition at line 155 of file JobResult.h.


The documentation for this struct was generated from the following file: