/
Spin_System_Chain.hpp
96 lines (76 loc) · 2.6 KB
/
Spin_System_Chain.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#pragma once
#ifndef SPIRIT_CORE_DATA_SPIN_SYSTEM_CHAIN_HPP
#define SPIRIT_CORE_DATA_SPIN_SYSTEM_CHAIN_HPP
#include <Spirit/Parameters_GNEB.h>
#include <Spirit/Spirit_Defines.h>
#include <data/Parameters_Method_GNEB.hpp>
#include <data/Spin_System.hpp>
namespace Spirit::Data
{
enum class GNEB_Image_Type
{
Normal = GNEB_IMAGE_NORMAL,
Climbing = GNEB_IMAGE_CLIMBING,
Falling = GNEB_IMAGE_FALLING,
Stationary = GNEB_IMAGE_STATIONARY
};
struct HTST_Info
{
bool sparse = false;
// Relevant images
std::shared_ptr<Spin_System> minimum;
std::shared_ptr<Spin_System> saddle_point;
// Eigenmodes
int n_eigenmodes_keep = 0;
VectorX eigenvalues_min = VectorX( 0 );
MatrixX eigenvectors_min = MatrixX( 0, 0 );
VectorX eigenvalues_sp = VectorX( 0 );
MatrixX eigenvectors_sp = MatrixX( 0, 0 );
VectorX perpendicular_velocity = VectorX( 0 );
scalar det_min = 0;
scalar det_sp = 0;
// Prefactor constituents
scalar temperature_exponent = 0;
scalar me = 0;
scalar Omega_0 = 0;
scalar s = 0;
scalar volume_min = 0;
scalar volume_sp = 0;
scalar prefactor_dynamical = 0;
scalar prefactor = 0;
};
class Spin_System_Chain
{
public:
// Constructor
Spin_System_Chain(
std::vector<std::shared_ptr<Spin_System>> images, std::shared_ptr<Data::Parameters_Method_GNEB> gneb_parameters,
bool iteration_allowed = false );
// For multithreading
void Lock() noexcept;
void Unlock() noexcept;
int noi; // Number of Images
std::vector<std::shared_ptr<Spin_System>> images;
int idx_active_image;
// Parameters for GNEB Iterations
std::shared_ptr<Data::Parameters_Method_GNEB> gneb_parameters;
// Are we allowed to iterate on this chain or do a singleshot?
bool iteration_allowed;
bool singleshot_allowed;
// Climbing and falling images
std::vector<GNEB_Image_Type> image_type;
// Reaction coordinates of images in the chain
std::vector<scalar> Rx;
// Reaction coordinates of interpolated points
std::vector<scalar> Rx_interpolated;
// Total Energy of the spin systems and interpolated values
std::vector<scalar> E_interpolated;
std::vector<std::vector<scalar>> E_array_interpolated;
// If a prefactor calculation is performed on the chain, we keep the results
HTST_Info htst_info;
private:
// FIFO mutex for thread-safety
Utility::OrderedLock ordered_lock;
};
} // namespace Spirit::Data
#endif