From c902f022795157b28ef01cffcc499753e2212c28 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Thu, 22 Jun 2017 23:36:35 -0400 Subject: added correct support for negative external fields --- src/wolff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/wolff.c b/src/wolff.c index a8266ff..1176fde 100644 --- a/src/wolff.c +++ b/src/wolff.c @@ -84,8 +84,8 @@ int main(int argc, char *argv[]) { s->g = graph_add_ext(h); s->spins = (bool *)calloc(h->nv + 1, sizeof(bool)); - s->M = h->nv; - s->H = -(1.0 * h->ne) - H * h->nv; + s->M = sign(H) * h->nv; + s->H = -(1.0 * h->ne) - sign (H) * H * h->nv; double *bond_probs = (double *)malloc(2 * sizeof(double)); bond_probs[0] = 1 - exp(-2 / T); -- cgit v1.2.3-70-g09d2