support for TMatrixInterpolator in TMatrixGenerator

Former-commit-id: ae3849483ca5d45d39ab51f9340d0c3c7a347865
This commit is contained in:
Marek Nečada 2020-02-13 19:05:11 +02:00
parent 54315c61c8
commit 3fed9396a1
2 changed files with 8 additions and 2 deletions

View File

@ -266,7 +266,10 @@ cdef class TMatrixGenerator:
self.holder = what self.holder = what
self.g.function = qpms_tmatrix_generator_constant self.g.function = qpms_tmatrix_generator_constant
self.g.params = <void*>(<CTMatrix?>self.holder).rawpointer() self.g.params = <void*>(<CTMatrix?>self.holder).rawpointer()
# TODO INTERPOLATOR elif isinstance(what, TMatrixInterpolator):
self.holder = what
self.g.function = qpms_tmatrix_generator_interpolator
self.g.params = <void*>(<TMatrixInterpolator?>self.holder).rawpointer()
else: else:
raise TypeError("Can't construct TMatrixGenerator from that") raise TypeError("Can't construct TMatrixGenerator from that")

View File

@ -12,7 +12,7 @@ from .cyquaternions cimport IRot3, CQuat
from .cybspec cimport BaseSpec from .cybspec cimport BaseSpec
from .cycommon cimport make_c_string from .cycommon cimport make_c_string
from .cycommon import string_c2py, PointGroupClass from .cycommon import string_c2py, PointGroupClass
from .cytmatrices cimport CTMatrix, TMatrixFunction, TMatrixGenerator from .cytmatrices cimport CTMatrix, TMatrixFunction, TMatrixGenerator, TMatrixInterpolator
from .cymaterials cimport EpsMuGenerator from .cymaterials cimport EpsMuGenerator
from libc.stdlib cimport malloc, free, calloc from libc.stdlib cimport malloc, free, calloc
import warnings import warnings
@ -271,6 +271,9 @@ cdef class Particle:
raise ValueError("Position argument has to contain 3 or 2 cartesian coordinates") raise ValueError("Position argument has to contain 3 or 2 cartesian coordinates")
if isinstance(t, CTMatrix): if isinstance(t, CTMatrix):
tgen = TMatrixGenerator(t) 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): elif isinstance(t, TMatrixGenerator):
tgen = <TMatrixGenerator>t tgen = <TMatrixGenerator>t
else: raise TypeError('t must be either CTMatrix or TMatrixGenerator, was %s' % str(type(t))) else: raise TypeError('t must be either CTMatrix or TMatrixGenerator, was %s' % str(type(t)))