From c48fd16fe1554c88c79a1f0d50e81c803da8f61f Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Tue, 24 Jul 2018 13:12:35 -0400 Subject: 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 --- lib/cluster_finite.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lib/cluster_finite.c') diff --git a/lib/cluster_finite.c b/lib/cluster_finite.c index 9392cf8..2041df0 100644 --- a/lib/cluster_finite.c +++ b/lib/cluster_finite.c @@ -34,7 +34,7 @@ v_t flip_cluster_finite(state_finite_t *s, v_t v0, R_t rot_ind, gsl_rng *r) { v_t nn = s->g->v_i[v + 1] - s->g->v_i[v]; for (v_t i = 0; i < nn; i++) { - q_t sn; + q_t sn, non_ghost; double prob; bool external_neighbor = false; @@ -42,8 +42,10 @@ v_t flip_cluster_finite(state_finite_t *s, v_t v0, R_t rot_ind, gsl_rng *r) { if (vn == s->g->nv - 1) { external_neighbor = true; + non_ghost = v; } else { sn = s->spins[vn]; + non_ghost = vn; } if (external_flipped || external_neighbor) { @@ -62,6 +64,16 @@ v_t flip_cluster_finite(state_finite_t *s, v_t v0, R_t rot_ind, gsl_rng *r) { s->M[rot_s_old]--; s->M[rot_s_new]++; + for (D_t i = 0; i < s->D; i++) { + L_t x = (non_ghost / (v_t)pow(s->L, s->D - i - 1)) % s->L; + + s->ReF[s->D * i + rot_s_old] -= s->precomputed_cos[i]; + s->ReF[s->D * i + rot_s_new] += s->precomputed_cos[i]; + + s->ImF[s->D * i + rot_s_old] -= s->precomputed_sin[i]; + s->ImF[s->D * i + rot_s_new] += s->precomputed_sin[i]; + } + } else { q_t diff_old = s->bond_with_zero_type[s->transformations[s->q * s->transform_site_to_zero[sn] + s_old]]; q_t diff_new = s->bond_with_zero_type[s->transformations[s->q * s->transform_site_to_zero[sn] + s_new]]; -- cgit v1.2.3-70-g09d2