diff --git a/qpms/qpms_c.pyx b/qpms/qpms_c.pyx index e64d3d3..5183941 100644 --- a/qpms/qpms_c.pyx +++ b/qpms/qpms_c.pyx @@ -1260,6 +1260,10 @@ cdef class Particle: def __get__(self): return &(self.p) + cdef qpms_particle_t cval(Particle self): + '''Provides a copy for assigning in cython code''' + return self.p + property x: def __get__(self): return self.p.pos.x @@ -1306,6 +1310,7 @@ cdef class ScatteringSystem: cdef qpms_ss_tmi_t tm_count = 0 tmindices = dict() tmobjs = list() + self.basespecs=list() for p in particles: # find and enumerate unique t-matrices if id(p.t) not in tmindices: tmindices[id(p.t)] = tm_count @@ -1323,7 +1328,7 @@ cdef class ScatteringSystem: for tmi in range(tm_count): orig.tm[tmi] = ((tmobjs[tmi])).rawpointer() for pi in range(p_count): - orig.p[pi].pos = particles[pi].p.pos + orig.p[pi].pos = ((particles[pi])).cval().pos orig.p[pi].tmatrix_id = tmindices[id(particles[pi].t)] self.s = qpms_scatsys_apply_symmetry(&orig, sym.rawpointer()) finally: diff --git a/qpms/scatsystem.c b/qpms/scatsystem.c index 05eb614..c917cd6 100644 --- a/qpms/scatsystem.c +++ b/qpms/scatsystem.c @@ -433,6 +433,7 @@ qpms_scatsys_t *qpms_scatsys_apply_symmetry(const qpms_scatsys_t *orig, const qp for (opj = 0; opj < ot_current.size; ++opj) if (current_orbit[opj] == pj) break; // HIT, pj already on current orbit if (opj == ot_current.size) { // MISS, pj is new on the orbit, extend the size and set the T-matrix id + current_orbit[opj] = pj; ++ot_current.size; ot_current.tmatrices[opj] = ss->p[pj].tmatrix_id; }