Scat system destructor and more metadata.

Former-commit-id: 68e2075e0ddaf8110c44d1f8d5761c33afc0e814
This commit is contained in:
Marek Nečada 2019-02-27 14:01:21 +02:00
parent c51e7b5851
commit c63ba502ac
2 changed files with 23 additions and 1 deletions

View File

@ -373,9 +373,25 @@ qpms_scatsys_t *qpms_scatsys_apply_symmetry(const qpms_scatsys_t *orig, const qp
ss->p = realloc(ss->p, sizeof(qpms_particle_tid_t) * ss->p_count); ss->p_capacity = ss->p_count;
ss->sym = sym;
// Set ss->fecv_size and ss->fecv_pstarts
ss->fecv_size = 0;
ss->fecv_pstarts = malloc(ss->p_count * sizeof(size_t));
for (qpms_ss_pi_t pi = 0; pi < ss->p_count; ++pi) {
ss->fecv_pstarts[pi] = ss->fecv_size;
ss->fecv_size += ss->tm[ss->p[pi].tmatrix_id]->spec->n; // That's a lot of dereferencing!
}
return ss;
}
void qpms_scatsys_free(qpms_scatsys_t *ss) {
free(ss->tm);
free(ss->p);
free(ss->fecv_pstarts);
free(ss->tm_sym_map);
free(ss->p_sym_map);
free(ss);
}

View File

@ -212,6 +212,12 @@ typedef struct qpms_scatsys_t {
qpms_ss_pi_t *p_sym_map; ///< Which particles map onto which by the symmetry ops.
///< p_sym_map[idi + pi * sym->order] gives the index of pi-th particle under the idi'th sym op.
qpms_ss_tmi_t *tm_sym_map; ///< Which t-matrices map onto which by the symmetry ops. Lookup by tm_sum_map[idi + tmi * sym->order].
size_t fecv_size; ///< Number of elements of a full excitation coefficient vector size.
//size_t *saecv_sizes; ///< NI. Number of elements of symmetry-adjusted coefficient vector sizes (order as in sym->irreps).
size_t *fecv_pstarts; ///< Indices of where pi'th particle's excitation coeffs start in a full excitation coefficient vector.
//size_t **saecv_pstarts; ///< NI. Indices of where pi'th particle's excitation coeff start in a symmetry-adjusted e.c.v.
///**< First index is irrep index as in sym->irreps, second index is particle index. */
// TODO shifted origin of the symmetry group etc.
// TODO some indices for fast operations here.