Sigma0 ready, it's time for writing some tests.
Former-commit-id: 956254dcd4c337374d945465ff228fc40595fc3e
This commit is contained in:
parent
03ab9755a5
commit
16ce3a6ba8
17
qpms/ewald.c
17
qpms/ewald.c
|
@ -28,6 +28,7 @@
|
|||
#endif
|
||||
|
||||
|
||||
|
||||
// sloppy implementation of factorial
|
||||
static inline double factorial(const int n) {
|
||||
assert(n >= 0);
|
||||
|
@ -133,6 +134,22 @@ void qpms_ewald32_constants_free(qpms_ewald32_constants_t *c) {
|
|||
|
||||
|
||||
|
||||
int ewald32_sigma0(complex double *result, double *err,
|
||||
const qpms_ewald32_constants_t *c,
|
||||
const double eta, const double k)
|
||||
{
|
||||
qpms_csf_result gam;
|
||||
int retval = complex_gamma_inc_e(-0.5, -k/sq(2*eta), &gam);
|
||||
if (0 != retval)
|
||||
abort();
|
||||
*result = gam.val * c->legendre0[gsl_sf_legendre_array_index(0,0)] / 2 / M_SQRTPI;
|
||||
if(err)
|
||||
*err = gam.err * c->legendre0[gsl_sf_legendre_array_index(0,0)] / 2 / M_SQRTPI;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ewald32_sigma_long_shiftedpoints (
|
||||
complex double *target, // must be c->nelem long
|
||||
double *err,
|
||||
|
|
|
@ -78,6 +78,12 @@ int ewald32_sr_integral(double r, double k, double n, double eta, double *result
|
|||
|
||||
#include "lattices.h"
|
||||
|
||||
|
||||
int ewald32_sigma0(complex double *result, double *err,
|
||||
const qpms_ewald32_constants_t *c,
|
||||
double eta, double k
|
||||
);
|
||||
|
||||
// TODO make "compressed versions" where the (m+n)-odd terms (which are zero)
|
||||
// are not included.
|
||||
|
||||
|
@ -114,6 +120,7 @@ int ewald32_sigma_short_shiftedpoints(
|
|||
const qpms_ewald32_constants_t *c, // N.B. not too useful here
|
||||
double eta, double k,
|
||||
size_t npoints, const point2d *Rpoints_plus_particle_shift,
|
||||
point2d beta,
|
||||
point2d particle_shift // used only in the very end to multiply it by the phase
|
||||
);
|
||||
int ewald32_sigma_short_points_and_shift(//NI
|
||||
|
|
Loading…
Reference in New Issue