QPMS
Electromagnetic multiple scattering library and toolkit.
scatsystem.h
Go to the documentation of this file.
1 
11 #ifndef QPMS_SCATSYSTEM_H
12 #define QPMS_SCATSYSTEM_H
13 #include "qpms_types.h"
14 #include "vswf.h"
15 #include "tmatrices.h"
16 #include <stdbool.h>
17 
19 
20 void qpms_scatsystem_set_nthreads(long n);
21 
23 
25 typedef struct qpms_particle_t {
26  // Does it make sense to ever use other than cartesian coords for this?
31 
32 struct qpms_finite_group_t;
34 
36 typedef struct qpms_particle_tid_t {
37  // Does it make sense to ever use other than cartesian coords for this?
41 
42 
45 
47 
68 typedef struct qpms_ss_orbit_type_t {
70  size_t bspecn;
72 
81 
89 
96  size_t *irbase_sizes;
97  //The following are pretty redundant, TODO reduce them at some point.
99  size_t *irbase_cumsizes;
101  size_t *irbase_offsets;
103 
110  complex double *irbases;
116 
117 
118 typedef ptrdiff_t qpms_ss_osn_t;
119 
123 #define QPMS_SS_P_ORBITINFO_UNDEF (-1)
127 
133 
136 
138 
140 
142 
144 
149 
151 
156  double eta;
158 
159 
160 struct qpms_trans_calculator;
162 
164 
169 typedef struct qpms_scatsys_t {
173 
175 
181 
186 
190 
191  //TODO the index types do not need to be so big.
192  const struct qpms_finite_group_t *sym;
196 
197  qpms_ss_oti_t orbit_type_count;
199 
201 
202  size_t fecv_size;
203  size_t *saecv_sizes;
204 
205  size_t *fecv_pstarts;
208  //size_t **saecv_pstarts; ///< NI. Indices of where pi'th particle's excitation coeff start in a symmetry-adjusted e.c.v.
210 
211  // TODO shifted origin of the symmetry group etc.
212  // TODO some indices for fast operations here.
213  // private
214  size_t max_bspecn;
215 
218 
219  // We keep the p_orbitinfo arrays in this chunk in order to avoid memory fragmentation
220  char *otspace;
221  char *otspace_end;
222  double lenscale; // radius of the array, used as a relative tolerance measure
223  struct qpms_trans_calculator *c;
224 
228 
231  return ss->tmg[ss->tm[tmi].tmgi].spec;
232 }
233 
236  return ss->tmg[ss->tm[ss->p[pi].tmatrix_id].tmgi].spec;
237 }
238 
239 typedef struct qpms_scatsys_at_omega_t {
242 
246  complex double omega;
248  complex double wavenumber;
250 
251 
253 
294  complex double omega, const struct qpms_tolerance_spec_t *tol);
295 
298 
300 
302 
304 
306  complex double omega);
307 
309 
313 complex double *qpms_scatsys_irrep_transform_matrix(complex double *target_U,
314  const qpms_scatsys_t *ss, qpms_iri_t iri);
315 
317 
318 complex double *qpms_scatsys_irrep_pack_matrix_stupid(complex double *target_packed,
319  const complex double *orig_full, const qpms_scatsys_t *ss,
320  qpms_iri_t iri);
321 
323 
324 complex double *qpms_scatsys_irrep_unpack_matrix_stupid(complex double *target_full,
325  const complex double *orig_packed, const qpms_scatsys_t *ss,
326  qpms_iri_t iri, bool add);
327 
329 
330 complex double *qpms_scatsys_irrep_pack_matrix(complex double *target_packed,
331  const complex double *orig_full, const qpms_scatsys_t *ss,
332  qpms_iri_t iri);
333 
335 
336 complex double *qpms_scatsys_irrep_unpack_matrix(complex double *target_full,
337  const complex double *orig_packed, const qpms_scatsys_t *ss,
338  qpms_iri_t iri, bool add);
339 
341 
342 complex double *qpms_scatsys_irrep_pack_vector(complex double *target_packed,
343  const complex double *orig_full, const qpms_scatsys_t *ss,
344  qpms_iri_t iri);
345 
347 
348 complex double *qpms_scatsys_irrep_unpack_vector(complex double *target_full,
349  const complex double *orig_packed, const qpms_scatsys_t *ss,
350  qpms_iri_t iri, bool add);
351 
353 
359  complex double *target,
360  const qpms_scatsys_t *ss,
361  complex double k
362  );
363 
365 
370  complex double *target,
371  const qpms_scatsys_at_omega_t *ssw
372  );
373 
375 
379  complex double *target,
380  const qpms_scatsys_t *ss,
381  complex double k,
382  qpms_bessel_t J
383  );
384 
386 
392  complex double *target,
393  const qpms_scatsys_t *ss,
394  qpms_iri_t iri,
395  complex double k,
396  qpms_bessel_t J
397  );
398 
400 
405  complex double *target,
406  const qpms_scatsys_at_omega_t *ssw,
407  qpms_iri_t iri
408  );
410 
415  complex double *target,
416  const qpms_scatsys_at_omega_t *ssw,
417  qpms_iri_t iri
418  );
420 
425  complex double *target,
426  const qpms_scatsys_at_omega_t *ssw,
427  qpms_iri_t iri
428  );
429 
430 struct qpms_scatsys_at_omega_k_t; // Defined below.
432 typedef struct qpms_ss_LU {
433  const qpms_scatsys_at_omega_t *ssw;
435  bool full;
438  complex double *a;
440  int *ipiv;
442 void qpms_ss_LU_free(qpms_ss_LU);
443 
446  complex double *target,
447  int *target_piv,
448  const qpms_scatsys_at_omega_t *ssw
449  );
450 
453  complex double *target,
454  int *target_piv,
455  const qpms_scatsys_at_omega_t *ssw,
456  qpms_iri_t iri
457  );
458 
461  complex double *modeproblem_matrix_full,
462  int *target_piv,
463  const qpms_scatsys_at_omega_t *ssw,
464  const struct qpms_scatsys_at_omega_k_t *sswk
465  );
466 
469  complex double *modeproblem_matrix_irrep_packed,
470  int *target_piv,
471  const qpms_scatsys_at_omega_t *ssw,
472  qpms_iri_t iri
473  );
474 
476 complex double *qpms_scatsys_scatter_solve(
477  complex double *target_f,
478  const complex double *a_inc,
479  qpms_ss_LU ludata
480  );
481 
482 // ======================= Periodic system -only related stuff =============================
483 
485 
489  const qpms_scatsys_at_omega_t *ssw;
490  double k[3];
491  double eta;
493 
495 
500  complex double *target,
501  const qpms_scatsys_at_omega_k_t *sswk
502  );
503 
507  complex double *target,
508  const qpms_scatsys_t *ss,
509  complex double wavenumber,
510  const cart3_t *wavevector,
511  double eta
512  );
513 
517  complex double *target,
518  const qpms_scatsys_at_omega_k_t *sswk
519  );
520 
521 
524  complex double *target,
525  int *target_piv,
526  const qpms_scatsys_at_omega_k_t *sswk
527  );
528 
530 
539  const qpms_scatsys_t *ss,
541  const double k[3],
542  complex double omega_centre,
543  double omega_rr,
544  double omega_ri,
545  size_t contour_npoints,
546  double rank_tol,
547  size_t rank_sel_min,
548  double res_tol
549  );
550 
551 // ======================= Periodic system -only related stuff end =========================
552 
553 
556 
559 
560 struct qpms_finite_group_t;
561 
563 
564 complex double *qpms_orbit_action_matrix(
566 
569  complex double *target,
571  const qpms_ss_orbit_type_t *orbit,
574  const qpms_vswf_set_spec_t *bspec,
576  const struct qpms_finite_group_t *sym,
578  const qpms_gmi_t g);
579 
581 
584 
587  complex double *target,
589  const qpms_ss_orbit_type_t *orbit,
592  const qpms_vswf_set_spec_t *bspec,
594  const struct qpms_finite_group_t *sym,
596  const qpms_iri_t iri);
597 
599 complex double *qpms_orbit_irrep_basis(
601  size_t *basis_size,
603 
606  complex double *target,
608  const qpms_ss_orbit_type_t *orbit,
611  const qpms_vswf_set_spec_t *bspec,
613  const struct qpms_finite_group_t *sym,
615  const qpms_iri_t iri);
616 
617 
619 
623 
624  complex double *target_full,
625  const qpms_scatsys_t *ss,
626  qpms_incfield_t field_at_point,
627  const void *args,
628  bool add
629  );
630 
632 complex double *qpms_scatsysw_apply_Tmatrices_full(
633  complex double *target_full,
634  const complex double *inc_full,
635  const qpms_scatsys_at_omega_t *ssw
636  );
637 
638 struct beyn_result_t; // See beyn.h for full definition
639 
641 
650  const qpms_scatsys_t *ss,
652  qpms_iri_t iri,
653  complex double omega_centre,
654  double omega_rr,
655  double omega_ri,
656  size_t contour_npoints,
657  double rank_tol,
658  size_t rank_sel_min,
659  double res_tol
660  );
661 
662 #if 0
664 
672 struct beyn_result_t *qpms_scatsys_find_eigenmodes(
673  const qpms_scatsys_t *ss,
674  double eta,
675  const double *beta_,
676  complex double omega_centre,
677  double omega_rr,
678  double omega_ri,
679  size_t contour_npoints,
680  double rank_tol,
681  size_t rank_sel_min,
682  double res_tol
683  );
684 #endif
685 
686 
687 #if 0
689 
690 complex double *qpms_scatsys_incident_field_vector_irrep_packed(
692 
693  complex double *target_full,
694  const qpms_scatsys_t *ss,
695  const qpms_iri_t iri,
696  qpms_incfield_t field_at_point,
697  const void *args,
698  bool add
699  );
700 #endif
701 
703 
716  const qpms_scatsys_t *ss,
717  qpms_bessel_t typ,
718  complex double wavenumber,
719  const complex double *scatcoeff_full,
720  cart3_t evalpoint
721  );
722 
724 
735  const qpms_scatsys_at_omega_t *ssw,
736  qpms_bessel_t typ,
737  const complex double *scatcoeff_full,
738  cart3_t evalpoint
739  );
740 
742 
751  const qpms_scatsys_t *ss,
752  qpms_bessel_t typ,
753  complex double wavenumber,
754  const complex double *scatcoeff_full,
755  cart3_t evalpoint
756  );
757 
759 
768  const qpms_scatsys_at_omega_t *ssw,
769  qpms_bessel_t typ,
770  const complex double *scatcoeff_full,
771  cart3_t evalpoint
772  );
773 
774 
776 
787  const qpms_scatsys_at_omega_k_t *sswk,
788  qpms_bessel_t typ,
789  const complex double *scatcoeff_full,
790  cart3_t evalpoint
791  );
792 
794 
799  ccart3_t *target,
800  const qpms_scatsys_at_omega_k_t *sswk,
801  qpms_bessel_t typ,
802  cart3_t evalpoint
803  );
804 
805 
807 // TODO DOC
808 double qpms_ss_adjusted_eta(const qpms_scatsys_t *ss, complex double wavenumber, const double wavevector[3]);
809 
810 #if 0
816 ccart3_t qpms_scatsys_scattered_E_irrep(const qpms_scatsys_t *ss,
817  qpms_iri_t iri,
818  const complex double *coeff_vector,
819  cart3_t where,
820  complex double k
821  );
822 #endif
823 
824 #endif //QPMS_SCATSYSTEM_H
Common qpms types.
int32_t qpms_ss_pi_t
Particle index used in qpms_scatsys_t and related structures.
Definition: qpms_types.h:316
int32_t qpms_ss_tmi_t
T-matrix index used in qpms_scatsys_t and related structures.
Definition: qpms_types.h:310
int32_t qpms_ss_tmgi_t
T-matrix generator index used in qpms_scatsys_t and related structures.
Definition: qpms_types.h:313
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
int qpms_iri_t
Irreducible representation index. See also groups.h.
Definition: qpms_types.h:323
qpms_bessel_t
Bessel function kinds.
Definition: qpms_types.h:176
complex double * qpms_scatsysw_build_modeproblem_matrix_irrep_packed(complex double *target, const qpms_scatsys_at_omega_t *ssw, qpms_iri_t iri)
Creates the mode problem matrix directly in the irrep-packed form.
Definition: scatsystem.c:1924
struct qpms_scatsys_at_omega_k_t qpms_scatsys_at_omega_k_t
Scattering system at a given frequency and k-vector. Used only with periodic systems.
complex double * qpms_scatsys_build_translation_matrix_e_full(complex double *target, const qpms_scatsys_t *ss, complex double k, qpms_bessel_t J)
As qpms_scatsys_build_translation_full() but with choice of Bessel function type.
Definition: scatsystem.c:1180
struct qpms_ss_orbit_type_t qpms_ss_orbit_type_t
Structure describing a particle's "orbit type" under symmetry group actions in a system.
qpms_scatsys_at_omega_t * qpms_scatsys_at_omega(const qpms_scatsys_t *ss, complex double omega)
Evaluates scattering system T-matrices at a given frequency.
Definition: scatsystem.c:606
complex double * qpms_scatsys_irrep_unpack_matrix_stupid(complex double *target_full, const complex double *orig_packed, const qpms_scatsys_t *ss, qpms_iri_t iri, bool add)
Transforms a big "packed" matrix into the full basis (slow reference implementation).
Definition: scatsystem.c:875
qpms_errno_t qpms_scatsys_dump(qpms_scatsys_t *ss, char *path)
NOT IMPLEMENTED Dumps a qpms_scatsys_t structure to a file.
complex double * qpms_scatsyswk_build_translation_matrix_full(complex double *target, const qpms_scatsys_at_omega_k_t *sswk)
Global translation matrix.
Definition: scatsystem.c:1166
struct qpms_ss_LU qpms_ss_LU
LU factorisation (LAPACKE_zgetrf) result holder.
qpms_ss_LU qpms_scatsysw_modeproblem_matrix_irrep_packed_factorise(complex double *modeproblem_matrix_irrep_packed, int *target_piv, const qpms_scatsys_at_omega_t *ssw, qpms_iri_t iri)
Computes LU factorisation of a pre-calculated irrep-packed mode/scattering problem matrix,...
Definition: scatsystem.c:2281
struct qpms_ss_derived_tmatrix_t qpms_ss_derived_tmatrix_t
Auxillary type used in qpms_scatsys_t: A recepy to create another T-matrices by symmetry operations.
struct qpms_scatsys_t qpms_scatsys_t
Common "class" for system of scatterers, both periodic and non-periodic.
double qpms_ss_adjusted_eta(const qpms_scatsys_t *ss, complex double wavenumber, const double wavevector[3])
Adjusted Ewadl parameter to avoid high-frequency breakdown.
Definition: scatsystem.c:68
complex double * qpms_scatsys_build_translation_matrix_full(complex double *target, const qpms_scatsys_t *ss, complex double k)
Global translation matrix.
Definition: scatsystem.c:1155
complex double * qpms_scatsys_periodic_build_translation_matrix_full(complex double *target, const qpms_scatsys_t *ss, complex double wavenumber, const cart3_t *wavevector, double eta)
Global translation matrix.
Definition: scatsystem.c:1252
complex double * qpms_scatsysw_build_modeproblem_matrix_irrep_packed_serial(complex double *target, const qpms_scatsys_at_omega_t *ssw, qpms_iri_t iri)
Alternative (serial reference) implementation of qpms_scatsysw_build_modeproblem_matrix_irrep_packed(...
Definition: scatsystem.c:1366
complex double * qpms_orbit_irrep_projector_matrix(complex double *target, const qpms_ss_orbit_type_t *orbit, const qpms_vswf_set_spec_t *bspec, const struct qpms_finite_group_t *sym, const qpms_iri_t iri)
Constructs a dense matrix representation of a irrep projector for an orbit type.
struct qpms_ss_particle_orbitinfo qpms_ss_particle_orbitinfo_t
Auxillary type used in qpms_scatsys_t that identifies the particle's orbit and its id inside that orb...
complex double * qpms_scatsysw_build_modeproblem_matrix_irrep_packed_orbitorderR(complex double *target, const qpms_scatsys_at_omega_t *ssw, qpms_iri_t iri)
Alternative implementation of qpms_scatsysw_build_modeproblem_matrix_irrep_packed().
Definition: scatsystem.c:1478
static const qpms_vswf_set_spec_t * qpms_ss_bspec_pi(const qpms_scatsys_t *ss, qpms_ss_pi_t pi)
Retrieve the bspec of pi'th particle in ss->p.
Definition: scatsystem.h:235
qpms_ss_LU qpms_scatsysw_build_modeproblem_matrix_irrep_packed_LU(complex double *target, int *target_piv, const qpms_scatsys_at_omega_t *ssw, qpms_iri_t iri)
Builds an irrep-packed LU-factorised mode/scattering problem matrix from scratch.
Definition: scatsystem.c:2313
qpms_ss_LU qpms_scatsysw_modeproblem_matrix_full_factorise(complex double *modeproblem_matrix_full, int *target_piv, const qpms_scatsys_at_omega_t *ssw, const struct qpms_scatsys_at_omega_k_t *sswk)
Computes LU factorisation of a pre-calculated mode/scattering problem matrix, replacing its contents.
complex double * qpms_scatsys_irrep_unpack_vector(complex double *target_full, const complex double *orig_packed, const qpms_scatsys_t *ss, qpms_iri_t iri, bool add)
Transforms a big "packed" vector into the full basis.
Definition: scatsystem.c:1116
void qpms_scatsys_free(qpms_scatsys_t *s)
Destroys the result of qpms_scatsys_apply_symmetry or qpms_scatsys_load.
Definition: scatsystem.c:566
complex double * qpms_scatsys_incident_field_vector_full(complex double *target_full, const qpms_scatsys_t *ss, qpms_incfield_t field_at_point, const void *args, bool add)
Creates an incident field vector in the full basis, given a function that evaluates the field expansi...
Definition: scatsystem.c:1975
complex double * qpms_scatsys_irrep_pack_vector(complex double *target_packed, const complex double *orig_full, const qpms_scatsys_t *ss, qpms_iri_t iri)
Projects a "big" vector onto an irrep.
Definition: scatsystem.c:1077
ccart3_t qpms_scatsys_scattered_E(const qpms_scatsys_t *ss, qpms_bessel_t typ, complex double wavenumber, const complex double *scatcoeff_full, cart3_t evalpoint)
Evaluates scattered electric field at a point, given a full vector of scattered field coefficients.
Definition: scatsystem.c:2018
complex double * qpms_scatsys_irrep_pack_matrix(complex double *target_packed, const complex double *orig_full, const qpms_scatsys_t *ss, qpms_iri_t iri)
Projects a "big" matrix onto an irrep.
Definition: scatsystem.c:912
complex double * qpms_scatsys_irrep_transform_matrix(complex double *target_U, const qpms_scatsys_t *ss, qpms_iri_t iri)
Creates a "full" transformation matrix U that takes a full vector and projects it onto an symmetry ad...
Definition: scatsystem.c:802
qpms_gmi_t qpms_ss_orbit_pi_t
Auxilliary type used in qpms_ss_orbit_type_t for labeling particles inside orbits.
Definition: scatsystem.h:43
ccart3_t qpms_scatsysw_scattered_E__alt(const qpms_scatsys_at_omega_t *ssw, qpms_bessel_t typ, const complex double *scatcoeff_full, cart3_t evalpoint)
Evaluates scattered electric field at a point, given a full vector of scattered field coefficients.
Definition: scatsystem.c:2122
ptrdiff_t qpms_ss_osn_t
"serial number" of av orbit in a given type.
Definition: scatsystem.h:118
ccart3_t qpms_scatsyswk_scattered_E(const qpms_scatsys_at_omega_k_t *sswk, qpms_bessel_t typ, const complex double *scatcoeff_full, cart3_t evalpoint)
Evaluates scattered electric field at a point, given a full vector of scattered field coefficients....
Definition: scatsystem.c:2130
ccart3_t qpms_scatsysw_scattered_E(const qpms_scatsys_at_omega_t *ssw, qpms_bessel_t typ, const complex double *scatcoeff_full, cart3_t evalpoint)
Evaluates scattered electric field at a point, given a full vector of scattered field coefficients.
Definition: scatsystem.c:2044
complex double * qpms_scatsysw_apply_Tmatrices_full(complex double *target_full, const complex double *inc_full, const qpms_scatsys_at_omega_t *ssw)
Applies T-matrices onto an incident field vector in the full basis.
Definition: scatsystem.c:2001
qpms_scatsys_at_omega_t * qpms_scatsys_apply_symmetry(const qpms_scatsys_t *orig, const struct qpms_finite_group_t *sym, complex double omega, const struct qpms_tolerance_spec_t *tol)
Creates a new scatsys by applying a symmetry group onto a "proto-scatsys", copying particles if neede...
struct qpms_particle_tid_t qpms_particle_tid_t
A particle, defined by its T-matrix INDEX and position, to be used in qpms_scatsys_t.
ccart3_t qpms_scatsys_scattered_E__alt(const qpms_scatsys_t *ss, qpms_bessel_t typ, complex double wavenumber, const complex double *scatcoeff_full, cart3_t evalpoint)
Evaluates scattered electric field at a point, given a full vector of scattered field coefficients.
Definition: scatsystem.c:2083
qpms_ss_tmi_t qpms_ss_oti_t
Auxilliary type used for labeling orbit types.
Definition: scatsystem.h:44
complex double * qpms_scatsys_irrep_pack_matrix_stupid(complex double *target_packed, const complex double *orig_full, const qpms_scatsys_t *ss, qpms_iri_t iri)
Projects a "big" matrix onto an irrep (slow reference implementation).
Definition: scatsystem.c:836
complex double * qpms_scatsysw_build_modeproblem_matrix_full(complex double *target, const qpms_scatsys_at_omega_t *ssw)
Creates the full matrix of the periodic scattering system.
Definition: scatsystem.c:1350
complex double * qpms_scatsys_scatter_solve(complex double *target_f, const complex double *a_inc, qpms_ss_LU ludata)
Solves a (possibly partial, irrep-packed) scattering problem using a pre-factorised .
Definition: scatsystem.c:2320
qpms_errno_t qpms_scatsyswk_scattered_field_basis(ccart3_t *target, const qpms_scatsys_at_omega_k_t *sswk, qpms_bessel_t typ, cart3_t evalpoint)
Evaluates "scattered" field basis functions in a periodic system.
Definition: scatsystem.c:2185
void qpms_scatsystem_set_nthreads(long n)
Overrides the number of threads spawned by the paralellized functions.
Definition: scatsystem.c:47
complex double * qpms_orbit_irrep_basis(size_t *basis_size, complex double *target, const qpms_ss_orbit_type_t *orbit, const qpms_vswf_set_spec_t *bspec, const struct qpms_finite_group_t *sym, const qpms_iri_t iri)
TODO DOC!!!!!
struct beyn_result_t * qpms_scatsys_finite_find_eigenmodes(const qpms_scatsys_t *ss, qpms_iri_t iri, complex double omega_centre, double omega_rr, double omega_ri, size_t contour_npoints, double rank_tol, size_t rank_sel_min, double res_tol)
Searches for finite scattering system's eigenmodes using Beyn's algorithm.
Definition: scatsystem.c:2356
struct qpms_particle_t qpms_particle_t
A particle, defined by its T-matrix and position.
qpms_scatsys_t * qpms_scatsys_load(char *path)
NOT IMPLEMENTED Reads a qpms_scatsys_t structure from a file.
void qpms_scatsys_at_omega_free(qpms_scatsys_at_omega_t *ssw)
Destroys a qpms_scatsys_at_omega_t.
Definition: scatsystem.c:632
complex double * qpms_orbit_action_matrix(complex double *target, const qpms_ss_orbit_type_t *orbit, const qpms_vswf_set_spec_t *bspec, const struct qpms_finite_group_t *sym, const qpms_gmi_t g)
Constructs a "full matrix action" of a point group element for an orbit type.
qpms_ss_LU qpms_scatsysw_build_modeproblem_matrix_full_LU(complex double *target, int *target_piv, const qpms_scatsys_at_omega_t *ssw)
Builds an LU-factorised mode/scattering problem matrix from scratch. Nonperiodic systems only.
Definition: scatsystem.c:2298
static const qpms_vswf_set_spec_t * qpms_ss_bspec_tmi(const qpms_scatsys_t *ss, qpms_ss_tmi_t tmi)
Retrieve the bspec of tmi'th element of ss->tm.
Definition: scatsystem.h:230
complex double * qpms_scatsyswk_build_modeproblem_matrix_full(complex double *target, const qpms_scatsys_at_omega_k_t *sswk)
Creates the full matrix of the periodic scattering system.
Definition: scatsystem.c:1357
struct beyn_result_t * qpms_scatsys_periodic_find_eigenmodes(const qpms_scatsys_t *ss, const double k[3], complex double omega_centre, double omega_rr, double omega_ri, size_t contour_npoints, double rank_tol, size_t rank_sel_min, double res_tol)
Searches for periodic scattering system's eigenmodes using Beyn's algorithm.
Definition: scatsystem.c:2406
qpms_ss_LU qpms_scatsyswk_build_modeproblem_matrix_full_LU(complex double *target, int *target_piv, const qpms_scatsys_at_omega_k_t *sswk)
Builds an LU-factorised mode/scattering problem matrix from scratch. Periodic systems only.
Definition: scatsystem.c:2306
complex double * qpms_scatsys_build_translation_matrix_e_irrep_packed(complex double *target, const qpms_scatsys_t *ss, qpms_iri_t iri, complex double k, qpms_bessel_t J)
Global translation matrix with selectable Bessel function, projected on an irrep.
Definition: scatsystem.c:1868
complex double * qpms_scatsys_irrep_unpack_matrix(complex double *target_full, const complex double *orig_packed, const qpms_scatsys_t *ss, qpms_iri_t iri, bool add)
Transforms a big "packed" matrix into the full basis.
Definition: scatsystem.c:995
Beyn algorithm result structure (pure C array version).
Definition: beyn.h:60
3D cartesian coordinates. See also vectors.h.
Definition: qpms_types.h:186
3D complex (actually 6D) coordinates. See also vectors.h.
Definition: qpms_types.h:191
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
A particle, defined by its T-matrix and position.
Definition: scatsystem.h:25
qpms_tmatrix_operation_t op
T-matrix transformation operation w.r.t. tmg.
Definition: scatsystem.h:29
cart3_t pos
Particle position in cartesian coordinates.
Definition: scatsystem.h:27
const qpms_tmatrix_function_t * tmg
T-matrix function; not owned by qpms_particle_t.
Definition: scatsystem.h:28
A particle, defined by its T-matrix INDEX and position, to be used in qpms_scatsys_t.
Definition: scatsystem.h:36
qpms_ss_tmi_t tmatrix_id
T-matrix index.
Definition: scatsystem.h:39
cart3_t pos
Particle position in cartesian coordinates.
Definition: scatsystem.h:38
Scattering system at a given frequency and k-vector. Used only with periodic systems.
Definition: scatsystem.h:488
double k[3]
The k-vector's cartesian coordinates.
Definition: scatsystem.h:490
double eta
Ewald parameter η.
Definition: scatsystem.h:491
Definition: scatsystem.h:239
qpms_tmatrix_t ** tm
T-matrices from ss, evaluated at omega.
Definition: scatsystem.h:245
complex double omega
Angular frequency.
Definition: scatsystem.h:246
qpms_epsmu_t medium
Background medium optical properties at the given frequency.
Definition: scatsystem.h:247
const qpms_scatsys_t * ss
Definition: scatsystem.h:240
complex double wavenumber
Background medium wave number.
Definition: scatsystem.h:248
Definition: scatsystem.h:134
double unitcell_volume
Unitcell volume (irrelevant for non-periodic systems).
Definition: scatsystem.h:148
double eta
Default Ewald parameter .
Definition: scatsystem.h:156
cart3_t reciprocal_basis[3]
Reciprocal lattice basis.
Definition: scatsystem.h:141
cart3_t lattice_basis[3]
(Direct) lattice basis of the system (only lattice_dimension elements are used)
Definition: scatsystem.h:137
Common "class" for system of scatterers, both periodic and non-periodic.
Definition: scatsystem.h:169
qpms_ss_tmi_t tm_capacity
Capacity of tm[].
Definition: scatsystem.h:185
qpms_tmatrix_function_t * tmg
(Template) T-matrix functions in the system.
Definition: scatsystem.h:179
int lattice_dimension
Number of dimensions in which the system is periodic from the range 0–3.
Definition: scatsystem.h:171
qpms_ss_pi_t p_count
Size of particles array.
Definition: scatsystem.h:188
struct qpms_epsmu_generator_t medium
Optical properties of the background medium.
Definition: scatsystem.h:172
qpms_particle_tid_t * p
Particles.
Definition: scatsystem.h:187
qpms_scatsys_periodic_info_t per
Periodic lattice metadata.
Definition: scatsystem.h:226
size_t fecv_size
Number of elements of a full excitation coefficient vector size.
Definition: scatsystem.h:202
qpms_ss_pi_t * p_sym_map
p_sym_map[idi + pi * sym->order] gives the index of pi-th particle under the idi'th sym op.
Definition: scatsystem.h:193
size_t * saecv_ot_offsets
TODO DOC. In the packed vector, saecv_ot_offsets[iri * orbit_type_count + oti] indicates start of ot.
Definition: scatsystem.h:206
const struct qpms_finite_group_t * sym
Symmetry group of the array.
Definition: scatsystem.h:192
qpms_ss_pi_t * p_by_orbit
Particles grouped by orbit (in the order corresponding to the packed memory layout).
Definition: scatsystem.h:217
size_t * fecv_pstarts
Indices of where pi'th particle's excitation coeffs start in a full excitation coefficient vector.
Definition: scatsystem.h:205
qpms_ss_tmi_t tm_count
Number of all different T-matrices in the system (length of tm[]).
Definition: scatsystem.h:184
qpms_ss_pi_t p_capacity
Capacity of p[].
Definition: scatsystem.h:189
qpms_ss_derived_tmatrix_t * tm
All the different T-matrix functions in the system, including those derived from tmg elements by symm...
Definition: scatsystem.h:183
qpms_ss_orbit_type_t * orbit_types
(Array length is orbit_type_count.)
Definition: scatsystem.h:198
qpms_ss_tmi_t * tm_sym_map
Which t-matrices map onto which by the symmetry ops. Lookup by tm_sum_map[idi + tmi * sym->order].
Definition: scatsystem.h:195
size_t max_bspecn
‍**< First index is irrep index as in sym->irreps, second index is particle index....
Definition: scatsystem.h:214
qpms_ss_particle_orbitinfo_t * p_orbitinfo
Orbit type identification of each particle. (Array length is p_count.)
Definition: scatsystem.h:200
qpms_ss_tmgi_t tmg_count
Number of all different original T-matrix generators in the system.
Definition: scatsystem.h:180
size_t * saecv_sizes
Number of elements of symmetry-adjusted coefficient vector sizes (order as in sym->irreps).
Definition: scatsystem.h:203
LU factorisation (LAPACKE_zgetrf) result holder.
Definition: scatsystem.h:432
bool full
true if full matrix; false if irrep-packed.
Definition: scatsystem.h:435
qpms_iri_t iri
Definition: scatsystem.h:436
const struct qpms_scatsys_at_omega_k_t * sswk
Only for periodic systems, otherwise NULL.
Definition: scatsystem.h:434
complex double * a
LU decomposition array.
Definition: scatsystem.h:438
int * ipiv
Pivot index array, size at least max(1,min(m, n)).
Definition: scatsystem.h:440
Auxillary type used in qpms_scatsys_t: A recepy to create another T-matrices by symmetry operations.
Definition: scatsystem.h:129
struct qpms_tmatrix_operation_t op
Operation to derive this particular T-matrix.
Definition: scatsystem.h:131
qpms_ss_tmgi_t tmgi
Index of the corresponding qpms_scatsys_t::tm element.
Definition: scatsystem.h:130
Structure describing a particle's "orbit type" under symmetry group actions in a system.
Definition: scatsystem.h:68
size_t * irbase_offsets
TODO doc.
Definition: scatsystem.h:101
qpms_ss_orbit_pi_t * action
Action of the group elements onto the elements in this orbit.
Definition: scatsystem.h:79
qpms_ss_tmi_t * tmatrices
T-matrix IDs of the particles on this orbit (type).
Definition: scatsystem.h:87
size_t instance_count
TODO doc.
Definition: scatsystem.h:112
complex double * irbases
Per-orbit irreducible representation orthonormal bases.
Definition: scatsystem.h:110
qpms_ss_pi_t p_offset
Cumulative sum of the preceding ot->siza * ot->instance_count;.
Definition: scatsystem.h:114
qpms_ss_orbit_pi_t size
Size of the orbit (a divisor of the group order), i.e. number of particles on the orbit.
Definition: scatsystem.h:69
size_t * irbase_cumsizes
Cumulative sums of irbase_sizes.
Definition: scatsystem.h:99
size_t * irbase_sizes
Sizes of the per-orbit irrep bases.
Definition: scatsystem.h:96
size_t bspecn
Definition: scatsystem.h:70
Auxillary type used in qpms_scatsys_t that identifies the particle's orbit and its id inside that orb...
Definition: scatsystem.h:121
qpms_ss_orbit_pi_t p
Order (sija, ei rankki) of the particle inside that orbit type.
Definition: scatsystem.h:125
qpms_ss_osn_t osn
"Serial number" of the orbit in the given type. TODO type and more doc.
Definition: scatsystem.h:124
qpms_ss_oti_t t
Orbit type.
Definition: scatsystem.h:122
An "abstract" T-matrix, contains a T-matrix generator instead of actual data.
Definition: tmatrices.h:526
A generic T-matrix transformation operator.
Definition: tmatrices.h:609
A T-matrix.
Definition: qpms_types.h:338
Definition: tolerances.h:7
Structure holding the constant factors in normalisation operators.
Definition: translations.h:64
Specifies a finite set of VSWFs.
Definition: qpms_types.h:290
T-matrices for scattering systems.
Vector spherical wavefunctions.
qpms_errno_t(* qpms_incfield_t)(complex double *target, const qpms_vswf_set_spec_t *bspec, const cart3_t evalpoint, const void *args, bool add)
Calculates the (regular VSWF) expansion coefficients of an external incident field.
Definition: vswf.h:17