8#include <madness/external/nlohmann_json/json.hpp>
9#include <madness/tensor/tensor_json.hpp>
22 virtual nlohmann::json
to_json()
const = 0;
24 virtual std::string
key()
const = 0;
44 std::string
key()
const override {
return "metadata"; }
62 j[
"host"] = std::string(HOST_SYSTEM);
71 auto print_time = std::chrono::system_clock::now();
72 auto in_time_t = std::chrono::system_clock::to_time_t(print_time);
74 ss << std::put_time(std::localtime(&in_time_t),
"%Y-%m-%d %X");
100 std::string
key()
const override {
return "convergence"; }
126 energy= j.value(
"energy", 0.0);
127 if (j.count(
"dipole")==1)
dipole = tensor_from_json<double>(j[
"dipole"]);
128 if (j.count(
"gradient")==1)
gradient= tensor_from_json<double>(j[
"gradient"]);
135 std::string
key()
const override {
return "properties"; }
140 j[
"dipole"] = tensor_to_json(
dipole);
141 j[
"gradient"] = tensor_to_json(
gradient);
161 if (j.count(
"scf_eigenvalues_a")>0)
162 aeps = tensor_from_json<double>(j[
"scf_eigenvalues_a"]);
163 if (j.count(
"scf_eigenvalues_b") > 0)
164 beps = tensor_from_json<double>(j[
"scf_eigenvalues_b"]);
165 if (j.count(
"scf_fock_b") > 0)
166 bfock = tensor_from_json<double>(j[
"scf_fock_b"]);
167 if (j.count(
"scf_fock_b") > 0)
168 bfock = tensor_from_json<double>(j[
"scf_fock_b"]);
169 if (j.count(
"scf_total_energy") > 0)
172 if (j.count(
"properties") > 0) {
183 j[
"scf_eigenvalues_a"] = tensor_to_json(
aeps);
184 j[
"scf_fock_a"] = tensor_to_json(
afock);
185 if (
beps.
size() > 0) j[
"scf_eigenvalues_b"] = tensor_to_json(
beps);
213 if (j.count(
"excitations") > 0) {
214 for (
const auto& ex : j[
"excitations"]) {
216 ei.
irrep = ex.value(
"irrep",
"");
217 ei.
omega = ex.value(
"omega", 0.0);
224 nfreeze = j.value(
"nfreeze", -1);
225 model= j.value(
"model",
"unknown");
234 nlohmann::json ex_json;
235 ex_json[
"irrep"] = ex.irrep;
236 ex_json[
"omega"] = ex.omega;
237 ex_json[
"current_error"] = ex.current_error;
238 ex_json[
"oscillator_strength_length"] = ex.oscillator_strength_length;
239 ex_json[
"oscillator_strength_velocity"] = ex.oscillator_strength_velocity;
240 j[
"excitations"].push_back(ex_json);
258 model = j.value(
"model",
"mp2");
315 B = j.value(
"B", 0.0);
343 model = j.value(
"model",
"oaep");
344 drho = j.value(
"drho", 0.0);
345 devir14 = j.value(
"dvir14", 0.0);
346 devir17 = j.value(
"dvir17", 0.0);
347 Ex_vir = j.value(
"Ex_vir", 0.0);
348 Ex_conv = j.value(
"Ex_conv", 0.0);
349 Ex_HF = j.value(
"Ex_HF", 0.0);
350 E_kin_HF = j.value(
"E_kin_HF", 0.0);
351 E_kin_KS = j.value(
"E_kin_KS", 0.0);
352 Econv = j.value(
"Econv", 0.0);
Definition test_ar.cc:141
long size() const
Returns the number of elements in the tensor.
Definition basetensor.h:138
CC2Results & set_energies(const double scf_energy, const double corr_energy)
Definition Results.h:277
CC2Results & set_properties(const PropertyResults &props)
Definition Results.h:292
CC2Results(const nlohmann::json &j)
construct from JSON
Definition Results.h:256
CC2Results & set_total_energy(const double total_energy)
Definition Results.h:288
CC2Results(long nfreeze, const std::string &model)
constructor with nfreeze and model
Definition Results.h:264
CC2Results & set_model(const std::string &model)
Definition Results.h:296
double correlation_energy
Definition Results.h:302
CC2Results & set_correlation_energy(const double corr_energy)
setters with chaining
Definition Results.h:284
CC2Results()
Definition Results.h:251
nlohmann::json to_json() const override
serialize the results to a JSON object
Definition Results.h:266
PropertyResults properties
Definition Results.h:301
double total_energy
Definition Results.h:303
std::vector< excitation_info > excitations
Definition Results.h:203
nlohmann::json to_json() const override
serialize the results to a JSON object
Definition Results.h:231
CISResults(const nlohmann::json &j)
construct from JSON
Definition Results.h:212
std::string model
Definition Results.h:205
std::string key() const override
Definition Results.h:207
long nfreeze
Definition Results.h:204
CISResults(long nfreeze, const std::string &model)
constructor with nfreeze and model
Definition Results.h:229
holds convergence results of the calculation
Definition Results.h:80
double converged_for_thresh
Definition Results.h:81
ConvergenceResults & set_converged_dconv(double dconv)
Definition Results.h:107
std::string key() const override
Definition Results.h:100
nlohmann::json to_json() const override
serialize the results to a JSON object
Definition Results.h:112
ConvergenceResults & set_converged_thresh(double thresh)
Definition Results.h:102
ConvergenceResults(const nlohmann::json &j)
construct from JSON
Definition Results.h:88
double converged_for_dconv
Definition Results.h:82
ConvergenceResults & operator=(const nlohmann::json &j)
assignment operator from JSON
Definition Results.h:94
ConvergenceResults()=default
nlohmann::json to_json() const override
serialize the results to a JSON object
Definition Results.h:355
double Ex_vir
Definition Results.h:332
double devir14
Definition Results.h:330
double Econv
Definition Results.h:337
double Ex_HF
Definition Results.h:334
double drho
Definition Results.h:329
OEPResults(const nlohmann::json &j)
construct from JSON
Definition Results.h:342
double E_kin_KS
Definition Results.h:336
double Ex_conv
Definition Results.h:333
double E_kin_HF
Definition Results.h:335
double devir17
Definition Results.h:331
std::string key() const override
Definition Results.h:135
Tensor< double > gradient
Definition Results.h:133
PropertyResults()=default
PropertyResults(const nlohmann::json &j)
construct from JSON
Definition Results.h:125
Tensor< double > dipole
Definition Results.h:132
double energy
Definition Results.h:131
nlohmann::json to_json() const override
serialize the results to a JSON object
Definition Results.h:137
virtual nlohmann::json to_json() const
serialize the results to a JSON object
Definition Results.h:374
virtual std::string key() const =0
virtual ~ResultsBase()=default
virtual nlohmann::json to_json() const =0
serialize the results to a JSON object
nlohmann::json to_json() const override
serialize the results to a JSON object
Definition Results.h:181
Tensor< double > beps
Definition Results.h:150
std::string model
Definition Results.h:153
Tensor< double > aeps
Definition Results.h:149
double scf_total_energy
Definition Results.h:154
SCFResults(const nlohmann::json &j)
construct from JSON
Definition Results.h:160
Tensor< double > bfock
Definition Results.h:152
PropertyResults properties
Definition Results.h:155
Tensor< double > afock
Definition Results.h:151
std::string key() const override
Definition Results.h:179
A tensor is a multidimensional array.
Definition tensor.h:317
static std::size_t size()
Returns the number of threads in the pool.
Definition thread.h:1419
A parallel world class.
Definition world.h:132
ProcessID size() const
Returns the number of processes in this World (same as MPI_Comm_size()).
Definition world.h:330
nlohmann::json to_json() const override
serialize the results to a JSON object
Definition Results.h:318
double B
Definition Results.h:310
ZnemoResults(const nlohmann::json &j)
construct from JSON
Definition Results.h:314
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition madness_exception.h:119
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
double wall_time()
Returns the wall time in seconds relative to an arbitrary origin.
Definition timers.cc:48
static const double thresh
Definition rk.cc:45
double oscillator_strength_length
Definition Results.h:200
double omega
Definition Results.h:198
double oscillator_strength_velocity
Definition Results.h:201
std::string irrep
Definition Results.h:197
double current_error
Definition Results.h:199