-
Notifications
You must be signed in to change notification settings - Fork 53
/
Method_MC.hpp
71 lines (54 loc) · 1.97 KB
/
Method_MC.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
#pragma once
#ifndef SPIRIT_CORE_ENGINE_METHOD_MC_HPP
#define SPIRIT_CORE_ENGINE_METHOD_MC_HPP
#include "Spirit_Defines.h"
#include <engine/Method.hpp>
// #include <engine/Method_Solver.hpp>
#include <data/Spin_System.hpp>
// #include <data/Parameters_Method_MC.hpp>
#include <vector>
namespace Engine
{
/*
The Monte Carlo method
*/
class Method_MC : public Method
{
public:
// Constructor
Method_MC( std::shared_ptr<Data::Spin_System> system, int idx_img, int idx_chain );
// Method name as string
std::string Name() override;
private:
// Solver_Iteration represents one iteration of a certain Solver
void Iteration() override;
void Displace_Spin(int ispin, vectorfield & spins_new, const vectorfield & spins_old, std::uniform_real_distribution<scalar> & distribution);
// Metropolis iteration with adaptive cone radius
void Metropolis( const vectorfield & spins_old, vectorfield & spins_new );
// Save the current Step's Data: spins and energy
void Save_Current( std::string starttime, int iteration, bool initial = false, bool final = false ) override;
// A hook into the Method before an Iteration of the Solver
void Hook_Pre_Iteration() override;
// A hook into the Method after an Iteration of the Solver
void Hook_Post_Iteration() override;
// Sets iteration_allowed to false for the corresponding method
void Initialize() override;
// Sets iteration_allowed to false for the corresponding method
void Finalize() override;
// Log message blocks
void Message_Start() override;
void Message_Step() override;
void Message_End() override;
std::shared_ptr<Data::Parameters_Method_MC> parameters_mc;
// Cosine of current cone angle
scalar cone_angle;
int n_rejected;
scalar acceptance_ratio_current;
int nos_nonvacant;
// Random vector array
vectorfield xi;
// Vector to save the previous spin directions
vectorfield spins_new;
};
} // namespace Engine
#endif