summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2017-05-30 12:09:18 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2017-05-30 12:09:18 -0400
commit3089143613a89f680c9c8b2dcbd774b4145c4eeb (patch)
tree0886ce05a5d0307b9b67ba664b80887eb1abd0e4 /src
parent89f005fb81c5d150bb128dab67b5669e90160463 (diff)
downloadc++-3089143613a89f680c9c8b2dcbd774b4145c4eeb.tar.gz
c++-3089143613a89f680c9c8b2dcbd774b4145c4eeb.tar.bz2
c++-3089143613a89f680c9c8b2dcbd774b4145c4eeb.zip
fixed computation of the magnetization for nonzero field, values will be nonsense if H=0 right now
Diffstat (limited to 'src')
-rw-r--r--src/wolff.c15
1 files changed, 11 insertions, 4 deletions
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.);