Loading...
Searching...
No Matches
eonc::PointJob Class Reference

#include <PointJob.h>

Inheritance diagram for eonc::PointJob:

Public Member Functions

 PointJob (std::unique_ptr< Parameters > parameters, Runtime &rt)
 ~PointJob (void)=default
std::vector< std::string > run (void) override
 Virtual run; used solely for dynamic dispatch.
Public Member Functions inherited from eonc::Job
void adoptRuntime (std::unique_ptr< Runtime > rt)
 Take ownership of a Runtime previously passed as Runtime&.
 Job (std::unique_ptr< Parameters > parameters, Runtime &rt)
 Borrow: caller keeps Runtime alive (CLI stack / Python Session).
 Job (std::unique_ptr< Parameters > parameters, std::unique_ptr< Runtime > rt)
 Own a Runtime (one-shot makeJob / rvalue).
 Job (std::unique_ptr< Parameters > parameters)
 Own a default-constructed Runtime.
 Job (std::shared_ptr< Potential > potPassed, const Parameters &parameters)
virtual ~Job ()=default
JobType getType ()
PotRegistry & pots () noexcept
void releasePotential ()
 Drop the Potential so on_destroyed is recorded before Runtime dies.

Private Attributes

eonc::log::Scoped log

Additional Inherited Members

Protected Attributes inherited from eonc::Job
JobType jtype
Parameters params
std::unique_ptr< Runtime > owned_runtime_
 Non-null when this Job owns the composition root (one-shot makeJob).
Runtime * runtime_
 Always valid: either owned_runtime_.get() or a caller-owned Runtime.
std::shared_ptr< Potential > pot

Detailed Description

Definition at line 20 of file PointJob.h.

Constructor & Destructor Documentation

◆ PointJob()

eonc::PointJob::PointJob ( std::unique_ptr< Parameters > parameters,
Runtime & rt )
inline

Definition at line 22 of file PointJob.h.

23 : Job(std::move(parameters), rt) {}
Job(std::unique_ptr< Parameters > parameters, Runtime &rt)
Borrow: caller keeps Runtime alive (CLI stack / Python Session).
Definition Job.h:76

◆ ~PointJob()

eonc::PointJob::~PointJob ( void )
default

Member Function Documentation

◆ run()

std::vector< std::string > eonc::PointJob::run ( void )
overridevirtual

Virtual run; used solely for dynamic dispatch.

Implements eonc::Job.

Definition at line 24 of file PointJob.cpp.

24 {
25 std::vector<std::string> returnFiles;
26 std::string posInFilename = eonc::helpers::getRelevantFile("pos.con");
27 std::string resultsFilename("results.dat");
28
29 auto pos = std::make_unique<Matter>(pot, params);
30 if (!eonc::io::io_ok(pos->con2matter(posInFilename))) {
31 QUILL_LOG_CRITICAL(log, "Failed to load {}", posInFilename);
32 throw std::runtime_error("failed to load " + posInFilename);
33 }
34
35 QUILL_LOG_DEBUG(log, "Energy: {:.12f}", pos->getPotentialEnergy());
36 std::stringstream freeForcesStream;
37 freeForcesStream << pos->getForcesFree();
38 QUILL_LOG_DEBUG(log, "(free) Forces:\n{}", freeForcesStream.str());
39 QUILL_LOG_DEBUG(log, "Max atom force: {:.12f}", pos->maxForce());
40
41 // Energy and Max_Force are the SVN reference format (see
42 // data/reference/point_*.dat); the rest is the key set every other job
43 // writes and eon.explorer reads.
45 RunStatus::GOOD, params.potential_options().potential,
46 PotRegistry::get().total_force_calls(), true, pos->getPotentialEnergy());
47 env.job_type = "point";
48 env.extras.emplace_back("Energy", pos->getPotentialEnergy());
49 env.extras.emplace_back("Max_Force", pos->maxForce());
50 env.writeResultsDat(resultsFilename);
51 returnFiles.push_back(resultsFilename);
52
53 return returnFiles;
54}
std::shared_ptr< Potential > pot
Definition Job.h:63
Parameters params
Definition Job.h:58
eonc::log::Scoped log
Definition PointJob.h:28
static PotRegistry & get() noexcept
Process-lifetime singleton.
size_t total_force_calls() const noexcept
std::string getRelevantFile(std::string filename)
constexpr bool io_ok(IoStatus s) noexcept
Definition ConFileIO.h:38
static JobResultEnvelope fromMinimization(RunStatus status, PotType pot, std::uint64_t fcalls, bool hasE, double energy)
Definition JobResult.h:101

Member Data Documentation

◆ log

eonc::log::Scoped eonc::PointJob::log
private

Definition at line 28 of file PointJob.h.


The documentation for this class was generated from the following files: