@@ -188,7 +188,17 @@ Running scripts
Batch system
For the phase_transition_mpi program, there are scripts in the **./slurm_scripts** directory that come along with it. This is to be able to run it on a batch system using Slurm if you have access to one. The only program that should be executed by the user is the **./slurm_scripts/execute.script** script. You can see how to use this script by doing:
./slurm_scripts/execute.script --help
-
This is the recommended way to use this program as it takes approximately 90 minutes to complete when using 8 processes where each process has 10 threads.
+This is the recommended way of using the program. Here is a table using different parameters on the Fox cluster:
+
+
+| Lattice size | Samples | Processes | threads | Time (seconds) |
+
+| 20 | 1e7 | 10 | 10 | 133.735 |
+
+| 40 | 1e7 | 10 | 10 | 814.126 |
+
+| 60 | 1e7 | 10 | 10 | 2575.33 |
+
If you happen to have such a system available to you, then you should clone this repo on that system, then compile the MPI program like this:
make bin/phase_transition_mpi
After compiling, you can schedule it by using the **./slurm_scripts/execute.script**:
diff --git a/docs/main_8cpp.html b/docs/main_8cpp.html
index a5e86df..6ac48da 100644
--- a/docs/main_8cpp.html
+++ b/docs/main_8cpp.html
@@ -119,7 +119,7 @@ Functions
| | Create the data for the burn-in time for temperatures 1.0 and 2.4 for both unordered and ordered initial states.
|
| |
| void | create_pd_estimate_data () |
-| | Create the data used to estimate the probability distribution for tempratures 1.0 anbd 2.4.
|
+| | Create the data used to estimate the probability distribution for tempratures 1.0 and 2.4.
|
| |
| void | test_burn_in_time () |
| | Create data using the same parameters except one uses burn-in time, while the other doesn't.
|
@@ -183,7 +183,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-
Create the data used to estimate the probability distribution for tempratures 1.0 anbd 2.4.
+
Create the data used to estimate the probability distribution for tempratures 1.0 and 2.4.
Definition at line 37 of file main.cpp.
diff --git a/docs/main_8cpp_source.html b/docs/main_8cpp_source.html
index 727245f..5ee72db 100644
--- a/docs/main_8cpp_source.html
+++ b/docs/main_8cpp_source.html
@@ -125,25 +125,25 @@ $(document).ready(function(){initNavTree('main_8cpp_source.html',''); initResiza
24 montecarlo::progression(1.0, 20, 20000,
-
25 "../output/burn_in_time/unordered_1_0.txt");
+
25 "./data/hp/burn_in_time/unordered_1_0.txt");
26 montecarlo::progression(1.0, 20, 20000, 1,
-
27 "../output/burn_in_time/ordered_1_0.txt");
+
27 "./data/hp/burn_in_time/ordered_1_0.txt");
28 montecarlo::progression(2.4, 20, 20000,
-
29 "../output/burn_in_time/unordered_2_4.txt");
+
29 "./data/hp/burn_in_time/unordered_2_4.txt");
30 montecarlo::progression(2.4, 20, 20000, 1,
-
31 "../output/burn_in_time/ordered_2_4.txt");
+
31 "./data/hp/burn_in_time/ordered_2_4.txt");
-
35
+
35
36
-
41 "../output/pd_estimate/estimate_1_0.txt");
+
41 "./data/hp/pd_estimate/estimate_1_0.txt");
-
43 "../output/pd_estimate/estimate_2_4.txt");
+
43 "./data/hp/pd_estimate/estimate_2_4.txt");
@@ -153,10 +153,10 @@ $(document).ready(function(){initNavTree('main_8cpp_source.html',''); initResiza
-
53 "../output/test_burn_in_time/burn_in.txt", 5000);
+
53 "./data/hp/test_burn_in_time/burn_in.txt", 5000);
-
56 "../output/test_burn_in_time/no_burn_in.txt", 0);
+
56 "./data/hp/test_burn_in_time/no_burn_in.txt", 0);
@@ -191,19 +191,19 @@ $(document).ready(function(){initNavTree('main_8cpp_source.html',''); initResiza
-
91 "../output/phase_transition/size_20.txt");
+
91 "./data/hp/phase_transition/size_20.txt");
-
94 "../output/phase_transition/size_40.txt");
+
94 "./data/hp/phase_transition/size_40.txt");
-
97 "../output/phase_transition/size_60.txt");
+
97 "./data/hp/phase_transition/size_60.txt");
-
100 "../output/phase_transition/size_80.txt");
+
100 "./data/hp/phase_transition/size_80.txt");
-
103 "../output/phase_transition/size_100.txt");
+
103 "./data/hp/phase_transition/size_100.txt");
104 t1 = omp_get_wtime();
106 std::cout <<
"Time: " << t1 - t0 << std::endl;
@@ -281,15 +281,15 @@ $(document).ready(function(){initNavTree('main_8cpp_source.html',''); initResiza
Type to use with the IsingModel class and montecarlo module.
void test_parallel_speedup()
Test how much Openmp speeds up.
int main(int argc, char **argv)
The main function.
-
void create_pd_estimate_data()
Create the data used to estimate the probability distribution for tempratures 1.0 anbd 2....
+
void create_pd_estimate_data()
Create the data used to estimate the probability distribution for tempratures 1.0 and 2....
void create_burn_in_time_data()
Create the data for the burn-in time for temperatures 1.0 and 2.4 for both unordered and ordered init...
void test_burn_in_time()
Create data using the same parameters except one uses burn-in time, while the other doesn't.
void create_phase_transition_data()
Create data for studying phase transition.
void usage(std::string filename)
A function that displays how to use the program and quits.
-
void 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.
-
data_t 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.
-
data_t 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.
-
void 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.
+
void 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.
+
data_t 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.
+
data_t 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.
+
void 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.
diff --git a/docs/mcmc__progression_8cpp_source.html b/docs/mcmc__progression_8cpp_source.html
index 8ce6821..1c590ff 100644
--- a/docs/mcmc__progression_8cpp_source.html
+++ b/docs/mcmc__progression_8cpp_source.html
@@ -108,7 +108,7 @@ $(document).ready(function(){initNavTree('mcmc__progression_8cpp_source.html',''
5
6
7
- 8
+ 8
9
10
11
@@ -135,52 +135,67 @@ $(document).ready(function(){initNavTree('mcmc__progression_8cpp_source.html',''
32int main(
int argc,
char **argv)
- 35 struct option long_options[] = {{
"help", 0, 0, 0}, {NULL, 0, NULL, 0}};
-
- 37 int option_index = -1;
-
-
-
- 41 c = getopt_long(argc, argv,
"h", long_options, &option_index);
-
-
-
-
-
-
- 48 switch (option_index) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 69 double temp = atoi(argv[1]);
- 70 int L = atoi(argv[2]), cycles = atoi(argv[3]), burn_in_time = atoi(argv[4]);
- 71 std::string outfile = argv[5];
-
- 73 montecarlo::progression(temp, L, cycles, outfile, burn_in_time);
+ 35 struct option long_options[] = {
+ 36 {
"help", 0, 0, 0}, {NULL, 0, NULL, 0}};
+
+ 38 int option_index = -1;
+
+
+
+ 42 c = getopt_long(argc, argv,
"h", long_options, &option_index);
+
+
+
+
+
+
+ 49 switch (option_index) {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
- 77 std::cout <<
"Time: " << t1 - t0 <<
" seconds\n";
-
+
+ 76 double temp = atoi(argv[1]);
+ 77 int L = atoi(argv[2]), cycles = atoi(argv[3]), burn_in_time = atoi(argv[4]);
+ 78 std::string outfile = argv[5];
+
+
+
+
+
+
+ 85 montecarlo::progression(temp, L, cycles, outfile, burn_in_time);
+
+
+
+
+ 90 std::cout <<
"Time: " << t1 - t0 <<
" seconds\n";
+
int main(int argc, char **argv)
The main function.
void usage(std::string filename)
A function that displays how to use the program and quits.
+void 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.
+#define DEBUG(msg)
Writes a debug message.
diff --git a/docs/monte__carlo_8cpp.html b/docs/monte__carlo_8cpp.html
index 4676787..730314e 100644
--- a/docs/monte__carlo_8cpp.html
+++ b/docs/monte__carlo_8cpp.html
@@ -191,7 +191,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
- Returns
- data_t
-Definition at line 141 of file monte_carlo.cpp.
+Definition at line 127 of file monte_carlo.cpp.
@@ -245,7 +245,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
- Returns
- data_t
-Definition at line 122 of file monte_carlo.cpp.
+Definition at line 108 of file monte_carlo.cpp.
@@ -305,7 +305,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-Definition at line 91 of file monte_carlo.cpp.
+Definition at line 77 of file monte_carlo.cpp.
@@ -385,7 +385,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-Definition at line 169 of file monte_carlo.cpp.
+Definition at line 155 of file monte_carlo.cpp.
@@ -512,7 +512,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-Definition at line 53 of file monte_carlo.cpp.
+Definition at line 46 of file monte_carlo.cpp.
diff --git a/docs/monte__carlo_8cpp_source.html b/docs/monte__carlo_8cpp_source.html
index cf453d5..d035ff8 100644
--- a/docs/monte__carlo_8cpp_source.html
+++ b/docs/monte__carlo_8cpp_source.html
@@ -126,180 +126,166 @@ $(document).ready(function(){initNavTree('monte__carlo_8cpp_source.html',''); in
-
- 27 std::random_device rd;
- 28 uint32_t rd_sample = rd();
- 29 std::mt19937 engine(rd_sample);
-
- 31 std::cout <<
"Seed: " << rd_sample << std::endl;
-
-
-
-
-
-
-
- 39 for (size_t i = 0; i < burn_in_time; i++) {
-
-
-
-
- 44 for (size_t i = 1; i <= cycles; i++) {
-
- 46 tmp = data / (i * n_spins);
- 47 ofile << i <<
',' << tmp
.E <<
',' << tmp
.E2 <<
',' << tmp
.M <<
','
-
-
-
-
+
+
+
+
+
+
+ 32 for (size_t i = 0; i < burn_in_time; i++) {
+
+
+
+
+ 37 for (size_t i = 1; i <= cycles; i++) {
+
+ 39 tmp = data / (i * n_spins);
+ 40 ofile << i <<
',' << tmp
.E <<
',' << tmp
.E2 <<
',' << tmp
.M <<
','
+
+
+
+
+
+
+ 47 const std::string filename,
int burn_in_time)
+
+
+
+
-
- 54 const std::string filename,
int burn_in_time)
-
-
-
-
-
-
-
-
-
-
- 65 std::random_device rd;
- 66 uint32_t rd_sample = rd();
- 67 std::mt19937 engine(rd());
-
- 69 std::cout <<
"Seed: " << rd_sample << std::endl;
-
-
-
- 73 for (size_t i = 0; i < burn_in_time; i++) {
-
-
+
+
+
+
+
+
+ 59 for (size_t i = 0; i < burn_in_time; i++) {
+
+
+
+
+
+
+
+
+ 68 for (size_t i = 1; i <= cycles; i++) {
+
+ 70 tmp = data / (i * n_spins);
+ 71 ofile << i <<
',' << tmp
.E <<
',' << tmp
.E2 <<
',' << tmp
.M <<
','
+
+
+
+
-
-
-
-
-
- 82 for (size_t i = 1; i <= cycles; i++) {
-
- 84 tmp = data / (i * n_spins);
- 85 ofile << i <<
',' << tmp
.E <<
',' << tmp
.E2 <<
',' << tmp
.M <<
','
-
-
-
-
-
- 91void pd_estimate(
double T,
int L,
int cycles,
const std::string filename,
-
-
-
-
-
+ 77void pd_estimate(
double T,
int L,
int cycles,
const std::string filename,
+
+
+
+
+
+
+
+
+
+
+
+
+ 90 for (size_t i = 0; i < burn_in_time; i++) {
+
+
+
+
+
+
-
-
-
-
-
-
- 104 for (size_t i = 0; i < burn_in_time; i++) {
-
-
-
-
-
- 110 ofile.open(filename);
-
-
- 113 for (size_t i = 1; i <= cycles; i++) {
-
- 115 ofile << data
.E <<
',' << data
.E2 <<
',' << data
.M <<
',' << data
.M2
- 116 <<
',' << data
.M_abs <<
'\n';
-
-
-
-
-
-
-
-
-
+
+ 99 for (size_t i = 1; i <= cycles; i++) {
+
+ 101 ofile << data
.E <<
',' << data
.E2 <<
',' << data
.M <<
',' << data
.M2
+ 102 <<
',' << data
.M_abs <<
'\n';
+
+
+
+
+
+
+
+
+
+
+ 113 for (size_t i = 0; i < burn_in_time; i++) {
+
+
+
+
+ 118 for (size_t i = 0; i < (uint)cycles; i++) {
+
+
+
+ 122 double norm = 1. / (
double)cycles;
+
+
+
- 127 for (size_t i = 0; i < burn_in_time; i++) {
-
-
-
-
- 132 for (size_t i = 0; i < (uint)cycles; i++) {
-
-
-
- 136 double norm = 1. / (
double)cycles;
-
-
-
+
+
+
+
+
+
+
+
+
+
+ 137 for (size_t i = 0; i < burn_in_time; i++) {
+
+
-
-
-
-
-
-
-
-
-
-
- 151 for (size_t i = 0; i < burn_in_time; i++) {
-
-
+
+
+
+ 144#pragma omp for schedule(static) reduction(+ : data)
+ 145 for (size_t i = 0; i < (uint)cycles; i++) {
+
+
+
+
+ 150 double norm = 1. / (
double)cycles;
+
+
+
-
-
-
- 158#pragma omp for schedule(static) reduction(+ : data)
- 159 for (size_t i = 0; i < (uint)cycles; i++) {
-
-
-
-
- 164 double norm = 1. / (
double)cycles;
-
-
-
-
-
- 170 std::function<
data_t(
int,
double,
int,
int)> monte_carlo,
- 171 std::string outfile,
int burn_in_time)
-
- 173 double dt = (end - start) / (
double)points;
-
-
+
+ 156 std::function<
data_t(
int,
double,
int,
int)> monte_carlo,
+ 157 std::string outfile,
int burn_in_time)
+
+ 159 double dt = (end - start) / (
double)points;
+
+
+
+
+
+
+
+
+ 168 double temp, CV, X, E_var, M_var;
+
+ 170 using utils::scientific_format;
+ 171 for (size_t i = 0; i < points; i++) {
+ 172 temp = start + dt * i;
+ 173 data = monte_carlo(L, temp, cycles, burn_in_time);
+ 174 E_var = (data
.E2 - data
.E * data
.E) / (
double)N;
+
-
-
-
-
-
- 182 double temp, CV, X, E_var, M_var;
-
- 184 using utils::scientific_format;
- 185 for (size_t i = 0; i < points; i++) {
- 186 temp = start + dt * i;
- 187 data = monte_carlo(L, temp, cycles, burn_in_time);
- 188 E_var = (data
.E2 - data
.E * data
.E) / (
double)N;
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
The Ising model in 2 dimensions.
IsingModel(int L, double T, int val)
Constructor for the Ising model.
IsingModel(int L, double T)
Constructor for the Ising model.
@@ -311,12 +297,12 @@ $(document).ready(function(){initNavTree('monte__carlo_8cpp_source.html',''); in
double M2
Magnetization squared.
-void 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 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.
+void 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 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.
void 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.
-data_t 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.
-data_t 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.
-void 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 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.
+data_t 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.
+void 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.
bool mkpath(std::string path, int mode=0777)
Make path given.
std::string scientific_format(double d, int width=20, int prec=10)
Turns a double into a string written in scientific format.
std::string dirname(const std::string &path)
Get the directory name of the path.
diff --git a/docs/monte__carlo_8hpp.html b/docs/monte__carlo_8hpp.html
index 8810cbd..35dc9f4 100644
--- a/docs/monte__carlo_8hpp.html
+++ b/docs/monte__carlo_8hpp.html
@@ -219,7 +219,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
- Returns
- data_t
-Definition at line 141 of file monte_carlo.cpp.
+Definition at line 127 of file monte_carlo.cpp.
@@ -273,7 +273,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
- Returns
- data_t
-Definition at line 122 of file monte_carlo.cpp.
+Definition at line 108 of file monte_carlo.cpp.
@@ -333,7 +333,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-Definition at line 91 of file monte_carlo.cpp.
+Definition at line 77 of file monte_carlo.cpp.
@@ -413,7 +413,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-Definition at line 169 of file monte_carlo.cpp.
+Definition at line 155 of file monte_carlo.cpp.
@@ -540,7 +540,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
-Definition at line 53 of file monte_carlo.cpp.
+Definition at line 46 of file monte_carlo.cpp.
diff --git a/docs/monte__carlo_8hpp_source.html b/docs/monte__carlo_8hpp_source.html
index b04f385..2f04bf6 100644
--- a/docs/monte__carlo_8hpp_source.html
+++ b/docs/monte__carlo_8hpp_source.html
@@ -207,18 +207,18 @@ $(document).ready(function(){initNavTree('monte__carlo_8hpp_source.html',''); in
Type to use with the IsingModel class and montecarlo module.
void test_parallel_speedup()
Test how much Openmp speeds up.
int main(int argc, char **argv)
The main function.
-void create_pd_estimate_data()
Create the data used to estimate the probability distribution for tempratures 1.0 anbd 2....
+void create_pd_estimate_data()
Create the data used to estimate the probability distribution for tempratures 1.0 and 2....
void create_burn_in_time_data()
Create the data for the burn-in time for temperatures 1.0 and 2.4 for both unordered and ordered init...
void test_burn_in_time()
Create data using the same parameters except one uses burn-in time, while the other doesn't.
void create_phase_transition_data()
Create data for studying phase transition.
void usage(std::string filename)
A function that displays how to use the program and quits.
-void 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 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.
+void 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 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.
void 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.
-data_t 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.
-data_t 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.
-void 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 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.
+data_t 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.
+void 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.
diff --git a/docs/pd__estimate_8cpp_source.html b/docs/pd__estimate_8cpp_source.html
index 7885bae..678da62 100644
--- a/docs/pd__estimate_8cpp_source.html
+++ b/docs/pd__estimate_8cpp_source.html
@@ -183,7 +183,7 @@ $(document).ready(function(){initNavTree('pd__estimate_8cpp_source.html',''); in
int main(int argc, char **argv)
The main function.
void usage(std::string filename)
A function that displays how to use the program and quits.
-void 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.
+void 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.
diff --git a/docs/phase__transition_8cpp_source.html b/docs/phase__transition_8cpp_source.html
index c233f9f..1259f10 100644
--- a/docs/phase__transition_8cpp_source.html
+++ b/docs/phase__transition_8cpp_source.html
@@ -186,8 +186,8 @@ $(document).ready(function(){initNavTree('phase__transition_8cpp_source.html',''
int main(int argc, char **argv)
The main function.
void usage(std::string filename)
A function that displays how to use the program and quits.
-void 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.
-data_t 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 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.
+data_t 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.
diff --git a/docs/phase__transition__mpi_8cpp_source.html b/docs/phase__transition__mpi_8cpp_source.html
index f608f12..0a1787b 100644
--- a/docs/phase__transition__mpi_8cpp_source.html
+++ b/docs/phase__transition__mpi_8cpp_source.html
@@ -279,7 +279,7 @@ $(document).ready(function(){initNavTree('phase__transition__mpi_8cpp_source.htm
Type to use with the IsingModel class and montecarlo module.
int main(int argc, char **argv)
The main function.
void usage(std::string filename)
A function that displays how to use the program and quits.
-data_t 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.
+data_t 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.
bool mkpath(std::string path, int mode=0777)
Make path given.
std::string scientific_format(double d, int width=20, int prec=10)
Turns a double into a string written in scientific format.
std::string dirname(const std::string &path)
Get the directory name of the path.
diff --git a/docs/time_8cpp.html b/docs/time_8cpp.html
index 809c11e..2aaa24c 100644
--- a/docs/time_8cpp.html
+++ b/docs/time_8cpp.html
@@ -168,7 +168,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
The main function.
-Definition at line 79 of file time.cpp.
+Definition at line 87 of file time.cpp.
@@ -210,7 +210,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
Time phase transition using different sample sizes.
-Definition at line 45 of file time.cpp.
+Definition at line 49 of file time.cpp.
@@ -232,7 +232,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)
A function that displays how to use the program and quits.
-Definition at line 67 of file time.cpp.
+Definition at line 75 of file time.cpp.
diff --git a/docs/time_8cpp_source.html b/docs/time_8cpp_source.html
index b4559b7..19b3f8a 100644
--- a/docs/time_8cpp_source.html
+++ b/docs/time_8cpp_source.html
@@ -124,110 +124,119 @@ $(document).ready(function(){initNavTree('time_8cpp_source.html',''); initResiza
21
- 24 std::string outfile =
"data/timing/lattice_sizes.txt";
+ 24 std::string outfile =
"data/hp/timing/lattice_sizes.txt";
27 int lattice_sizes[] = {20, 40, 60, 80, 100};
-
+
32 for (
int L : lattice_sizes) {
-
-
+
+
-
-
-
-
-
-
-
- 44
-
-
- 47 std::string outfile =
"data/timing/sample_sizes.txt";
-
-
- 50 int sample_sizes[] = {1000, 10000, 100000};
-
-
-
-
- 55 for (
int samples : sample_sizes) {
-
-
-
-
-
-
-
-
-
-
-
-
-
- 69 std::cout <<
"Usage: " << filename <<
" OPTION ...\n"
- 70 <<
"At least one option should be used.\n\n"
- 71 <<
"\t[ -h | --help ]\n"
-
- 73 <<
"\t[ --time-lattice-sizes ]\n"
- 74 <<
"\t[ --time-sample-sizes ]\n";
-
-
-
-
- 79int main(
int argc,
char **argv)
-
- 81 struct option long_options[] = {{
"all", 0, 0, 0},
- 82 {
"time-lattice-sizes", 0, 0, 0},
- 83 {
"time-sample-sizes", 0, 0, 0},
-
-
-
- 87 int option_index = -1;
-
-
-
- 91 c = getopt_long(argc, argv,
"h", long_options, &option_index);
-
-
-
-
-
-
- 98 switch (option_index) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+ 48
+
+
+ 51 std::string outfile =
"data/hp/timing/sample_sizes.txt";
+
+
+ 54 int sample_sizes[] = {1000, 10000, 100000};
+
+
+
+
+ 59 for (
int samples : sample_sizes) {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 77 std::cout <<
"Usage: " << filename <<
" OPTION ...\n"
+ 78 <<
"At least one option should be used.\n\n"
+ 79 <<
"\t[ -h | --help ]\n"
+
+ 81 <<
"\t[ --time-lattice-sizes ]\n"
+ 82 <<
"\t[ --time-sample-sizes ]\n";
+
+
+
+
+ 87int main(
int argc,
char **argv)
+
+ 89 struct option long_options[] = {{
"all", 0, 0, 0},
+ 90 {
"time-lattice-sizes", 0, 0, 0},
+ 91 {
"time-sample-sizes", 0, 0, 0},
+
+
+
+ 95 int option_index = -1;
+
+
+
+ 99 c = getopt_long(argc, argv,
"h", long_options, &option_index);
+
+
+
+
+
+
+ 106 switch (option_index) {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
int main(int argc, char **argv)
The main function.
void usage(std::string filename)
A function that displays how to use the program and quits.
-void 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.
-data_t 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 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.
+data_t 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.
+data_t 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.
void time_lattice_sizes()
Time phase transition using different lattice sizes.
-void time_sample_sizes()
Time phase transition using different sample sizes.
+void time_sample_sizes()
Time phase transition using different sample sizes.
bool mkpath(std::string path, int mode=0777)
Make path given.
std::string scientific_format(double d, int width=20, int prec=10)
Turns a double into a string written in scientific format.
std::string dirname(const std::string &path)
Get the directory name of the path.
diff --git a/python_scripts/burn_in_time.py b/python_scripts/burn_in_time.py
index 9625565..2549ca0 100644
--- a/python_scripts/burn_in_time.py
+++ b/python_scripts/burn_in_time.py
@@ -17,8 +17,6 @@ plt.rcParams.update(params)
def plot_1_0():
files = [
- # "data/hp/burn_in_time/unordered_1_0_1421110368.txt",
- # "data/hp/burn_in_time/ordered_1_0_611577739.txt",
"data/hp/burn_in_time/unordered_1_0.txt",
"data/hp/burn_in_time/ordered_1_0.txt",
]
@@ -65,8 +63,6 @@ def plot_1_0():
def plot_2_4():
files = [
- # "data/hp/burn_in_time/unordered_2_4_1212892317.txt",
- # "data/hp/burn_in_time/ordered_2_4_2408603856.txt",
"data/hp/burn_in_time/unordered_2_4.txt",
"data/hp/burn_in_time/ordered_2_4.txt",
]
diff --git a/python_scripts/timing.py b/python_scripts/timing.py
index 190f7bb..5ab66ab 100644
--- a/python_scripts/timing.py
+++ b/python_scripts/timing.py
@@ -17,6 +17,7 @@ params = {
}
plt.rcParams.update(params)
+
def plot_timing(indir, outdir):
if not (path := Path(outdir)).exists():
makedirs(path)
@@ -25,14 +26,10 @@ def plot_timing(indir, outdir):
"lattice_sizes.txt",
"sample_sizes.txt",
]
- labels = [
- "Lattice sizes",
- "Sample sizes",
- ]
xlabels = ["Lattice size", "Sampling size"]
outfiles = ["lattice_size.pdf", "sample_sizes.pdf"]
- for file, label, xlabel, outfile in zip(files, labels, xlabels, outfiles):
+ for file, xlabel, outfile in zip(files, xlabels, outfiles):
figure1, ax1 = plt.subplots()
x = []
parallel = []