Fix signs in the lattice sum Delta (recurrent formula)

Former-commit-id: 9cb3df31e5a8b6395252454a0b85f6ce3459a781
This commit is contained in:
Marek Nečada 2020-05-26 20:25:04 +03:00
parent 93cde82a9a
commit c056099d5a
1 changed files with 2 additions and 2 deletions

View File

@ -304,12 +304,12 @@ void ewald3_2_sigma_long_Delta(qpms_csf_result *target, int maxn, complex double
target[0].err = NAN; //TODO target[0].err = NAN; //TODO
} }
if (maxn >= 1) { 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 target[1].err = NAN; //TODO
} }
for(int n = 1; n < maxn; ++n) { // The rest via recurrence 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 // 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 target[n+1].err = NAN; //TODO
} }
} }