2 Dimensional Ising Model
Simulate the change in energy and magnetization in a ferro magnet
Loading...
Searching...
No Matches
monte_carlo.cpp File Reference

Implementation of the monte carlo functions. More...

#include "monte_carlo.hpp"

Go to the source code of this file.

Functions

void montecarlo::progression (double T, int L, int cycles, const std::string filename, int burn_in_time=BURN_IN_TIME)
 Write the expected values for each Monte Carlo cycles to file.
 
void montecarlo::progression (double T, int L, int cycles, int value, const std::string filename, int burn_in_time=BURN_IN_TIME)
 Write the expected values for each Monte Carlo cycles to file.
 
void montecarlo::pd_estimate (double T, int L, int cycles, const std::string filename, int burn_in_time=BURN_IN_TIME)
 Estimate the probability distribution for the energy.
 
data_t montecarlo::mcmc_serial (int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)
 Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles.
 
data_t montecarlo::mcmc_parallel (int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)
 Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.
 
void montecarlo::phase_transition (int L, double start_T, double end_T, int points_T, int cycles, std::function< data_t(int, double, int, int)> monte_carlo, std::string outfile, int burn_in_time=BURN_IN_TIME)
 Perform the MCMC algorithm using a range of temperatures.
 

Detailed Description

Implementation of the monte carlo functions.

Author
Cory Alexander Balaton (coryab)
Janita Ovidie Sandtrøen Willumsen (janitaws)
Version
1.0
Bug:
No known bugs

Definition in file monte_carlo.cpp.

Function Documentation

◆ mcmc_parallel()

data_t montecarlo::mcmc_parallel ( int  L,
double  T,
int  cycles,
int  burn_in_time = BURN_IN_TIME 
)

Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.

Parameters
LThe size of the lattice
TThe Temperature for the Ising model
cyclesThe amount of Monte Carlo cycles to do
burn_in_timeThe burn-in time to use
Returns
data_t

Definition at line 127 of file monte_carlo.cpp.

◆ mcmc_serial()

data_t montecarlo::mcmc_serial ( int  L,
double  T,
int  cycles,
int  burn_in_time = BURN_IN_TIME 
)

Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles.

Parameters
LThe size of the lattice
TThe Temperature for the Ising model
cyclesThe amount of Monte Carlo cycles to do
burn_in_timeThe burn-in time to use
Returns
data_t

Definition at line 108 of file monte_carlo.cpp.

◆ pd_estimate()

void montecarlo::pd_estimate ( double  T,
int  L,
int  cycles,
const std::string  filename,
int  burn_in_time = BURN_IN_TIME 
)

Estimate the probability distribution for the energy.

Parameters
TThe temperature of the Ising model
LThe size of the lattice
cyclesThe amount of Monte Carlo cycles to do
filenameThe file to write to
burn_in_timeThe burn-in time to use

Definition at line 77 of file monte_carlo.cpp.

◆ phase_transition()

void montecarlo::phase_transition ( int  L,
double  start_T,
double  end_T,
int  points_T,
int  cycles,
std::function< data_t(int, double, int, int)>  monte_carlo,
std::string  outfile,
int  burn_in_time = BURN_IN_TIME 
)

Perform the MCMC algorithm using a range of temperatures.

Parameters
LThe size of the lattice
start_TThe start temperature
end_TThe end temperature
point_TThe amount of point to measure
monte_carloWhich Monte Carlo implementation to use
outfileThe file to write the data to
burn_in_timeThe burn-in time to use

Definition at line 155 of file monte_carlo.cpp.

◆ progression() [1/2]

void montecarlo::progression ( double  T,
int  L,
int  cycles,
const std::string  filename,
int  burn_in_time = BURN_IN_TIME 
)

Write the expected values for each Monte Carlo cycles to file.

Parameters
TTemperature
LThe size of the lattice
cyclesThe amount of Monte Carlo cycles to do
filenameThe file to write to
burn_in_timeThe burn-in time to use

Definition at line 15 of file monte_carlo.cpp.

◆ progression() [2/2]

void montecarlo::progression ( double  T,
int  L,
int  cycles,
int  value,
const std::string  filename,
int  burn_in_time = BURN_IN_TIME 
)

Write the expected values for each Monte Carlo cycles to file.

Parameters
TTemperature
LThe size of the lattice
cyclesThe amount of Monte Carlo cycles to do
valueThe value to set the elements in the lattice
filenameThe file to write to
burn_in_timeThe burn-in time to use

Definition at line 46 of file monte_carlo.cpp.