18 return t->m + (t->spec->n * rowno);
46 const double rtol,
const double atol);
56 const complex
double *M
67 const complex
double *M
78 const complex
double *M
108 const complex
double *M
152 complex
double **tmdata
192 complex
double ** tmdata
203 complex
double *tmdata,
const size_t tmcount,
216 complex
double *tmdata,
const size_t tmcount,
246 complex
double *f_target,
247 const complex
double *a,
260 complex
double omega,
270 complex
double omega);
278 complex
double omega,
280 const void *tmatrix_orig
319 const gsl_interp_type *iptype
328 complex
double omega,
329 const void *interpolator
346 complex
double *target,
375 complex
double omega,
398 complex
double epsilon_fg,
399 complex
double epsilon_bg
407 complex
double epsilon_fg,
408 complex
double epsilon_bg
463 complex
double omega,
477 complex
double omega,
504 complex
double omega,
511 complex
double omega,
660 typedef *
char qpms_tmatrix_id_t;
667 qpms_tmatrix_id_t id;
676 typedef struct qpms_abstract_particle_t{
677 } qpms_abstract_particle_t;
680 typedef struct qpms_abstract_particle_t {
683 } qpms_abstract_particle_t;
Optical properties of materials.
qpms_normalisation_t
Vector spherical wavefuction normalisation and phase convention codes.
Definition: qpms_types.h:104
int qpms_l_t
Type for spherical harmonic degree l.
Definition: qpms_types.h:27
int qpms_gmi_t
Finite group member index. See also groups.h.
Definition: qpms_types.h:320
qpms_errno_t
Error codes / return values for certain numerical functions.
Definition: qpms_types.h:85
struct qpms_abstract_tmatrix_t qpms_abstract_tmatrix_t
An abstract T-matrix without actual elements, but with info about particle symmetry.
qpms_bessel_t
Bessel function kinds.
Definition: qpms_types.h:176
3D cartesian coordinates. See also vectors.h.
Definition: qpms_types.h:186
An abstract T-matrix without actual elements, but with info about particle symmetry.
Definition: qpms_types.h:415
Parameter structure for qpms_arc_cylinder().
Definition: tmatrices.h:438
double h
Cylinder height.
Definition: tmatrices.h:440
double R
Cylinder radius.
Definition: tmatrices.h:439
Return value type for qpms_arc_function_t.
Definition: tmatrices.h:416
double beta
Angle between surface normal and radial direction.
Definition: tmatrices.h:418
double r
Distance from the origin.
Definition: tmatrices.h:417
Prototype for general parametrisation of -symmetric particle's surface.
Definition: tmatrices.h:422
Prototype for general optical property generator for isotropic materials.
Definition: materials.h:16
A type holding electric permittivity and magnetic permeability of a material.
Definition: qpms_types.h:422
A point group with its irreducible representations and some metadata.
Definition: groups.h:53
3D improper rotations represented as a quaternion and a sign of the determinant.
Definition: qpms_types.h:275
A particle, defined by its T-matrix INDEX and position, to be used in qpms_scatsys_t.
Definition: scatsystem.h:36
An "abstract" T-matrix, contains a T-matrix generator instead of actual data.
Definition: tmatrices.h:526
const qpms_vswf_set_spec_t * spec
VSWF basis specification, NOT owned by qpms_tmatrix_t by default.
Definition: tmatrices.h:534
const qpms_tmatrix_generator_t * gen
A T-matrix generator function.
Definition: tmatrices.h:535
Parameter structure for qpms_tmatrix_generator_axialsym.
Definition: tmatrices.h:494
Parameter structure for qpms_tmatrix_generator_sphere().
Definition: tmatrices.h:367
Generic T-matrix generator function that fills a pre-initialised qpms_tmatrix_t given a frequency.
Definition: tmatrices.h:258
const void * params
Parameter pointer passed to the function.
Definition: tmatrices.h:263
Definition: tmatrices.h:296
gsl_spline ** splines_imag
There will be a spline object for each nonzero element.
Definition: tmatrices.h:300
gsl_spline ** splines_real
There will be a spline object for each nonzero element.
Definition: tmatrices.h:299
Specifies a composed operation of type for qpms_tmatrix_operation_t.
Definition: tmatrices.h:582
size_t opmem_size
Length of the opmem array.
Definition: tmatrices.h:586
struct qpms_tmatrix_operation_t * opmem
(Optional) operations buffer into which elements of ops point. (Owned by this or NULL....
Definition: tmatrices.h:585
size_t n
Number of operations in ops;.
Definition: tmatrices.h:583
_Bool * ops_owned
True for all sub operations owned by this and saved in opmem. NULL if opmem is NULL.
Definition: tmatrices.h:587
const struct qpms_tmatrix_operation_t ** ops
Operations array. (Pointers owned by this.)
Definition: tmatrices.h:584
Specifies a composed operation of type for qpms_tmatrix_operation_t.
Definition: tmatrices.h:569
const struct qpms_tmatrix_operation_t ** ops
Operations array. (Pointers array ops[] always owned by this.)
Definition: tmatrices.h:571
struct qpms_tmatrix_operation_t * opmem
(Optional) operations buffer into which elements of ops point.
Definition: tmatrices.h:578
double factor
Definition: tmatrices.h:572
size_t n
Number of operations in ops;.
Definition: tmatrices.h:570
Specifies a symmetrisation using a set of rotoreflections (with equal weights) for qpms_tmatrix_opera...
Definition: tmatrices.h:602
qpms_irot3_t * ops
Rotoreflection array of size n.
Definition: tmatrices.h:604
bool owns_ops
Whether ops array is owned by this.
Definition: tmatrices.h:605
size_t n
Number of rotoreflections;.
Definition: tmatrices.h:603
General matrix transformation.
Definition: tmatrices.h:558
bool owns_m
Whether m is owned by this;.
Definition: tmatrices.h:563
size_t m_size
Total size of m matrix in terms of sizeof(complex double).
Definition: tmatrices.h:562
complex double * m
Raw matrix data of M in row-major order.
Definition: tmatrices.h:561
Specifies an elementwise complex multiplication of type for qpms_tmatrix_operation_t.
Definition: tmatrices.h:591
size_t m_size
Total size of m matrix in terms of sizeof(complex double).
Definition: tmatrices.h:595
bool owns_m
Whether m is owned by this.
Definition: tmatrices.h:596
complex double * m
Raw matrix data of M in row-major order.
Definition: tmatrices.h:594
A generic T-matrix transformation operator.
Definition: tmatrices.h:609
const qpms_finite_group_t * finite_group
Finite group for QPMS_TMATRIX_OPERATION_FINITE_GROUP_SYMMETRISE.
Definition: tmatrices.h:621
qpms_irot3_t irot3
Single rotoreflection; typ = QPMS_TMATRIX_OPERATION_IROT3.
Definition: tmatrices.h:615
union qpms_tmatrix_operation_t::@0 op
Operation data; actual type is determined by typ.
qpms_tmatrix_operation_kind_t typ
Specifies the operation kind to be performed and which type \op actually contains.
Definition: tmatrices.h:611
A T-matrix.
Definition: qpms_types.h:338
Specifies a finite set of VSWFs.
Definition: qpms_types.h:290
qpms_errno_t qpms_read_scuff_tmatrix(FILE *f, const qpms_vswf_set_spec_t *bspec, size_t *n, double **freqs, double **freqs_su, qpms_tmatrix_t **tmatrices_array, complex double **tmdata)
Loads a scuff-tmatrix generated file.
Definition: tmatrices.c:368
qpms_tmatrix_t * qpms_tmatrix_mv(qpms_tmatrix_t *dest, const qpms_tmatrix_t *orig)
Copies a T-matrix contents between two pre-allocated T-matrices.
Definition: tmatrices.c:1132
qpms_tmatrix_t * qpms_tmatrix_apply_symop_inplace(qpms_tmatrix_t *T, const complex double *M)
Applies a symmetry operation onto a T-matrix, rewriting the original T-matrix data.
Definition: tmatrices.c:71
qpms_tmatrix_t * qpms_tmatrix_symmetrise_finite_group_inplace(qpms_tmatrix_t *T, const qpms_finite_group_t *pointgroup)
In-place application of point group elements on a T-matrix.
Definition: tmatrices.c:170
qpms_tmatrix_t * qpms_tmatrix_apply_operation_replace(qpms_tmatrix_t *dest, const qpms_tmatrix_operation_t *op, const qpms_tmatrix_t *orig)
Apply an operation on a T-matrix and replace another one it with the result.
Definition: tmatrices.c:1140
qpms_arc_function_retval_t qpms_arc_cylinder(double theta, const void *params)
Arc parametrisation of cylindrical particle; for qpms_arc_function_t.
Definition: tmatrices.c:625
qpms_tmatrix_operation_kind_t
Specifies different kinds of operations done on T-matrices.
Definition: tmatrices.h:545
@ QPMS_TMATRIX_OPERATION_FINITE_GROUP_SYMMETRISE
Legacy qpms_finite_group_t with filled rep3d; see qpms_tmatrix_operation_finite_group.
Definition: tmatrices.h:554
@ QPMS_TMATRIX_OPERATION_COMPOSE_CHAIN
Chain several different transformations; see qpms_tmatrix_operation_compose_chain.
Definition: tmatrices.h:551
@ QPMS_TMATRIX_OPERATION_NOOP
Identity operation.
Definition: tmatrices.h:546
@ QPMS_TMATRIX_OPERATION_IROT3ARR
Symmetrise using an array of rotoreflection; see qpms_tmatrix_operation_irot3arr.
Definition: tmatrices.h:549
@ QPMS_TMATRIX_OPERATION_COMPOSE_SUM
Apply several transformations and sum the results, see qpms_tmatrix_operation_compose_sum.
Definition: tmatrices.h:550
@ QPMS_TMATRIX_OPERATION_IROT3
Single rotoreflection specified by a qpms_irot3_t.
Definition: tmatrices.h:548
@ QPMS_TMATRIX_OPERATION_SCMULZ
Elementwise scalar multiplication with a complex matrix; see qpms_tmatrix_operation_scmulz.
Definition: tmatrices.h:552
@ QPMS_TMATRIX_OPERATION_LRMATRIX
General matrix transformation ; see qpms_tmatrix_operation_lrmatrix.
Definition: tmatrices.h:547
qpms_errno_t qpms_tmatrix_interpolator_eval_fill(qpms_tmatrix_t *target, const qpms_tmatrix_interpolator_t *interp, double freq)
Fills an existing T-matrix with new interpolated values.
Definition: tmatrices.c:341
qpms_errno_t qpms_tmatrix_generator_axialsym_RQ_transposed_fill(complex double *target, complex double omega, const qpms_tmatrix_generator_axialsym_param_t *param, qpms_normalisation_t norm, qpms_bessel_t J)
Computes the (reduced) transposed R or Q matrix for axially symmetric particle (useful for debugging)...
Definition: tmatrices.c:958
complex double * qpms_mie_coefficients_reflection(complex double *target, const qpms_vswf_set_spec_t *bspec, double a, complex double k_i, complex double k_e, complex double mu_i, complex double mu_e, qpms_bessel_t J_ext, qpms_bessel_t J_scat)
Calculates the reflection Mie-Lorentz coefficients for a spherical particle.
Definition: tmatrices.c:500
void qpms_tmatrix_operation_copy(qpms_tmatrix_operation_t *target, const qpms_tmatrix_operation_t *src)
(Recursively) copies an qpms_tmatrix_operation_t.
Definition: tmatrices.c:1051
void qpms_tmatrix_free(qpms_tmatrix_t *t)
Destroys a T-matrix.
Definition: tmatrices.c:66
bool qpms_tmatrix_isclose(const qpms_tmatrix_t *T1, const qpms_tmatrix_t *T2, const double rtol, const double atol)
Check T-matrix equality/similarity.
Definition: tmatrices.c:257
qpms_errno_t qpms_tmatrix_axialsym_RQ_transposed_fill(complex double *target, complex double omega, qpms_epsmu_t outside, qpms_epsmu_t inside, qpms_arc_function_t shape, qpms_l_t lMaxQR, qpms_normalisation_t norm, qpms_bessel_t J)
Computes the (reduced) transposed R or Q matrix for axially symmetric particle (useful mostly for deb...
Definition: tmatrices.c:896
qpms_tmatrix_t * qpms_tmatrix_symmetrise_C_inf(const qpms_tmatrix_t *T)
Creates a -symmetrized version of a T-matrix.
Definition: tmatrices.c:217
struct qpms_tmatrix_generator_sphere_param_t qpms_tmatrix_generator_sphere_param_t
Parameter structure for qpms_tmatrix_generator_sphere().
qpms_tmatrix_t * qpms_tmatrix_symmetrise_C_inf_inplace(qpms_tmatrix_t *T)
Creates a -symmetrized version of a T-matrix, rewriting the original one.
Definition: tmatrices.c:222
void qpms_tmatrix_operation_clear(qpms_tmatrix_operation_t *f)
(Recursively) deallocates internal data of qpms_tmatrix_operation_t.
Definition: tmatrices.c:991
qpms_tmatrix_t * qpms_tmatrix_apply_symop(const qpms_tmatrix_t *T, const complex double *M)
Creates a T-matrix from another matrix and a symmetry operation.
Definition: tmatrices.c:93
qpms_errno_t qpms_tmatrix_generator_interpolator(qpms_tmatrix_t *t, complex double omega, const void *interpolator)
qpms_tmatrix_interpolator for qpms_tmatrix_generator_t.
Definition: tmatrices.c:352
static complex double * qpms_tmatrix_row(qpms_tmatrix_t *t, size_t rowno)
Returns a pointer to the beginning of the T-matrix row rowno.
Definition: tmatrices.h:17
qpms_arc_function_retval_t qpms_arc_sphere(double theta, const void *R)
Arc parametrisation of spherical particle; for qpms_arc_function_t.
Definition: tmatrices.c:620
struct qpms_arc_function_retval_t qpms_arc_function_retval_t
Return value type for qpms_arc_function_t.
qpms_tmatrix_t * qpms_tmatrix_copy(const qpms_tmatrix_t *T)
Copies a T-matrix, allocating new array for the T-matrix data.
Definition: tmatrices.c:58
struct qpms_tmatrix_function_t qpms_tmatrix_function_t
An "abstract" T-matrix, contains a T-matrix generator instead of actual data.
qpms_errno_t qpms_tmatrix_axialsym_fill(qpms_tmatrix_t *t, complex double omega, qpms_epsmu_t outside, qpms_epsmu_t inside, qpms_arc_function_t shape, qpms_l_t lMax_extend)
Replaces T-matrix contents with those of a particle with symmetry.
Definition: tmatrices.c:807
bool qpms_load_scuff_tmatrix_crash_on_failure
Tells whether qpms_load_scuff_tmatrix should crash if fopen() fails.
Definition: tmatrices.c:467
qpms_tmatrix_t * qpms_tmatrix_symmetrise_C_N(const qpms_tmatrix_t *T, int N)
Creates a -symmetrized version of a T-matrix.
Definition: tmatrices.c:237
struct qpms_tmatrix_generator_t qpms_tmatrix_generator_t
Generic T-matrix generator function that fills a pre-initialised qpms_tmatrix_t given a frequency.
struct qpms_arc_cylinder_params_t qpms_arc_cylinder_params_t
Parameter structure for qpms_arc_cylinder().
static qpms_tmatrix_t * qpms_tmatrix_axialsym(const qpms_vswf_set_spec_t *bspec, complex double omega, qpms_epsmu_t outside, qpms_epsmu_t inside, qpms_arc_function_t shape, qpms_l_t lMax_extend)
Creates a new T-matrix of a particle with symmetry.
Definition: tmatrices.h:475
qpms_tmatrix_t * qpms_tmatrix_symmetrise_C_N_inplace(qpms_tmatrix_t *T, int N)
Creates a -symmetrized version of a T-matrix, rewriting the original one.
Definition: tmatrices.c:242
qpms_tmatrix_t * qpms_tmatrix_apply_operation(const qpms_tmatrix_operation_t *op, const qpms_tmatrix_t *orig)
Apply an operation on a T-matrix, returning a newly allocated result.
Definition: tmatrices.c:1152
void qpms_tmatrix_operation_compose_chain_init(qpms_tmatrix_operation_t *target, size_t nops, size_t opmem_size)
Inits a new "chain" of composed operations, some of which might be owned.
Definition: tmatrices.c:1107
qpms_errno_t qpms_tmatrix_spherical_fill(qpms_tmatrix_t *t, double a, complex double k_i, complex double k_e, complex double mu_i, complex double mu_e)
Replaces the contents of an existing T-matrix with that of a spherical nanoparticle calculated using ...
Definition: tmatrices.c:564
struct qpms_tmatrix_generator_axialsym_param_t qpms_tmatrix_generator_axialsym_param_t
Parameter structure for qpms_tmatrix_generator_axialsym.
qpms_errno_t qpms_symmetrise_tmdata_finite_group(complex double *tmdata, const size_t tmcount, const qpms_vswf_set_spec_t *bspec, const qpms_finite_group_t *pointgroup)
In-place application of a point group on raw T-matrix data.
Definition: tmatrices.c:149
qpms_tmatrix_t * qpms_tmatrix_symmetrise_involution(const qpms_tmatrix_t *T, const complex double *M)
Symmetrizes a T-matrix with an involution symmetry operation.
Definition: tmatrices.c:193
qpms_errno_t qpms_load_scuff_tmatrix(const char *path, const qpms_vswf_set_spec_t *bspec, size_t *n, double **freqs, double **freqs_su, qpms_tmatrix_t **tmatrices_array, complex double **tmdata)
Reads an open scuff-tmatrix generated file.
Definition: tmatrices.c:469
qpms_tmatrix_interpolator_t * qpms_tmatrix_interpolator_create(size_t n, const double *freqs, const qpms_tmatrix_t *tmatrices_array, const gsl_interp_type *iptype)
Create a T-matrix interpolator from frequency and T-matrix arrays.
Definition: tmatrices.c:273
qpms_errno_t qpms_symmetrise_tmdata_irot3arr(complex double *tmdata, const size_t tmcount, const qpms_vswf_set_spec_t *bspec, size_t n_symops, const qpms_irot3_t *symops)
In-place application of point group elements on raw T-matrix data.
Definition: tmatrices.c:115
qpms_tmatrix_t * qpms_tmatrix_init(const qpms_vswf_set_spec_t *bspec)
Initialises a zero T-matrix.
Definition: tmatrices.c:39
complex double * qpms_apply_tmatrix(complex double *f_target, const complex double *a, const qpms_tmatrix_t *T)
Application of T-matrix on a vector of incident field coefficients, .
Definition: tmatrices.c:608
struct qpms_arc_function_t qpms_arc_function_t
Prototype for general parametrisation of -symmetric particle's surface.
qpms_tmatrix_t * qpms_tmatrix_interpolator_eval(const qpms_tmatrix_interpolator_t *interp, double freq)
Evaluate a T-matrix interpolated value.
Definition: tmatrices.c:335
qpms_tmatrix_t * qpms_tmatrix_init_from_generator(const qpms_vswf_set_spec_t *bspec, qpms_tmatrix_generator_t gen, complex double omega)
Initialises and evaluates a new T-matrix using a generator.
Definition: tmatrices.c:49
qpms_errno_t qpms_tmatrix_generator_axialsym(qpms_tmatrix_t *t, complex double omega, const void *params)
qpms_tmatrix_axialsym for qpms_tmatrix_generator_t
Definition: tmatrices.c:970
qpms_errno_t qpms_tmatrix_spherical_mu0_fill(qpms_tmatrix_t *t, double a, double omega, complex double epsilon_fg, complex double epsilon_bg)
Convenience function to calculate T-matrix of a non-magnetic spherical particle using the permittivit...
static qpms_tmatrix_t * qpms_tmatrix_spherical(const qpms_vswf_set_spec_t *bspec, double a, complex double k_i, complex double k_e, complex double mu_i, complex double mu_e)
Creates a new T-matrix of a spherical particle using the Lorentz-Mie theory.
Definition: tmatrices.h:380
qpms_tmatrix_t * qpms_tmatrix_symmetrise_irot3arr_inplace(qpms_tmatrix_t *T, size_t n_symops, const qpms_irot3_t *symops)
In-place application of point group elements on a T-matrix.
Definition: tmatrices.c:159
qpms_tmatrix_t * qpms_tmatrix_apply_operation_inplace(const qpms_tmatrix_operation_t *op, qpms_tmatrix_t *orig)
Apply an operation on a T-matrix and replace it with the result.
Definition: tmatrices.c:1191
void qpms_tmatrix_interpolator_free(qpms_tmatrix_interpolator_t *interp)
Free a T-matrix interpolator.
Definition: tmatrices.c:322
struct qpms_tmatrix_operation_t qpms_tmatrix_operation_t
A generic T-matrix transformation operator.
static qpms_tmatrix_t * qpms_tmatrix_spherical_mu0(const qpms_vswf_set_spec_t *bspec, double a, double omega, complex double epsilon_fg, complex double epsilon_bg)
Convenience function to calculate T-matrix of a non-magnetic spherical particle using the permittivit...
Definition: tmatrices.h:403
qpms_errno_t qpms_tmatrix_generator_constant(qpms_tmatrix_t *t, complex double omega, const void *tmatrix_orig)
Implementation of qpms_matrix_generator_t that just copies a constant matrix.
Definition: tmatrices.c:980
static qpms_tmatrix_t * qpms_tmatrix_init_from_function(qpms_tmatrix_function_t f, complex double omega)
Convenience function to create a new T-matrix from qpms_tmatrix_function_t.
Definition: tmatrices.h:540
qpms_errno_t qpms_tmatrix_generator_sphere(qpms_tmatrix_t *t, complex double omega, const void *params)
T-matrix generator for spherical particles using Lorentz-Mie solution.
Definition: tmatrices.c:580
qpms_tmatrix_t * qpms_tmatrix_symmetrise_involution_inplace(qpms_tmatrix_t *T, const complex double *M)
Symmetrizes a T-matrix with an involution symmetry operation, rewriting the original one.
Definition: tmatrices.c:180