Fix T-matrix duplicity remapping

Former-commit-id: de1be4e08dabce7ccb404f5f8dfd288c6bac1741
This commit is contained in:
Marek Nečada 2019-03-10 15:14:50 +00:00
parent 20af81440f
commit f30c5a88d9
2 changed files with 8 additions and 4 deletions

View File

@ -27,4 +27,6 @@ void qpms_pr_debug_at_flf(const char *filename, unsigned int linenum,
#define QPMS_ENSURE_SUCCESS(x) {if(x) QPMS_WTF;} #define QPMS_ENSURE_SUCCESS(x) {if(x) QPMS_WTF;}
#define QPMS_ENSURE(x, msg, ...) {if(!(x)) qpms_pr_error_at_flf(__FILE__,__LINE__,__func__,msg, ##__VA_ARGS__); }
#endif #endif

View File

@ -467,16 +467,18 @@ qpms_scatsys_t *qpms_scatsys_apply_symmetry(const qpms_scatsys_t *orig, const qp
break; break;
} }
if (j == ss->tm_count) { // duplicity not found, copy the t-matrix if (j == ss->tm_count) { // duplicity not found, copy the t-matrix
ss->tm[i] = qpms_tmatrix_copy(orig->tm[i]); ss->tm[j] = qpms_tmatrix_copy(orig->tm[i]);
ss->max_bspecn = MAX(ss->tm[j]->spec->n, ss->max_bspecn);
lMax = MAX(lMax, ss->tm[j]->spec->lMax);
++(ss->tm_count); ++(ss->tm_count);
} }
tm_dupl_remap[i] = j; tm_dupl_remap[i] = j;
ss->max_bspecn = MAX(ss->tm[i]->spec->n, ss->max_bspecn);
if (normalisation == QPMS_NORMALISATION_UNDEF) if (normalisation == QPMS_NORMALISATION_UNDEF)
normalisation = ss->tm[i]->spec->norm; normalisation = ss->tm[i]->spec->norm;
// We expect all bspec norms to be the same. // We expect all bspec norms to be the same.
else assert(normalisation == ss->tm[i]->spec->norm); else QPMS_ENSURE(normalisation == ss->tm[j]->spec->norm,
lMax = MAX(lMax, ss->tm[i]->spec->lMax); "Normalisation convention must be the same for all T-matrices."
" %d != %d\n", normalisation, ss->tm[j]->spec->norm);
} }
// Copy particles, remapping the t-matrix indices // Copy particles, remapping the t-matrix indices