Some updates

This commit is contained in:
Cory Balaton 2023-12-05 18:15:46 +01:00
parent e64e2a5d02
commit f55ea55041
No known key found for this signature in database
GPG Key ID: 3E5FCEBFD80F432B
3 changed files with 25 additions and 22 deletions

View File

@ -17,8 +17,10 @@ plt.rcParams.update(params)
def plot_1_0(): def plot_1_0():
files = [ files = [
"data/hp/burn_in_time/unordered_1_0_1421110368.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/ordered_1_0_611577739.txt",
"data/hp/burn_in_time/unordered_1_0.txt",
"data/hp/burn_in_time/ordered_1_0.txt",
] ]
labels = [ labels = [
"Unordered", "Unordered",
@ -63,8 +65,10 @@ def plot_1_0():
def plot_2_4(): def plot_2_4():
files = [ files = [
"data/hp/burn_in_time/unordered_2_4_1212892317.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/ordered_2_4_2408603856.txt",
"data/hp/burn_in_time/unordered_2_4.txt",
"data/hp/burn_in_time/ordered_2_4.txt",
] ]
labels = [ labels = [
"Unordered", "Unordered",

View File

@ -5,7 +5,7 @@
* *
* @version 1.0 * @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. * Monte Carlo cycle.
* *
* @bug No known bugs * @bug No known bugs
@ -33,7 +33,8 @@ void usage(std::string filename)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
// Command options // 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 option_index = -1;
int c; int c;
@ -57,11 +58,17 @@ int main(int argc, char **argv)
usage(argv[0]); 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) { if (argc < 6) {
usage(argv[0]); usage(argv[0]);
} }
bool ordered = false;
if (argc == 7) {
ordered = true;
}
// Timing variables // Timing variables
double t0, t1; double t0, t1;
t0 = omp_get_wtime(); 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]); int L = atoi(argv[2]), cycles = atoi(argv[3]), burn_in_time = atoi(argv[4]);
std::string outfile = argv[5]; 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(); t1 = omp_get_wtime();

View File

@ -23,13 +23,6 @@ void progression(double T, int L, int cycles, const std::string filename,
std::string directory = utils::dirname(filename); std::string directory = utils::dirname(filename);
std::ofstream ofile; 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); IsingModel ising(L, T);
// Create path and open file // 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::string directory = utils::dirname(filename);
std::ofstream ofile; 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); IsingModel ising(L, T, value);
for (size_t i = 0; i < burn_in_time; i++) { for (size_t i = 0; i < burn_in_time; i++) {