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

#include <DynamicsJob.h>

Inheritance diagram for eonc::DynamicsJob:

Public Member Functions

 DynamicsJob (std::unique_ptr< Parameters > parameters, Runtime &rt)
 ~DynamicsJob (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.

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 19 of file DynamicsJob.h.

Constructor & Destructor Documentation

◆ DynamicsJob()

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

Definition at line 22 of file DynamicsJob.h.

23 : Job(std::move(parameters), rt) {}
Job(std::unique_ptr< Parameters > parameters, Runtime &rt, ExclusivePotential)
Definition Job.h:71

◆ ~DynamicsJob()

eonc::DynamicsJob::~DynamicsJob ( void )
default

Member Function Documentation

◆ run()

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

Virtual run; used solely for dynamic dispatch.

Implements eonc::Job.

Definition at line 27 of file DynamicsJob.cpp.

27 {
28 auto R = std::make_shared<Matter>(pot, params);
29 const std::string posFile = eonc::helpers::getRelevantFile("pos.con");
30 if (!eonc::io::io_ok(R->con2matter(posFile))) {
31 EONC_LOG_CRITICAL("Failed to load {}", posFile);
32 throw std::runtime_error("failed to load " + posFile);
33 }
34
35 auto d = std::make_unique<Dynamics>(R.get(), params);
36 d->run();
37
38 std::string productFilename("final.con");
39 if (!eonc::io::io_ok(R->matter2con(productFilename))) {
40 EONC_LOG_ERROR("Failed to write {}", productFilename);
41 }
42
43 const std::string resultsFilename("results.dat");
45 RunStatus::GOOD, params.potential_options().potential,
46 pots().total_force_calls(), true, R->getPotentialEnergy());
47 env.provenance = provenanceForJob(params);
48 env.job_type = "dynamics";
49 env.writeResultsDat(resultsFilename);
50
51 std::vector<std::string> returnFiles;
52 returnFiles.push_back(productFilename);
53 returnFiles.push_back(resultsFilename);
54 return returnFiles;
55}
#define EONC_LOG_ERROR(...)
Definition EonLogger.h:328
#define EONC_LOG_CRITICAL(...)
Definition EonLogger.h:334
PotRegistry & pots() noexcept
Definition Job.h:109
std::shared_ptr< Potential > pot
Set when one Potential is shared across Matters, images, or a caller.
Definition Job.h:66
Parameters params
Definition Job.h:58
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

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