35#ifndef MADNESS_CHEM_RESTART_H__INCLUDED
36#define MADNESS_CHEM_RESTART_H__INCLUDED
69 default:
return "unknown";
152 template <
typename Archive>
168 template <
typename Archive>
172 "unsupported restartdata version: only 4 and 5 can be read");
200 std::stringstream
ss;
203 << (
ncf.empty() ? std::string() :
" ncf " +
ncf)
204 <<
" k " <<
k <<
" L " <<
L
222inline std::optional<RestartMetadata>
259inline std::optional<RestartSummary>
266 unsigned int nmo = 0;
269 ar & s.aeps & s.aocc & s.aset;
282 const std::string chunk =
".00000";
283 if (
name.size() > chunk.size()
and
284 name.compare(
name.size() - chunk.size(), chunk.size(), chunk) == 0)
285 name.erase(
name.size() - chunk.size());
286 const std::string
suffix =
".restartdata";
299 return std::filesystem::exists(
filename +
".00000");
315 const std::string archive = base +
".restartdata";
318 if (world.
rank() == 0)
319 print(
"no restart data: there is no file", archive +
".00000");
325 if (world.
rank() == 0) {
326 print(archive +
".00000",
"exists but could not be read.");
327 print(
"It is truncated, or was written by a newer MADNESS than this one");
332 if (world.
rank() != 0)
return true;
335 auto or_unset = [](
const double v,
const double unset = 1.e10) {
336 std::stringstream
ss;
337 if (
v == unset)
ss <<
"not recorded";
338 else ss << std::scientific << std::setprecision(2) <<
v;
343 print(
"restart data in", archive +
".00000");
344 print(
" format version ",
m.version);
345 print(
" written by MADNESS ",
m.madness_version.empty() ?
"not recorded" :
m.madness_version);
350 "(version-4 archive; predates the field)");
351 if (
not m.ncf.empty())
print(
" nuclear corr. factor",
m.ncf);
352 print(
" box size L ",
m.L);
353 print(
" polynomial order k ",
m.k);
357 if (
m.current_energy == 1.e10) {
358 print(
" energy not recorded");
360 std::stringstream
se;
361 se << std::fixed << std::setprecision(10) <<
m.current_energy;
366 print(
" xc / localize ",
m.xc,
"/",
m.localize);
368 if (
summary.value().aeps.size() > 0)
370 if (
summary.value().aocc.size() > 0)
372 print(
" spin restricted ",
m.spin_restricted ?
"yes" :
"no");
373 if (
not m.spin_restricted) {
374 print(
" (beta orbital energies sit after the alpha functions in the");
375 print(
" archive, so they are not part of a header-only peek)");
380 print(
"A restart is used as-is only if this archive is converged at least as");
381 print(
"tightly as the run asks for -- compare `converged to thresh/dconv`");
382 print(
"against `protocol` (its last entry) and `dconv`. It is used as a guess,");
383 print(
"with iterations continuing, otherwise. Anything printed as");
384 print(
"\"not recorded\" counts as not converged.");
Definition molecule.h:129
A tensor is a multidimensional array.
Definition tensor.h:318
A parallel world class.
Definition world.h:134
ProcessID rank() const
Returns the process rank in this World (same as MPI_Comm_rank()).
Definition world.h:344
static const double v
Definition hatom_sf_dirac.cc:20
#define MADNESS_CHECK_THROW(condition, msg)
Check a condition — even in a release build the condition is always evaluated so it can have side eff...
Definition madness_exception.h:207
Main include file for MADNESS and defines Function interface.
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
std::string to_string(const Representation r)
Definition Restart.h:64
static const char * filename
Definition legendre.cc:96
std::string restartdata_basename(std::string name)
Definition Restart.h:281
Representation representation_from_int(const int i)
map a stored int back to a Representation, tolerating values we do not know
Definition Restart.h:74
@ unknown
Definition funcdefaults.h:68
bool restartdata_exists(const std::string &filename)
Definition Restart.h:298
std::optional< RestartSummary > peek_restartdata_summary(World &world, const std::string &filename)
Definition Restart.h:260
void print(const T &t, const Ts &... ts)
Print items to std::cout (items separated by spaces) and terminate with a new line.
Definition print.h:227
bool print_restartdata_info(World &world, const std::string &prefix)
Definition Restart.h:312
std::optional< RestartMetadata > peek_restartdata(World &world, const std::string &filename)
Definition Restart.h:223
static XNonlinearSolver< std::vector< Function< T, NDIM > >, T, vector_function_allocator< T, NDIM > > nonlinear_vector_solver(World &world, const long nvec)
Definition nonlinsol.h:371
std::string name(const FuncType &type, const int ex=-1)
Definition ccpairfunction.h:28
Representation
Definition Restart.h:57
@ unknown
not recorded; a version-4 archive, which predates the field
@ znemo
complex regularized orbitals
@ nemo
nemo's regularized orbitals F = psi/R
static const double m
Definition relops.cc:9
static const double thresh
Definition rk.cc:45
std::vector< int > aset
localization sets
Definition Restart.h:252
Tensor< double > aeps
alpha orbital energies
Definition Restart.h:250
RestartMetadata meta
Definition Restart.h:248
std::size_t nmo_alpha
Definition Restart.h:249
Tensor< double > aocc
alpha occupations
Definition Restart.h:251
Definition dirac-hatom.cc:112