Shifted lattices now consistent, TODO check overall shift sign and fix LR declarations

Former-commit-id: ff8a3a0b93447566a605bc7fe6ddbfe34dec3cd2
This commit is contained in:
Marek Nečada 2018-09-14 21:10:10 +00:00
parent 182dfa84ca
commit 169c091806
4 changed files with 90 additions and 9 deletions

View File

@ -156,7 +156,7 @@ int ewald32_sigma_long_shiftedpoints (
const qpms_ewald32_constants_t *c, const qpms_ewald32_constants_t *c,
const double eta, const double k, const double unitcell_area, const double eta, const double k, const double unitcell_area,
const size_t npoints, const point2d *Kpoints_plus_beta, const size_t npoints, const point2d *Kpoints_plus_beta,
//const point2d beta, // not needed const point2d beta, // not needed
const point2d particle_shift // target - src const point2d particle_shift // target - src
) )
{ {
@ -181,10 +181,11 @@ int ewald32_sigma_long_shiftedpoints (
// CHOOSE POINT BEGIN // CHOOSE POINT BEGIN
for (size_t i = 0; i < npoints; ++i) { // BEGIN POINT LOOP for (size_t i = 0; i < npoints; ++i) { // BEGIN POINT LOOP
point2d beta_pq = Kpoints_plus_beta[i]; point2d beta_pq = Kpoints_plus_beta[i];
point2d K_pq = {beta_pq.x - beta.x, beta_pq.y - beta.y};
double rbeta_pq = cart2norm(beta_pq); double rbeta_pq = cart2norm(beta_pq);
// CHOOSE POINT END // CHOOSE POINT END
complex double phasefac = cexp(I*cart2_dot(beta_pq,particle_shift)); // POINT-DEPENDENT (PFC) // !!!CHECKSIGN!!! complex double phasefac = cexp(I*cart2_dot(K_pq,particle_shift)); // POINT-DEPENDENT (PFC) // !!!CHECKSIGN!!!
double arg_pq = atan2(beta_pq.y, beta_pq.x); // POINT-DEPENDENT double arg_pq = atan2(beta_pq.y, beta_pq.x); // POINT-DEPENDENT
// R-DEPENDENT BEGIN // R-DEPENDENT BEGIN

View File

@ -103,7 +103,7 @@ int ewald32_sigma_long_shiftedpoints (
const qpms_ewald32_constants_t *c, const qpms_ewald32_constants_t *c,
double eta, double k, double unitcell_area, double eta, double k, double unitcell_area,
size_t npoints, const point2d *Kpoints_plus_beta, size_t npoints, const point2d *Kpoints_plus_beta,
//point2d beta, point2d beta,
point2d particle_shift point2d particle_shift
); );
int ewald32_sigma_long_points_and_shift (//NI int ewald32_sigma_long_points_and_shift (//NI

View File

@ -79,6 +79,11 @@ ewaldtest_triang_params paramslist[] = {
{ 2, {1.1, 1}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL}, { 2, {1.1, 1}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 1}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL}, { 2, {1.1, 1}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 1}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL}, { 2, {1.1, 1}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {0, 3.1}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {0, 3.1}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {0, 3.1}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {0, 3.1}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL},
// end: // end:
@ -194,7 +199,7 @@ ewaldtest_triang_results *ewaldtest_triang(const ewaldtest_triang_params p) {
if (0!=ewald32_sigma_long_shiftedpoints(results->sigmas_long, if (0!=ewald32_sigma_long_shiftedpoints(results->sigmas_long,
results->err_sigmas_long, c, p.eta, p.k, A, results->err_sigmas_long, c, p.eta, p.k, A,
nK, Kpoints_plus_beta->base, nK, Kpoints_plus_beta->base,
//p.beta, p.beta,
particle_shift)) particle_shift))
abort(); abort();
if (0!=ewald32_sigma_short_shiftedpoints( if (0!=ewald32_sigma_short_shiftedpoints(

View File

@ -38,16 +38,90 @@ typedef struct ewaldtest_triang_results {
ewaldtest_triang_params paramslist[] = { ewaldtest_triang_params paramslist[] = {
// lMax, beta, k, a, eta, maxR, maxK, csphase, orientation // lMax, beta, shift, k, a, eta, maxR, maxK, csphase, orientation
/*
{ 2, {2.7, 1}, {0.5,0.1325}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL}, { 2, {2.7, 1}, {0.5,0.1325}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {2.7, 1}, {0.5,0.1325}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL}, { 2, {2.7, 1}, {0.5,0.1325}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {2.7, 1}, {0.5,0.1325}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL}, { 2, {2.7, 1}, {0.5,0.1325}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {2.7, 1}, {0.5,0.1325}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL}, { 2, {2.7, 1}, {0.5,0.1325}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 1}, {0.5,0.1325}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL}, { 2, {1.1, 1}, {0.5,0.1325}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 1}, {0.5,0.1325}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL}, { 2, {1.1, 1}, {0.5,0.1325}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 1}, {0.5,0.1325}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL}, { 2, {1.1, 1}, {0.5,0.1325}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 1}, {0.5,0.1325}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL}, { 2, {1.1, 1}, {0.5,0.1325}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 1}, {0.5,0.}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 1}, {0.5,0.}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 1}, {0.5,0.}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 1}, {0.5,0.}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL},
*/
{ 2, {1.1, 1}, {0.5,0.1325}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 1}, {0.5,0.1325}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 1}, {0.5,0.1325}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 1}, {0.5,0.1325}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 2.1}, {0.5,0.1325}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 2.1}, {0.5,0.1325}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 2.1}, {0.5,0.1325}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1, 2.1}, {0.5,0.1325}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL},
/*
{ 2, {0, 3.1}, {0.5,0}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {0, 3.1}, {0.5,0}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {0, 3.1}, {0.5,0}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {0, 3.1}, {0.5,0}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {0, 1.1}, {0.5,0}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {0, 1.1}, {0.5,0}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {0, 1.1}, {0.5,0}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {0, 1.1}, {0.5,0}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {3.1,0}, {0,0.5}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {3.1,0}, {0,0.5}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {3.1,0}, {0,0.5}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {3.1,0}, {0,0.5}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1,0}, {0,0.5}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1,0}, {0,0.5}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1,0}, {0,0.5}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1,0}, {0,0.5}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {3.1,0}, {0,0.5}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {3.1,0}, {0,0.5}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {3.1,0}, {0,0.5}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {3.1,0}, {0,0.5}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL},
*/
{ 2, {3.1*0.5,-3.1*0.8}, {0.8,0.5}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {3.1*0.5,-3.1*0.8}, {0.8,0.5}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {3.1*0.5,-3.1*0.8}, {0.8,0.5}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {3.1*0.5,-3.1*0.8}, {0.8,0.5}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1*0.5,-1.1*0.8}, {0.8,0.5}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1*0.5,-1.1*0.8}, {0.8,0.5}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1*0.5,-1.1*0.8}, {0.8,0.5}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1*0.5,-1.1*0.8}, {0.8,0.5}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL},
// Poloviční posun oproti přodchozímu
{ 2, {3.1*0.5,-3.1*0.8}, {0.4,0.25}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {3.1*0.5,-3.1*0.8}, {0.4,0.25}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {3.1*0.5,-3.1*0.8}, {0.4,0.25}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {3.1*0.5,-3.1*0.8}, {0.4,0.25}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1*0.5,-1.1*0.8}, {0.4,0.25}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1*0.5,-1.1*0.8}, {0.4,0.25}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1*0.5,-1.1*0.8}, {0.4,0.25}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {1.1*0.5,-1.1*0.8}, {0.4,0.25}, 2.3, 0.97, 3.5, 20, 160, 1., TRIANGULAR_VERTICAL},
/*
{ 2, {0, 3.1}, {0,0.5}, 2.3, 0.97, 0.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {0, 3.1}, {0,0.5}, 2.3, 0.97, 1.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {0, 3.1}, {0,0.5}, 2.3, 0.97, 2.5, 20, 160, 1., TRIANGULAR_VERTICAL},
{ 2, {0, 3.1}, {0,0.5}, 2.3, 0.97, 3.5, 20, 160, 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}
@ -142,10 +216,11 @@ ewaldtest_triang_results *ewaldtest_triang(const ewaldtest_triang_params p) {
nK = Klg->ps.r_offsets[Klg->ps.nrs]; nK = Klg->ps.r_offsets[Klg->ps.nrs];
point2d particle_shift = p.particle_shift; point2d particle_shift = p.particle_shift;
point2d minus_ps = {-particle_shift.x, -particle_shift.y};
point2d Rpoints_plus_shift[nR]; point2d Rpoints_plus_shift[nR];
for(size_t i = 0; i < nR; ++i){ for(size_t i = 0; i < nR; ++i){
Rpoints_plus_shift[i].x = Rpoints[i].x + p.particle_shift.x; Rpoints_plus_shift[i].x = Rpoints[i].x - particle_shift.x;
Rpoints_plus_shift[i].y = Rpoints[i].y + p.particle_shift.y; Rpoints_plus_shift[i].y = Rpoints[i].y - particle_shift.y;
} }
qpms_y_t nelem_sc = qpms_lMax2nelem_sc(p.lMax); qpms_y_t nelem_sc = qpms_lMax2nelem_sc(p.lMax);
@ -170,8 +245,8 @@ ewaldtest_triang_results *ewaldtest_triang(const ewaldtest_triang_params p) {
if (0!=ewald32_sigma_long_shiftedpoints(results->sigmas_long, if (0!=ewald32_sigma_long_shiftedpoints(results->sigmas_long,
results->err_sigmas_long, c, p.eta, p.k, A, results->err_sigmas_long, c, p.eta, p.k, A,
nK, Kpoints_plus_beta->base, nK, Kpoints_plus_beta->base,
//p.beta, p.beta,
particle_shift)) particle_shift /*minus_ps*/ ))
abort(); abort();
if (0!=ewald32_sigma_short_shiftedpoints( if (0!=ewald32_sigma_short_shiftedpoints(
results->sigmas_short, results->err_sigmas_short, c, results->sigmas_short, results->err_sigmas_short, c,