From 0c69763278ed102d0e37aa1fb4feda5827c26c62 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Sat, 21 Jul 2018 13:21:49 -0400 Subject: simplified the way that measurements work --- src/wolff_ising.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/wolff_ising.cpp') diff --git a/src/wolff_ising.cpp b/src/wolff_ising.cpp index 1812527..fd2f0bb 100644 --- a/src/wolff_ising.cpp +++ b/src/wolff_ising.cpp @@ -30,7 +30,7 @@ int main(int argc, char *argv[]) { case 'T': // temperature T = atof(optarg); break; - case 'H': // external field. nth call couples to state n + case 'H': // external field H = atof(optarg); break; case 's': // don't print anything during simulation. speeds up slightly @@ -49,21 +49,18 @@ int main(int argc, char *argv[]) { std::function *)> gen_R = generate_ising_rotation; - unsigned int n_measurements = 1; - double average_M = 0; - std::function *)> *measurements = (std::function *)> *)calloc(1, sizeof(std::function *)>)); + typedef std::function *)> meas_func; - measurements[0] = [&] (const state_t *s) { + meas_func measurement = [&] (const state_t *s) { average_M += (double)s->M / (double)N / (double)s->nv; }; - wolff(N, &s, gen_R, n_measurements, measurements, r, silent); + wolff(N, &s, gen_R, measurement, r, silent); printf("%" PRIcount " Ising runs completed. D = %" PRID ", L = %" PRIL ", T = %g, H = %g, = %g\n", N, D, L, T, H, average_M); - free(measurements); gsl_rng_free(r); return 0; -- cgit v1.2.3-70-g09d2