Loading...
Searching...
No Matches
BasinHoppingSaddleSearch.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 "Eigen.h"
14#include "EonLogger.h"
15#include "Matter.h"
16#include "MinModeSaddleSearch.h"
17#include "SaddleSearchMethod.h"
18#include <vector>
19
20namespace eonc {
21
23public:
24 BasinHoppingSaddleSearch(std::shared_ptr<Matter> reactant,
25 std::shared_ptr<Matter> displacement,
26 std::shared_ptr<Potential> potPassed,
27 const Parameters &parametersPassed)
28 : SaddleSearchMethod(potPassed, parametersPassed),
29 reactant{std::make_shared<Matter>(*reactant)}, saddle{displacement} {
30 eigenvector.resize(reactant->numberOfAtoms(), 3);
31 eigenvector.setZero();
32 }
34
35 // Minimum-image (next - prev) / 2. setPositions wraps into the cell, so a
36 // raw central difference is a box-length jump when a bead crosses a face.
37 [[nodiscard]] static AtomMatrix
38 initialDimerDirection(const Matter &image, const AtomMatrix &prev,
39 const AtomMatrix &next) {
40 return image.pbc(next - prev) / 2.0;
41 }
42
43 int run(void);
47 static double metropolisProbability(double de, double kB, double temperature);
48 double getEigenvalue();
50
53 [[nodiscard]] static int
54 highestEnergyInteriorImage(const std::vector<std::shared_ptr<Matter>> &path,
55 long numImages);
56 std::string_view describeStatus(int code) const override {
57 // Code 1 is the Metropolis rejection, not MinMode STATUS_INIT.
58 if (code == 1) {
59 return "Basin hop rejected";
60 }
62 }
63 int getStatus() const override { return status; }
64
65 double eigenvalue{0.0};
67
68 std::shared_ptr<Matter> reactant;
69 std::shared_ptr<Matter> saddle;
70 std::shared_ptr<Matter> product;
71
72 int status{0};
73
74private:
76};
77
78} // namespace eonc
Eigen::Matrix< double, Eigen::Dynamic, 3, eOnStorageOrder > AtomMatrix
Definition Eigen.h:37
BasinHoppingSaddleSearch(std::shared_ptr< Matter > reactant, std::shared_ptr< Matter > displacement, std::shared_ptr< Potential > potPassed, const Parameters &parametersPassed)
static double metropolisProbability(double de, double kB, double temperature)
Quenched Metropolis weight for energy change de.
std::string_view describeStatus(int code) const override
static AtomMatrix initialDimerDirection(const Matter &image, const AtomMatrix &prev, const AtomMatrix &next)
static int highestEnergyInteriorImage(const std::vector< std::shared_ptr< Matter > > &path, long numImages)
Highest-energy interior bead.
AtomMatrix pbc(const AtomMatrix &diff) const
Definition Matter.cpp:810
static constexpr std::string_view statusMessage(int status)
Human-readable message for a status code.
SaddleSearchMethod(std::shared_ptr< Potential > potPassed, const Parameters &paramsPassed)
RAII resource manager for the ARTn C library with global synchronization.
RAII helper for class-scoped logging.
Definition EonLogger.h:171