summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2017-10-19 11:53:24 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2017-10-19 11:53:24 -0400
commit020266dc3745afc4f9d21a15b40e3a83adbd92ff (patch)
tree349a5739f30e94903c1dadc5ba0a96e44f51538b
parent8ffc043664a2debabd8b9682b034c0bc01c6b19e (diff)
downloadc++-020266dc3745afc4f9d21a15b40e3a83adbd92ff.tar.gz
c++-020266dc3745afc4f9d21a15b40e3a83adbd92ff.tar.bz2
c++-020266dc3745afc4f9d21a15b40e3a83adbd92ff.zip
fixed a mistake in the way wolff cluster tries were counted
-rw-r--r--lib/wolff.h1
-rw-r--r--lib/wolff_tools.c5
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/wolff.h b/lib/wolff.h
index 84b3d22..6b9cceb 100644
--- a/lib/wolff.h
+++ b/lib/wolff.h
@@ -33,6 +33,7 @@ typedef struct {
typedef struct {
uint32_t nv;
+ uint32_t nt;
int32_t dJb;
int32_t dHb;
bool hit_ghost;
diff --git a/lib/wolff_tools.c b/lib/wolff_tools.c
index bab0908..629da4e 100644
--- a/lib/wolff_tools.c
+++ b/lib/wolff_tools.c
@@ -113,6 +113,7 @@ cluster_t *flip_cluster(const graph_t *g, const double *ps, bool *x, bool stop_o
if (x[vn] ==
x0) { // if the neighboring site matches the flipping cluster...
(*bond_counter)++;
+ c->nt++;
if (gsl_rng_uniform(r) < prob) { // and with probability ps[e]...
if (is_ext && stop_on_ghost) {
@@ -192,7 +193,7 @@ uint32_t wolff_step(double T, double H, ising_state_t *s, sim_t sim, gsl_rng *r,
cluster_t *c = flip_cluster(s->g, ps, s->spins, false, r);
s->M += - sign(H) * 2 * c->dHb;
s->H += 2 * (c->dJb + sign (H) * H * c->dHb);
- n_flips = c->nv;
+ n_flips = c->nt;
free(c);
}
@@ -213,7 +214,7 @@ uint32_t wolff_step(double T, double H, ising_state_t *s, sim_t sim, gsl_rng *r,
s->H += 2 * (c->dJb + sign (H) * H * c->dHb);
}
- n_flips = c->nv;
+ n_flips = c->nt;
free(c);
}