Merge branch 'janitaws/latex' into coryab/code

This commit is contained in:
2023-12-05 18:23:26 +01:00
53 changed files with 80594 additions and 343 deletions

View File

@@ -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
@@ -32,7 +32,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;
@@ -56,11 +57,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();
@@ -70,7 +77,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();

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::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++) {