Loading...
Searching...
No Matches
ImprovedDimer.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 "LowestEigenmode.h"
16#include "Matter.h"
17#include "Parameters.h"
18#include <memory>
19#include <vector>
20
21namespace eonc {
22
23// dimer method to find the lowest curvature mode
25
26private:
28 // For use when called as part of the NEB-MMF
30 bool hasFixedReference = false;
31 // Forward image evaluated together with its centre by
32 // evaluateWithProbe(); compute() takes it when the coordinates match.
33 std::unique_ptr<Matter> forward_;
34 // The unit dimer direction compute() builds from an initial direction.
35 VectorXd dimerDirection(const Matter &matter,
36 const AtomMatrix &direction) const;
37
38public:
39 ImprovedDimer(std::shared_ptr<Matter> matter, const Parameters &params,
40 std::shared_ptr<Potential> pot);
41 ~ImprovedDimer() = default;
42
43 void compute(std::shared_ptr<Matter> matter,
44 AtomMatrix initialDirection) override;
45 double getEigenvalue() override;
46 AtomMatrix getEigenvector() override;
47
48 std::shared_ptr<Matter> x0; // Center image
49 std::shared_ptr<Matter> x1; // Forward image
50 VectorXd tau; // Dimer direction
51 VectorXd theta; // Dimer rotation direction
52 VectorXd F_R; // Dimer rotational force
53 double C_tau{0.0}; // Curvature along tau
55 void evaluateWithProbe(const std::shared_ptr<Matter> &matter,
56 const AtomMatrix &direction) override;
57 // For use when called as part of the NEB-MMF
58 void setReferenceMode(const VectorXd &ref);
59 void clearReferenceMode();
62 // parameters used for conjugate gradients
63 VectorXd F_R_Old;
64 VectorXd thetaOld;
65 double a{0.0}, b{0.0}, gamma{0.0};
66 bool init_cg{false};
67
68 // variables for LBFGS
69 std::vector<VectorXd> s, y;
70 std::vector<double> rho;
71 bool init_lbfgs{false};
72 VectorXd rPrev;
73
74 std::vector<VectorXd> gradients;
75 std::vector<VectorXd> positions;
76};
77
78} // namespace eonc
Eigen::Matrix< double, Eigen::Dynamic, 3, eOnStorageOrder > AtomMatrix
Definition Eigen.h:37
ImprovedDimer(std::shared_ptr< Matter > matter, const Parameters &params, std::shared_ptr< Potential > pot)
std::unique_ptr< Matter > forward_
std::shared_ptr< Matter > x1
void compute(std::shared_ptr< Matter > matter, AtomMatrix initialDirection) override
std::vector< VectorXd > s
VectorXd fixedReferenceMode
void setReferenceMode(const VectorXd &ref)
std::vector< VectorXd > positions
std::vector< VectorXd > gradients
~ImprovedDimer()=default
VectorXd dimerDirection(const Matter &matter, const AtomMatrix &direction) const
std::shared_ptr< Matter > x0
std::vector< VectorXd > y
eonc::log::Scoped log
std::vector< double > rho
double getEigenvalue() override
AtomMatrix getEigenvector() override
void evaluateWithProbe(const std::shared_ptr< Matter > &matter, const AtomMatrix &direction) override
The probe is the forward image x0 + delta tau.
const Parameters & params
std::shared_ptr< Potential > pot
LowestEigenmode(std::shared_ptr< Potential > potPassed, const Parameters &parameters)
RAII resource manager for the ARTn C library with global synchronization.
RAII helper for class-scoped logging.
Definition EonLogger.h:238