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

In-memory JobResult scalars. More...

#include <JobResult.h>

Public Member Functions

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)

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}
std::vector< std::pair< std::string, double > > extras
std::vector< std::pair< std::string, std::string > > tags

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 32 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 101 of file JobResult.h.

103 {
104 JobResultEnvelope e;
105 e.job_type = "minimization";
106 e.status_code = static_cast<int>(status);
107 e.status_text = std::string(magic_enum::enum_name<RunStatus>(status));
108 e.potential_type = std::string(magic_enum::enum_name<PotType>(pot));
109 e.force_calls = fcalls;
110 e.has_energy = hasE;
111 e.potential_energy = energy;
112 return e;
113 }

◆ toString()

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

Definition at line 50 of file JobResult.h.

50 {
51 std::ostringstream out;
52 out << status_code << " termination_reason\n";
53 if (!status_text.empty()) {
54 out << status_text << " termination_reason_text\n";
55 }
56 if (!job_type.empty()) {
57 out << job_type << " job_type\n";
58 }
59 if (!potential_type.empty()) {
60 out << potential_type << " potential_type\n";
61 }
62 if (random_seed >= 0) {
63 out << random_seed << " random_seed\n";
64 }
65 out << force_calls << " total_force_calls\n";
66 if (has_energy) {
67 out << std::format("{:.12e} potential_energy\n", potential_energy);
68 }
69 if (has_saddle) {
70 out << std::format("{:.12e} potential_energy_saddle\n",
72 }
73 if (has_reactant) {
74 out << std::format("{:.12e} potential_energy_reactant\n",
76 }
77 if (has_product) {
78 out << std::format("{:.12e} potential_energy_product\n",
80 }
81 for (const auto &kv : extras) {
82 out << std::format("{:.12e} {}\n", kv.second, kv.first);
83 }
84 for (const auto &kv : tags) {
85 out << kv.second << " " << kv.first << "\n";
86 }
87 return out.str();
88 }
std::vector< std::pair< std::string, double > > extras
Definition JobResult.h:47
std::uint64_t force_calls
Definition JobResult.h:38
double potential_energy_product
Definition JobResult.h:43
std::vector< std::pair< std::string, std::string > > tags
Definition JobResult.h:48
std::string potential_type
Definition JobResult.h:36
std::string status_text
Definition JobResult.h:35
double potential_energy_reactant
Definition JobResult.h:42
std::int64_t random_seed
Definition JobResult.h:37

◆ writeResultsDat()

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

Definition at line 90 of file JobResult.h.

90 {
91 std::ofstream out(path, std::ios::binary);
92 if (!out) {
93 throw std::runtime_error("JobResultEnvelope: cannot open " + path);
94 }
95 out << toString();
96 if (!out) {
97 throw std::runtime_error("JobResultEnvelope: write failed for " + path);
98 }
99 }
std::string toString() const
Definition JobResult.h:50

Member Data Documentation

◆ extras

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

Definition at line 47 of file JobResult.h.

◆ force_calls

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

Definition at line 38 of file JobResult.h.

38{0};

◆ has_energy

bool eonc::JobResultEnvelope::has_energy {false}

Definition at line 40 of file JobResult.h.

40{false};

◆ has_product

bool eonc::JobResultEnvelope::has_product {false}

Definition at line 46 of file JobResult.h.

46{false};

◆ has_reactant

bool eonc::JobResultEnvelope::has_reactant {false}

Definition at line 45 of file JobResult.h.

45{false};

◆ has_saddle

bool eonc::JobResultEnvelope::has_saddle {false}

Definition at line 44 of file JobResult.h.

44{false};

◆ job_type

std::string eonc::JobResultEnvelope::job_type

Definition at line 33 of file JobResult.h.

◆ potential_energy

double eonc::JobResultEnvelope::potential_energy {0.0}

Definition at line 39 of file JobResult.h.

39{0.0};

◆ potential_energy_product

double eonc::JobResultEnvelope::potential_energy_product {0.0}

Definition at line 43 of file JobResult.h.

43{0.0};

◆ potential_energy_reactant

double eonc::JobResultEnvelope::potential_energy_reactant {0.0}

Definition at line 42 of file JobResult.h.

42{0.0};

◆ potential_energy_saddle

double eonc::JobResultEnvelope::potential_energy_saddle {0.0}

Definition at line 41 of file JobResult.h.

41{0.0};

◆ potential_type

std::string eonc::JobResultEnvelope::potential_type

Definition at line 36 of file JobResult.h.

◆ random_seed

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

Definition at line 37 of file JobResult.h.

37{-1};

◆ status_code

int eonc::JobResultEnvelope::status_code {0}

Definition at line 34 of file JobResult.h.

34{0};

◆ status_text

std::string eonc::JobResultEnvelope::status_text

Definition at line 35 of file JobResult.h.

◆ tags

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

Definition at line 48 of file JobResult.h.


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