Loading...
Searching...
No Matches
BasinHoppingJob.h
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#pragma once
13#include "EonLogger.h"
14#include "Job.h"
15#include "Matter.h"
16#include "Parameters.h"
17
18namespace eonc {
19
20class BasinHoppingDisplaceAccess;
21
22class BasinHoppingJob : public Job {
23public:
24 BasinHoppingJob(std::unique_ptr<Parameters> parameters, Runtime &rt)
25 : Job(std::move(parameters), rt),
26 current{std::make_shared<Matter>(pot, params)},
27 trial{std::make_shared<Matter>(pot, params)}, fcalls{0} {}
28 ~BasinHoppingJob(void) = default;
29
30 std::vector<std::string> run(void) override;
34 static double metropolisProbability(double de, double kB, double temperature);
35
36private:
38 VectorXd calculateDistanceFromCenter(Matter *matter);
39 AtomMatrix displaceRandom(double maxDisplacement);
40 void randomSwap(Matter *matter);
41 std::shared_ptr<Matter> current;
42 std::shared_ptr<Matter> trial; // initial configuration
43 std::vector<long> getElements(Matter *matter);
45 std::vector<std::string> returnFiles;
46 int jump_count{0}; // count of jump moves
47 int disp_count{0}; // count of displacement moves
48 int swap_count{0}; // count of swap moves
49 int fcalls{0};
50
51 std::vector<std::shared_ptr<Matter>> uniqueStructures;
52 std::vector<double> uniqueEnergies;
54};
55
56} // namespace eonc
Eigen::Matrix< double, Eigen::Dynamic, 3, eOnStorageOrder > AtomMatrix
Definition Eigen.h:37
The job class is used to serve as an abstract class for all jobs, as well as to call a job at runtime...
friend struct BasinHoppingElementsTest
std::vector< std::string > returnFiles
std::vector< std::shared_ptr< Matter > > uniqueStructures
VectorXd calculateDistanceFromCenter(Matter *matter)
std::shared_ptr< Matter > current
std::vector< long > getElements(Matter *matter)
void randomSwap(Matter *matter)
friend class BasinHoppingDisplaceAccess
AtomMatrix displaceRandom(double maxDisplacement)
std::vector< double > uniqueEnergies
eonc::log::Scoped log
static double metropolisProbability(double de, double kB, double temperature)
Metropolis weight for energy change de.
std::shared_ptr< Matter > trial
BasinHoppingJob(std::unique_ptr< Parameters > parameters, Runtime &rt)
~BasinHoppingJob(void)=default
std::vector< std::string > run(void) override
Virtual run; used solely for dynamic dispatch.
Job(std::unique_ptr< Parameters > parameters, Runtime &rt)
Borrow: caller keeps Runtime alive (CLI stack / Python Session).
Definition Job.h:76
std::shared_ptr< Potential > pot
Definition Job.h:63
Parameters params
Definition Job.h:58
Move-only composition root for process resources (dlopen loaders and the potential registry).
Definition Runtime.h:27
RAII resource manager for the ARTn C library with global synchronization.
RAII helper for class-scoped logging.
Definition EonLogger.h:171