Fix test ewalds.c for beta > k

Former-commit-id: 123391c39678970764aee603dc619d9d54ebc709
This commit is contained in:
Marek Nečada 2018-09-12 21:08:16 +03:00
parent 3d83d174bd
commit 0ea6aa8413
1 changed files with 26 additions and 20 deletions

View File

@ -61,6 +61,8 @@ ewaldtest_triang_params paramslist[] = {
{ 2, {1.1, 0}, 2.3, 0.97, 0.5, 10, 10, 1., TRIANGULAR_VERTICAL}, { 2, {1.1, 0}, 2.3, 0.97, 0.5, 10, 10, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 0}, 2.3, 0.97, 0.5, 5, 5, 1., TRIANGULAR_VERTICAL}, { 2, {1.1, 0}, 2.3, 0.97, 0.5, 5, 5, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 0}, 2.3, 0.97, 0.5, 2, 2, 1., TRIANGULAR_VERTICAL}, { 2, {1.1, 0}, 2.3, 0.97, 0.5, 2, 2, 1., TRIANGULAR_VERTICAL},
{ 2, {0.3, 0}, 2.3, 0.97, 0.5, 2, 2, 1., TRIANGULAR_VERTICAL},
{ 2, {2.7, 0}, 2.3, 0.97, 0.5, 2, 2, 1., TRIANGULAR_VERTICAL},
// end: // end:
// { 0, {0, 0}, 0, 0, 0, 0, 0, 0, 0} // { 0, {0, 0}, 0, 0, 0, 0, 0, 0, 0}
@ -103,6 +105,7 @@ int main() {
printf("sigma0: %.16g%+.16gj\n", creal(r->sigma0), cimag(r->sigma0)); printf("sigma0: %.16g%+.16gj\n", creal(r->sigma0), cimag(r->sigma0));
for (qpms_l_t n = 0; n <= p.lMax; ++n) { for (qpms_l_t n = 0; n <= p.lMax; ++n) {
for (qpms_m_t m = -n; m <= n; ++m){ for (qpms_m_t m = -n; m <= n; ++m){
if ((m+n)%2) continue;
qpms_y_t y = qpms_mn2y_sc(m,n); qpms_y_t y = qpms_mn2y_sc(m,n);
qpms_y_t y_conj = qpms_mn2y_sc(-m,n); qpms_y_t y_conj = qpms_mn2y_sc(-m,n);
// y n m sigma_total (err), regsigmas_416 regsigmas_415_recon // y n m sigma_total (err), regsigmas_416 regsigmas_415_recon
@ -195,26 +198,29 @@ ewaldtest_triang_results *ewaldtest_triang(const ewaldtest_triang_params p) {
double legendres[gsl_sf_legendre_array_n(p.lMax)]; double legendres[gsl_sf_legendre_array_n(p.lMax)];
points2d_rordered_t sel = points2d_rordered_t sel =
points2d_rordered_annulus(Kpoints_plus_beta, 0, true, p.k, false); points2d_rordered_annulus(Kpoints_plus_beta, 0, true, p.k, false);
point2d *beta_pq_lessthan_k = sel.base + sel.r_offsets[0]; if (0 != sel.nrs)
size_t beta_pq_lessthan_k_count = sel.r_offsets[sel.nrs] - sel.r_offsets[0]; {
for(size_t i = 0; i < beta_pq_lessthan_k_count; ++i) { point2d *beta_pq_lessthan_k = sel.base + sel.r_offsets[0];
point2d beta_pq = beta_pq_lessthan_k[i]; size_t beta_pq_lessthan_k_count = sel.r_offsets[sel.nrs] - sel.r_offsets[0];
double rbeta_pq = cart2norm(beta_pq); for(size_t i = 0; i < beta_pq_lessthan_k_count; ++i) {
double arg_pq = atan2(beta_pq.y, beta_pq.x); point2d beta_pq = beta_pq_lessthan_k[i];
double denom = sqrt(p.k*p.k - rbeta_pq*rbeta_pq); double rbeta_pq = cart2norm(beta_pq);
if( gsl_sf_legendre_array_e(GSL_SF_LEGENDRE_NONE, double arg_pq = atan2(beta_pq.y, beta_pq.x);
p.lMax, denom/p.k, p.csphase, legendres) != 0) double denom = sqrt(p.k*p.k - rbeta_pq*rbeta_pq);
abort(); if( gsl_sf_legendre_array_e(GSL_SF_LEGENDRE_NONE,
for (qpms_y_t y = 0; y < nelem_sc; ++y) { p.lMax, denom/p.k, p.csphase, legendres) != 0)
qpms_l_t n; qpms_m_t m; abort();
qpms_y2mn_sc_p(y, &m, &n); for (qpms_y_t y = 0; y < nelem_sc; ++y) {
if ((m+n)%2 != 0) qpms_l_t n; qpms_m_t m;
continue; qpms_y2mn_sc_p(y, &m, &n);
complex double eimf = cexp(I*m*arg_pq); if ((m+n)%2 != 0)
results->regsigmas_416[y] += continue;
4*M_PI*ipow(n)/p.k/A complex double eimf = cexp(I*m*arg_pq);
* eimf * legendres[gsl_sf_legendre_array_index(n,abs(m))] * min1pow_m_neg(m) results->regsigmas_416[y] +=
/ denom; 4*M_PI*ipow(n)/p.k/A
* eimf * legendres[gsl_sf_legendre_array_index(n,abs(m))] * min1pow_m_neg(m)
/ denom;
}
} }
} }
} }