From c056099d5a17a5944a9cbfa46b74cc7582f033e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Tue, 26 May 2020 20:25:04 +0300 Subject: [PATCH] Fix signs in the lattice sum Delta (recurrent formula) Former-commit-id: 9cb3df31e5a8b6395252454a0b85f6ce3459a781 --- qpms/ewaldsf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qpms/ewaldsf.c b/qpms/ewaldsf.c index 69bce2e..2edfcb2 100644 --- a/qpms/ewaldsf.c +++ b/qpms/ewaldsf.c @@ -304,12 +304,12 @@ void ewald3_2_sigma_long_Delta(qpms_csf_result *target, int maxn, complex double target[0].err = NAN; //TODO } if (maxn >= 1) { - target[1].val = -I / z * M_SQRTPI * expfac * (w_minus - w_plus); + target[1].val = I / z * M_SQRTPI * expfac * (w_minus - w_plus); target[1].err = NAN; //TODO } for(int n = 1; n < maxn; ++n) { // The rest via recurrence // TODO The cpow(x, 0.5 - n) might perhaps better be replaced with a recurrently computed variant - target[n+1].val = (4 / (z*z)) * ((0.5 - n) * target[n].val + target[n-1].val - cpow(x, 0.5 - n) * expfac); + target[n+1].val = -(4 / (z*z)) * (-(0.5 - n) * target[n].val + target[n-1].val - cpow(x, 0.5 - n) * expfac); target[n+1].err = NAN; //TODO } }