diff --git a/qpms/cytmatrices.pyx b/qpms/cytmatrices.pyx index 940cd9e..f370dfe 100644 --- a/qpms/cytmatrices.pyx +++ b/qpms/cytmatrices.pyx @@ -266,7 +266,10 @@ cdef class TMatrixGenerator: self.holder = what self.g.function = qpms_tmatrix_generator_constant self.g.params = (self.holder).rawpointer() - # TODO INTERPOLATOR + elif isinstance(what, TMatrixInterpolator): + self.holder = what + self.g.function = qpms_tmatrix_generator_interpolator + self.g.params = (self.holder).rawpointer() else: raise TypeError("Can't construct TMatrixGenerator from that") diff --git a/qpms/qpms_c.pyx b/qpms/qpms_c.pyx index af16a8d..f99095f 100644 --- a/qpms/qpms_c.pyx +++ b/qpms/qpms_c.pyx @@ -12,7 +12,7 @@ from .cyquaternions cimport IRot3, CQuat from .cybspec cimport BaseSpec from .cycommon cimport make_c_string from .cycommon import string_c2py, PointGroupClass -from .cytmatrices cimport CTMatrix, TMatrixFunction, TMatrixGenerator +from .cytmatrices cimport CTMatrix, TMatrixFunction, TMatrixGenerator, TMatrixInterpolator from .cymaterials cimport EpsMuGenerator from libc.stdlib cimport malloc, free, calloc import warnings @@ -271,6 +271,9 @@ cdef class Particle: raise ValueError("Position argument has to contain 3 or 2 cartesian coordinates") if isinstance(t, CTMatrix): tgen = TMatrixGenerator(t) + elif isinstance(t, TMatrixInterpolator): + tgen = TMatrixGenerator(t) + warnings.warn("Initialising a particle with interpolated T-matrix values. Imaginary frequencies will be discarded and mode search algorithm will yield nonsense (just saying).") elif isinstance(t, TMatrixGenerator): tgen = t else: raise TypeError('t must be either CTMatrix or TMatrixGenerator, was %s' % str(type(t)))