diff --git a/qpms/scatsystem.c b/qpms/scatsystem.c index abe395a..7185744 100644 --- a/qpms/scatsystem.c +++ b/qpms/scatsystem.c @@ -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); +} diff --git a/qpms/scatsystem.h b/qpms/scatsystem.h index b0f7466..f200bb2 100644 --- a/qpms/scatsystem.h +++ b/qpms/scatsystem.h @@ -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.