diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-10-17 19:33:25 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-10-17 19:33:25 -0400 |
commit | f2f7a072216dfafab89851e4ff3e0b2c3eb16663 (patch) | |
tree | f9c7e1e4e91ce8b0ec9cef9f2423029fe7b7f049 /examples/simple_measurement.hpp | |
parent | 1343a3fe6bd17a2487f12a0d61be8dc83cd722a0 (diff) | |
download | c++-f2f7a072216dfafab89851e4ff3e0b2c3eb16663.tar.gz c++-f2f7a072216dfafab89851e4ff3e0b2c3eb16663.tar.bz2 c++-f2f7a072216dfafab89851e4ff3e0b2c3eb16663.zip |
removed a lot of research code to simplify library and examples for publication
Diffstat (limited to 'examples/simple_measurement.hpp')
-rw-r--r-- | examples/simple_measurement.hpp | 66 |
1 files changed, 66 insertions, 0 deletions
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 <wolff/measurement.hpp> + +template <class R_t, class X_t> +class simple_measurement : public wolff_measurement<R_t, X_t> { + 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<R_t, X_t>& 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<R_t, X_t>&, v_t, const R_t&) { + C = 0; + } + + void plain_bond_visited(const wolff_system<R_t, X_t>&, v_t, const X_t&, v_t, double dE) { + E += dE; + } + + void ghost_bond_visited(const wolff_system<R_t, X_t>&, 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<R_t, X_t>&, v_t, const X_t&) { + C++; + } + + void ghost_site_transformed(const wolff_system<R_t, X_t>&, const R_t&) {} + + void post_cluster(N_t, N_t, const wolff_system<R_t, X_t>&) { + 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; + } +}; + |