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
size_t potRegistryForceCalls () const noexcept
 Force calls charged to pot's registry.
void releasePotential ()
 Drop the Potential so on_destroyed is recorded before Runtime dies.

Private Attributes

eonc::log::Scoped log

Additional Inherited Members

Protected Member Functions inherited from eonc::Job
 Job (std::unique_ptr< Parameters > parameters, Runtime &rt, ExclusivePotential)
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::unique_ptr< Potential > ownedPot
 Exclusive until a multi-owner job promotes it in the public constructor.
std::shared_ptr< Potential > pot
 Set when one Potential is shared across Matters, images, or a caller.

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, ExclusivePotential{}) {}
Job(std::unique_ptr< Parameters > parameters, Runtime &rt, ExclusivePotential)
Definition Job.h:71
Point and Minimization keep ownedPot. Other jobs share in the public ctor.
Definition Job.h:69

◆ ~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>(std::move(ownedPot), params);
30 if (!eonc::io::io_ok(pos->inp2matter(posInFilename))) {
31 QUILL_LOG_CRITICAL(log, "Failed to load {}", posInFilename);
32 throw std::runtime_error("failed to load " + posInFilename);
33 }
34
35 // A point job evaluates the selected potential even when the input
36 // contains a saved energy and force evaluation.
37 pos->setPositions(pos->getPositions());
38 QUILL_LOG_DEBUG(log, "Energy: {:.12f}", pos->getPotentialEnergy());
39 std::stringstream freeForcesStream;
40 freeForcesStream << pos->getForcesFree();
41 QUILL_LOG_DEBUG(log, "(free) Forces:\n{}", freeForcesStream.str());
42 QUILL_LOG_DEBUG(log, "Max atom force: {:.12f}", pos->maxForce());
43
44 // Energy and Max_Force are the SVN reference format (see
45 // data/reference/point_*.dat); the rest is the key set every other job
46 // writes and eon.explorer reads.
48 RunStatus::GOOD, params.potential_options().potential,
49 pots().total_force_calls(), true, pos->getPotentialEnergy());
50 env.provenance = provenanceForJob(params);
51 env.job_type = "point";
52 env.extras.emplace_back("Energy", pos->getPotentialEnergy());
53 env.extras.emplace_back("Max_Force", pos->maxForce());
54 env.writeResultsDat(resultsFilename);
55 returnFiles.push_back(resultsFilename);
56
57 return returnFiles;
58}
PotRegistry & pots() noexcept
Definition Job.h:109
Parameters params
Definition Job.h:58
std::unique_ptr< Potential > ownedPot
Exclusive until a multi-owner job promotes it in the public constructor.
Definition Job.h:64
eonc::log::Scoped log
Definition PointJob.h:28
std::string getRelevantFile(std::string filename)
constexpr bool io_ok(IoStatus s) noexcept
Definition ConFileIO.h:38
JobResultProvenance provenanceForJob(const Parameters &params)
Optimizer backend, engine identity, rgpot pin, and xts ABI from a job.
static JobResultEnvelope fromMinimization(RunStatus status, PotType pot, std::uint64_t fcalls, bool hasE, double energy)
Definition JobResult.h:251

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: