From 3089143613a89f680c9c8b2dcbd774b4145c4eeb Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Tue, 30 May 2017 12:09:18 -0400 Subject: fixed computation of the magnetization for nonzero field, values will be nonsense if H=0 right now --- src/wolff.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/wolff.c b/src/wolff.c index 9e08d90..22e6857 100644 --- a/src/wolff.c +++ b/src/wolff.c @@ -82,13 +82,20 @@ int main(int argc, char *argv[]) { n_clust++; } + int32_t MM; + if (s->spins[h->nv]) { + MM = s->M; + } else { + MM = -s->M; + } + E1 = E1 * (n_runs / (n_runs + 1.)) + s->H * 1. / (n_runs + 1.); - M1 = M1 * (n_runs / (n_runs + 1.)) + abs(s->M) * 1. / (n_runs + 1.); + M1 = M1 * (n_runs / (n_runs + 1.)) + MM * 1. / (n_runs + 1.); E2 = E2 * (n_runs / (n_runs + 1.)) + pow(s->H, 2) * 1. / (n_runs + 1.); - M2 = M2 * (n_runs / (n_runs + 1.)) + pow(s->M, 2) * 1. / (n_runs + 1.); + M2 = M2 * (n_runs / (n_runs + 1.)) + pow(MM, 2) * 1. / (n_runs + 1.); - Mmu2 = Mmu2 * (n_runs / (n_runs + 1.)) + pow(abs(s->M) - M1, 2) * 1. / (n_runs + 1.); - Mmu4 = Mmu4 * (n_runs / (n_runs + 1.)) + pow(abs(s->M) - M1, 4) * 1. / (n_runs + 1.); + Mmu2 = Mmu2 * (n_runs / (n_runs + 1.)) + pow(MM - M1, 2) * 1. / (n_runs + 1.); + Mmu4 = Mmu4 * (n_runs / (n_runs + 1.)) + pow(MM - M1, 4) * 1. / (n_runs + 1.); Emu2 = Emu2 * (n_runs / (n_runs + 1.)) + pow(s->H - E1, 2) * 1. / (n_runs + 1.); Emu4 = Emu4 * (n_runs / (n_runs + 1.)) + pow(s->H - E1, 4) * 1. / (n_runs + 1.); -- cgit v1.2.3-70-g09d2