From 9ebe4053e3c48d3755ea63bc43be18fff0e4d936 Mon Sep 17 00:00:00 2001
From: Pauli Virtanen <pauli.t.virtanen@jyu.fi>
Date: Wed, 14 Sep 2022 13:01:12 +0300
Subject: [PATCH] core: fix prefactors of i in S_H

---
 examples/bulk_j_an.py | 8 +++-----
 src/action.hpp        | 2 +-
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/examples/bulk_j_an.py b/examples/bulk_j_an.py
index 8c46fac..37882cf 100644
--- a/examples/bulk_j_an.py
+++ b/examples/bulk_j_an.py
@@ -86,17 +86,15 @@ def j_anom(T, h, n=5, alpha_soc=0.01, perturbative=False):
         J[:, :, UP] /= dd[0]
         J[:, :, RIGHT] /= dd[1]
         J[:, :, DOWN] /= dd[0]
-        Jtot += pi * aa * J
+        Jtot += 1j * pi * aa * J
 
         # Analytic
         gp = (ww - 1j * h) / np.sqrt((ww - 1j * h) ** 2 + 1)
         gm = (ww + 1j * h) / np.sqrt((ww + 1j * h) ** 2 + 1)
         fp = 1 / np.sqrt((ww - 1j * h) ** 2 + 1)
         fm = 1 / np.sqrt((ww + 1j * h) ** 2 + 1)
-        # XXX: check the 32*eta
-        Jy_an = (
-            (gp - gm) * (1 + gp * gm + fp * fm) * (-1j * alpha_soc**3) * (32 * eta)
-        )
+        # XXX: check the 8*eta
+        Jy_an = (gp - gm) * (1 + gp * gm + fp * fm) * (-1j * alpha_soc**3) * (8 * eta)
         Jantot += pi * aa * Jy_an
 
     return Jtot, Jantot
diff --git a/src/action.hpp b/src/action.hpp
index 252c1dc..2531af0 100644
--- a/src/action.hpp
+++ b/src/action.hpp
@@ -251,7 +251,7 @@ inline Scalar S_H(const array::ArrayView<const Mask, Shape0>& mask,
         }
     }
 
-    return (2.0*eta/(dd[0]*dd[1])) * S;
+    return (2.0*eta/(Complex(0,4.0)*dd[0]*dd[1])) * S;
 }
 
 /* Function that has the same value as the AD variable,
-- 
GitLab