From f55ea55041e5c30f156a3257f6cd92fff86f01c9 Mon Sep 17 00:00:00 2001 From: Cory Date: Tue, 5 Dec 2023 18:15:46 +0100 Subject: [PATCH] Some updates --- python_scripts/burn_in_time.py | 12 ++++++++---- src/mcmc_progression.cpp | 21 +++++++++++++++++---- src/monte_carlo.cpp | 14 -------------- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/python_scripts/burn_in_time.py b/python_scripts/burn_in_time.py index 429f26d..9625565 100644 --- a/python_scripts/burn_in_time.py +++ b/python_scripts/burn_in_time.py @@ -17,8 +17,10 @@ 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_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", ] labels = [ "Unordered", @@ -63,8 +65,10 @@ 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_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", ] labels = [ "Unordered", diff --git a/src/mcmc_progression.cpp b/src/mcmc_progression.cpp index e6982d5..f95a83d 100644 --- a/src/mcmc_progression.cpp +++ b/src/mcmc_progression.cpp @@ -5,7 +5,7 @@ * * @version 1.0 * - * @brief Execute the mcmc algorithm and write data to file after each + * @brief Execute the mcmc algorithm and write data to file after each * Monte Carlo cycle. * * @bug No known bugs @@ -33,7 +33,8 @@ void usage(std::string filename) int main(int argc, char **argv) { // Command options - struct option long_options[] = {{"help", 0, 0, 0}, {NULL, 0, NULL, 0}}; + struct option long_options[] = { + {"help", 0, 0, 0}, {NULL, 0, NULL, 0}}; int option_index = -1; int c; @@ -57,11 +58,17 @@ int main(int argc, char **argv) usage(argv[0]); } } - // Check that the number of arguments is at least 8. + // Check that the number of arguments is at least 6. if (argc < 6) { usage(argv[0]); } + bool ordered = false; + + if (argc == 7) { + ordered = true; + } + // Timing variables double t0, t1; t0 = omp_get_wtime(); @@ -71,7 +78,13 @@ int main(int argc, char **argv) int L = atoi(argv[2]), cycles = atoi(argv[3]), burn_in_time = atoi(argv[4]); std::string outfile = argv[5]; - montecarlo::progression(temp, L, cycles, outfile, burn_in_time); + if (ordered) { + DEBUG("Hello"); + montecarlo::progression(temp, L, cycles, 1, outfile, burn_in_time); + } + else { + montecarlo::progression(temp, L, cycles, outfile, burn_in_time); + } t1 = omp_get_wtime(); diff --git a/src/monte_carlo.cpp b/src/monte_carlo.cpp index 542ffb5..8fdd7f5 100644 --- a/src/monte_carlo.cpp +++ b/src/monte_carlo.cpp @@ -23,13 +23,6 @@ void progression(double T, int L, int cycles, const std::string filename, std::string directory = utils::dirname(filename); std::ofstream ofile; - // Create random engine using the mersenne twister - std::random_device rd; - uint32_t rd_sample = rd(); - std::mt19937 engine(rd_sample); - - std::cout << "Seed: " << rd_sample << std::endl; - IsingModel ising(L, T); // Create path and open file @@ -61,13 +54,6 @@ void progression(double T, int L, int cycles, int value, std::string directory = utils::dirname(filename); std::ofstream ofile; - // Create random engine using the mersenne twister - std::random_device rd; - uint32_t rd_sample = rd(); - std::mt19937 engine(rd()); - - std::cout << "Seed: " << rd_sample << std::endl; - IsingModel ising(L, T, value); for (size_t i = 0; i < burn_in_time; i++) {