2 Dimensional Ising Model Simulate the change in energy and magnetization in a ferro magnet

Loading...
Searching...
No Matches
monte_carlo.hpp
Go to the documentation of this file.
1
12#ifndef __MONTE_CARLO__
13#define __MONTE_CARLO__
14
15#include "IsingModel.hpp"
16#include "data_type.hpp"
17#include "utils.hpp"
18
19#include <functional>
20#include <string>
21#include <omp.h>
22
23//#define BURN_IN_TIME 12500
24#define BURN_IN_TIME 5000
25
26#pragma omp declare reduction(+: data_t: omp_out += omp_in)
27
35 int test_2x2_lattice(double tol, int max_cycles);
36
44 void monte_carlo_progression(double T, int L, int cycles,
45 const std::string filename);
46
55 void monte_carlo_progression(double T, int L, int cycles, int value,
56 const std::string filename);
57
65 void pd_estimate(double T, int L, int cycles, const std::string filename);
66
76 data_t monte_carlo_serial(int L, double T, int cycles);
77
87 data_t monte_carlo_parallel(int L, double T, int cycles);
88
98 void phase_transition(
99 int L, double start_T, double end_T, int points_T,
100 std::function<data_t(int, double, int)> monte_carlo,
101 std::string outfile);
102
103#endif
IsingModel.hpp
The definition of the Ising model.
data_t
Definition: data_type.hpp:18
data_type.hpp
Header for the data_t type.
phase_transition
void phase_transition(int L, double start_T, double end_T, int points_T, std::function< data_t(int, double, int)> monte_carlo, std::string outfile)
Perform the MCMC algorithm using a range of temperatures.
Definition: monte_carlo.cpp:156
monte_carlo_serial
data_t monte_carlo_serial(int L, double T, int cycles)
Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles.
Definition: monte_carlo.cpp:111
pd_estimate
void pd_estimate(double T, int L, int cycles, const std::string filename)
Estimate the probability distribution for the energy.
Definition: monte_carlo.cpp:85
test_2x2_lattice
int test_2x2_lattice(double tol, int max_cycles)
Test numerical data with analytical data.
monte_carlo_progression
void monte_carlo_progression(double T, int L, int cycles, const std::string filename)
Write the expected values for each Monte Carlo cycles to file.
Definition: monte_carlo.cpp:17
monte_carlo_parallel
data_t monte_carlo_parallel(int L, double T, int cycles)
Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.
Definition: monte_carlo.cpp:128
utils.hpp
Function prototypes and macros that are useful.