Fix infinite loop in empty lattice modes generation

Former-commit-id: 1349035090712935a0d77d64c175e4358fb4d487
This commit is contained in:
Marek Nečada 2019-09-13 16:20:39 +03:00
parent b45bdcd49a
commit ecbf5b10d4
1 changed files with 6 additions and 1 deletions

View File

@ -909,8 +909,13 @@ size_t qpms_emptylattice2_modes_maxfreq(double **target_freqs,
size_t generated = 0; size_t generated = 0;
PGenReturnDataBulk rd; PGenReturnDataBulk rd;
while((rd = PGen_fetch_cart2(&Kgen, capacity - generated, Kpoints + generated)).flags & PGEN_NOTDONE) while((rd = PGen_fetch_cart2(&Kgen, capacity - generated, Kpoints + generated)).flags & PGEN_NOTDONE) {
generated += rd.generated; generated += rd.generated;
if (capacity <= generated) {
PGen_destroy(&Kgen);
break;
}
}
double *thefreqs; double *thefreqs;
QPMS_CRASHING_MALLOC(thefreqs, generated * sizeof(double)); QPMS_CRASHING_MALLOC(thefreqs, generated * sizeof(double));