eOn 3.2.0
Long-timescale dynamics: aKMC, NEB, parallel replica
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
PointJob.cpp
Go to the documentation of this file.
1
/*
2
** This file is part of eOn.
3
**
4
** SPDX-License-Identifier: BSD-3-Clause
5
**
6
** Copyright (c) 2010--present, eOn Development Team
7
** All rights reserved.
8
**
9
** Repo:
10
** https://github.com/TheochemUI/eOn
11
*/
12
#include "
eon/PointJob.h
"
13
#include "
eon/BaseStructures.h
"
14
#include "
eon/HelperFunctions.h
"
15
#include "
eon/JobResult.h
"
16
#include "
eon/Matter.h
"
17
#include "
eon/PotRegistry.h
"
18
19
#include <sstream>
20
#include <stdexcept>
21
22
namespace
eonc
{
23
24
std::vector<std::string>
PointJob::run
() {
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.
44
auto
env =
JobResultEnvelope::fromMinimization
(
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
}
55
56
}
// namespace eonc
BaseStructures.h
HelperFunctions.h
JobResult.h
Matter.h
PointJob.h
PotRegistry.h
eonc::Job::pot
std::shared_ptr< Potential > pot
Definition
Job.h:63
eonc::Job::params
Parameters params
Definition
Job.h:58
eonc::PointJob::log
eonc::log::Scoped log
Definition
PointJob.h:28
eonc::PointJob::run
std::vector< std::string > run(void) override
Virtual run; used solely for dynamic dispatch.
Definition
PointJob.cpp:24
eonc::PotRegistry::get
static PotRegistry & get() noexcept
Process-lifetime singleton.
Definition
PotRegistry.cpp:50
eonc::helpers::getRelevantFile
std::string getRelevantFile(std::string filename)
Definition
HelperFunctions.cpp:122
eonc::io::io_ok
constexpr bool io_ok(IoStatus s) noexcept
Definition
ConFileIO.h:38
eonc
RAII resource manager for the ARTn C library with global synchronization.
Definition
ARTnSaddleSearch.cpp:23
eonc::RunStatus::GOOD
@ GOOD
Definition
BaseStructures.h:117
eonc::JobResultEnvelope::fromMinimization
static JobResultEnvelope fromMinimization(RunStatus status, PotType pot, std::uint64_t fcalls, bool hasE, double energy)
Definition
JobResult.h:101
client
PointJob.cpp
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf