2d empty lattice modes pxd; fix a corner case.

Former-commit-id: aa33c85a6a0d2107caef752900690f471cc6350f
This commit is contained in:
Marek Nečada 2019-09-13 13:18:23 +03:00
parent 0f03509dde
commit e910de936e
2 changed files with 6 additions and 1 deletions

View File

@ -941,7 +941,7 @@ void qpms_emptylattice2_modes_nearest(double target[2],
double *freqlist;
size_t n = qpms_emptylattice2_modes_maxfreq(&freqlist,
b1, b2, rtol, k, c, omega);
target[0] = freqlist[n-2];
target[0] = (n > 1) ? freqlist[n-2] : NAN;
target[1] = freqlist[n-1];
free(freqlist);
}

View File

@ -211,6 +211,11 @@ cdef extern from "lattices.h":
double maxR, bint inc_maxR, PGen_1D_incrementDirection incdir)
int qpms_reduce_lattice_basis(double *b, size_t bsize, size_t ndim, double delta)
size_t qpms_emptylattice2_modes_maxfreq(double **target_freqs, cart2_t b1_rec, cart2_t b2_rec,
double rtol, cart2_t k, double wave_speed, double maxomega)
size_t qpms_emptylattice2_modes_nearest(double *target_freqs, cart2_t b1_rec, cart2_t b2_rec,
double rtol, cart2_t k, double wave_speed, double omega)
cdef extern from "quaternions.h":
qpms_quat_t qpms_quat_2c_from_4d(qpms_quat4d_t q)