Deterministic ordering of irreps in generated C structures

Former-commit-id: 052e894a00d56492af3a8481a355cfff7f84cfa5
This commit is contained in:
Marek Nečada 2019-03-13 23:13:41 +02:00
parent 51d38798c3
commit 7ef8e764c7
2 changed files with 4 additions and 2 deletions

View File

@ -1230,7 +1230,8 @@ cdef class FinitePointGroup:
self.G[0].irreps = <qpms_finite_group_irrep_t *>calloc(self.G[0].nirreps, sizeof(qpms_finite_group_irrep_t)) self.G[0].irreps = <qpms_finite_group_irrep_t *>calloc(self.G[0].nirreps, sizeof(qpms_finite_group_irrep_t))
if not self.G[0].irreps: raise MemoryError if not self.G[0].irreps: raise MemoryError
cdef int dim cdef int dim
for iri, (irname, irrep) in enumerate(info.irreps.items()): for iri, irname in enumerate(sorted(info.irreps.keys())):
irrep = info.irreps[irname]
is1d = isinstance(irrep[identity], (int, float, complex)) is1d = isinstance(irrep[identity], (int, float, complex))
dim = 1 if is1d else irrep[identity].shape[0] dim = 1 if is1d else irrep[identity].shape[0]
self.G[0].irreps[iri].dim = dim self.G[0].irreps[iri].dim = dim

View File

@ -145,7 +145,8 @@ class SVWFPointGroupInfo: # only for point groups, coz in svwf_rep() I use I_tyt
s += ' %d, // nirreps\n' % len(self.irreps) s += ' %d, // nirreps\n' % len(self.irreps)
# struct qpms_finite_grep_irrep_t irreps[] # struct qpms_finite_grep_irrep_t irreps[]
s += ' (struct qpms_finite_group_irrep_t[]) { // irreps\n' s += ' (struct qpms_finite_group_irrep_t[]) { // irreps\n'
for irname, irrep in self.irreps.items(): for irname in sorted(self.irreps.keys()):
irrep = self.irreps[irname]
s += ' {\n' s += ' {\n'
is1d = isinstance(irrep[identity], (int, float, complex)) is1d = isinstance(irrep[identity], (int, float, complex))
dim = 1 if is1d else irrep[identity].shape[0] dim = 1 if is1d else irrep[identity].shape[0]