From f2f7a072216dfafab89851e4ff3e0b2c3eb16663 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Wed, 17 Oct 2018 19:33:25 -0400 Subject: removed a lot of research code to simplify library and examples for publication --- examples/simple_measurement.hpp | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 examples/simple_measurement.hpp (limited to 'examples/simple_measurement.hpp') diff --git a/examples/simple_measurement.hpp b/examples/simple_measurement.hpp new file mode 100644 index 0000000..2287c58 --- /dev/null +++ b/examples/simple_measurement.hpp @@ -0,0 +1,66 @@ + +#include + +template +class simple_measurement : public wolff_measurement { + private: + N_t n; + + double E; + typename X_t::M_t M; + v_t C; + + double totalE; + typename X_t::F_t totalM; + double totalC; + + public: + simple_measurement(const wolff_system& S) { + n = 0; + M = S.nv * S.s[0]; + E = - (S.ne * S.Z(S.s[0], S.s[0]) + S.nv * S.B(S.s[0])); + + totalE = 0; + totalM = 0.0 * (S.s[0]); + totalC = 0; + } + + void pre_cluster(N_t, N_t, const wolff_system&, v_t, const R_t&) { + C = 0; + } + + void plain_bond_visited(const wolff_system&, v_t, const X_t&, v_t, double dE) { + E += dE; + } + + void ghost_bond_visited(const wolff_system&, v_t, const X_t& s_old, const X_t& s_new, double dE) { + E += dE; + M += s_new - s_old; + } + + void plain_site_transformed(const wolff_system&, v_t, const X_t&) { + C++; + } + + void ghost_site_transformed(const wolff_system&, const R_t&) {} + + void post_cluster(N_t, N_t, const wolff_system&) { + totalE += E; + totalM += M; + totalC += C; + n++; + } + + double avgE() { + return totalE / n; + } + + typename X_t::F_t avgM() { + return totalM / n; + } + + double avgC() { + return totalC / n; + } +}; + -- cgit v1.2.3-70-g09d2