diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-07-24 13:12:35 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-07-24 13:12:35 -0400 |
commit | c48fd16fe1554c88c79a1f0d50e81c803da8f61f (patch) | |
tree | 2b8a07de4e0fc795854fc4c1ac0ff095783218fa /lib/cluster.h | |
parent | 8d96c4d30214a2c27561740b7b3f7e1e3b0bbfe4 (diff) | |
download | c++-c48fd16fe1554c88c79a1f0d50e81c803da8f61f.tar.gz c++-c48fd16fe1554c88c79a1f0d50e81c803da8f61f.tar.bz2 c++-c48fd16fe1554c88c79a1f0d50e81c803da8f61f.zip |
implemented updating the first fourier moment in wolff_finite, but also make wolff_finite obselete by adding a hacky preprocessor method for making wolff.h as efficient
Diffstat (limited to 'lib/cluster.h')
-rw-r--r-- | lib/cluster.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/cluster.h b/lib/cluster.h index 5124061..b8c98e5 100644 --- a/lib/cluster.h +++ b/lib/cluster.h @@ -64,7 +64,11 @@ void flip_cluster(state_t <R_t, X_t> *state, v_t v0, R_t r, gsl_rng *rand) { non_ghost = vn; } double dE = state->H(rs_old) - state->H(rs_new); +#ifdef FINITE_STATES + prob = H_probs[N_STATES * state_to_ind(rs_old) + state_to_ind(rs_new)]; +#else prob = 1.0 - exp(-dE / state->T); +#endif add(&(state->M), -1, rs_old); add(&(state->M), 1, rs_new); @@ -84,7 +88,11 @@ void flip_cluster(state_t <R_t, X_t> *state, v_t v0, R_t r, gsl_rng *rand) { free_spin (rs_new); } else { double dE = state->J(si_old, sj) - state->J(si_new, sj); +#ifdef FINITE_STATES + prob = J_probs[N_STATES * N_STATES * state_to_ind(si_old) + N_STATES * state_to_ind(si_new) + state_to_ind(sj)]; +#else prob = 1.0 - exp(-dE / state->T); +#endif state->E += dE; } |