ScatteringSystem constructor and destructor now run without crashing.
Former-commit-id: ada6d5862be9226a467a7dafe2b9f197d3b67f69
This commit is contained in:
parent
f785c7de29
commit
97843e2a3a
|
@ -1260,6 +1260,10 @@ cdef class Particle:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return <uintptr_t> &(self.p)
|
return <uintptr_t> &(self.p)
|
||||||
|
|
||||||
|
cdef qpms_particle_t cval(Particle self):
|
||||||
|
'''Provides a copy for assigning in cython code'''
|
||||||
|
return self.p
|
||||||
|
|
||||||
property x:
|
property x:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return self.p.pos.x
|
return self.p.pos.x
|
||||||
|
@ -1306,6 +1310,7 @@ cdef class ScatteringSystem:
|
||||||
cdef qpms_ss_tmi_t tm_count = 0
|
cdef qpms_ss_tmi_t tm_count = 0
|
||||||
tmindices = dict()
|
tmindices = dict()
|
||||||
tmobjs = list()
|
tmobjs = list()
|
||||||
|
self.basespecs=list()
|
||||||
for p in particles: # find and enumerate unique t-matrices
|
for p in particles: # find and enumerate unique t-matrices
|
||||||
if id(p.t) not in tmindices:
|
if id(p.t) not in tmindices:
|
||||||
tmindices[id(p.t)] = tm_count
|
tmindices[id(p.t)] = tm_count
|
||||||
|
@ -1323,7 +1328,7 @@ cdef class ScatteringSystem:
|
||||||
for tmi in range(tm_count):
|
for tmi in range(tm_count):
|
||||||
orig.tm[tmi] = (<CTMatrix?>(tmobjs[tmi])).rawpointer()
|
orig.tm[tmi] = (<CTMatrix?>(tmobjs[tmi])).rawpointer()
|
||||||
for pi in range(p_count):
|
for pi in range(p_count):
|
||||||
orig.p[pi].pos = particles[pi].p.pos
|
orig.p[pi].pos = (<Particle?>(particles[pi])).cval().pos
|
||||||
orig.p[pi].tmatrix_id = tmindices[id(particles[pi].t)]
|
orig.p[pi].tmatrix_id = tmindices[id(particles[pi].t)]
|
||||||
self.s = qpms_scatsys_apply_symmetry(&orig, sym.rawpointer())
|
self.s = qpms_scatsys_apply_symmetry(&orig, sym.rawpointer())
|
||||||
finally:
|
finally:
|
||||||
|
|
|
@ -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)
|
for (opj = 0; opj < ot_current.size; ++opj)
|
||||||
if (current_orbit[opj] == pj) break; // HIT, pj already on current orbit
|
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
|
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.size;
|
||||||
ot_current.tmatrices[opj] = ss->p[pj].tmatrix_id;
|
ot_current.tmatrices[opj] = ss->p[pj].tmatrix_id;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue