summaryrefslogtreecommitdiff
path: root/lib/cluster_finite.c
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2018-07-24 13:12:35 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2018-07-24 13:12:35 -0400
commitc48fd16fe1554c88c79a1f0d50e81c803da8f61f (patch)
tree2b8a07de4e0fc795854fc4c1ac0ff095783218fa /lib/cluster_finite.c
parent8d96c4d30214a2c27561740b7b3f7e1e3b0bbfe4 (diff)
downloadc++-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_finite.c')
-rw-r--r--lib/cluster_finite.c14
1 files changed, 13 insertions, 1 deletions
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]];