summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2018-02-08 14:57:47 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2018-02-08 14:57:47 -0500
commit76e9388a35c7d556407f85e471b57ea4d3e432c6 (patch)
treecefe8c06e6e81dfb4d505aa269a4a43d638cbf0e
parent304fb3c8897371fee65c2a35793af5e383a473aa (diff)
downloadc++-76e9388a35c7d556407f85e471b57ea4d3e432c6.tar.gz
c++-76e9388a35c7d556407f85e471b57ea4d3e432c6.tar.bz2
c++-76e9388a35c7d556407f85e471b57ea4d3e432c6.zip
fixed zero magnetization counting problem
-rw-r--r--src/wolff.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/wolff.c b/src/wolff.c
index 2bd9c7d..60861b2 100644
--- a/src/wolff.c
+++ b/src/wolff.c
@@ -158,7 +158,7 @@ int main(int argc, char *argv[]) {
}
update_meas(E, s->E);
- q_t max_M_i = 0;
+ int max_M_i = -1;
double max_M = 0;
for (q_t i = 0; i < q; i++) {
@@ -168,10 +168,12 @@ int main(int argc, char *argv[]) {
}
}
- for (q_t i = 0; i < q; i++) {
- update_meas(sM[max_M_i][i], s->M[i]);
+ if (max_M_i != -1) {
+ for (q_t i = 0; i < q; i++) {
+ update_meas(sM[max_M_i][i], s->M[i]);
+ }
+ update_meas(sE[max_M_i], s->E);
}
- update_meas(sE[max_M_i], s->E);
diff = fabs(sM[0][0]->dc / sM[0][0]->c);