QPMS
Electromagnetic multiple scattering library and toolkit.
materials.h
Go to the documentation of this file.
1 
4 #ifndef QPMS_MATERIALS_H
5 #define QPMS_MATERIALS_H
6 #include "qpms_types.h"
7 #include <gsl/gsl_spline.h>
8 
9 #ifndef SPEED_OF_LIGHT
11 #define SPEED_OF_LIGHT (2.99792458e8)
12 #endif
13 
14 
16 typedef struct qpms_epsmu_generator_t {
18 
23  qpms_epsmu_t (*function) (complex double omega, const void *params);
24  const void *params;
26 
29  qpms_epsmu_generator_t gen, complex double omega) {
30  return gen.function(omega, gen.params);
31 }
32 
34 qpms_epsmu_t qpms_epsmu_const_g(complex double omega,
35  const void *epsmu
36  );
37 
39 
40 static inline complex double qpms_refindex(qpms_epsmu_t em) {
41  return csqrt(em.eps * em.mu);
42 }
43 
45 
46 static inline complex double qpms_wavenumber(complex double omega, qpms_epsmu_t em) {
47  return qpms_refindex(em)*omega/SPEED_OF_LIGHT;
48 }
49 
51 
52 static inline complex double qpms_waveimpedance(qpms_epsmu_t em) {
53  return csqrt(em.mu / em.eps);
54 }
55 
57 typedef struct qpms_ldparams_triple_t {
58  double f;
59  double omega;
60  double gamma;
62 
64 
69 typedef struct qpms_ldparams_t {
70  complex double eps_inf;
71  double omega_p;
72  size_t n;
75 
76 extern const qpms_ldparams_t *const QPMS_LDPARAMS_AG;
77 extern const qpms_ldparams_t *const QPMS_LDPARAMS_AU;
78 extern const qpms_ldparams_t *const QPMS_LDPARAMS_CU;
79 extern const qpms_ldparams_t *const QPMS_LDPARAMS_AL;
80 extern const qpms_ldparams_t *const QPMS_LDPARAMS_CR;
81 extern const qpms_ldparams_t *const QPMS_LDPARAMS_TI;
82 extern const qpms_ldparams_t *const QPMS_LDPARAMS_BE;
83 extern const qpms_ldparams_t *const QPMS_LDPARAMS_NI;
84 extern const qpms_ldparams_t *const QPMS_LDPARAMS_PD;
85 extern const qpms_ldparams_t *const QPMS_LDPARAMS_PT;
86 extern const qpms_ldparams_t *const QPMS_LDPARAMS_W ;
87 
89 complex double qpms_lorentzdrude_eps(complex double omega, const qpms_ldparams_t *);
90 
92 qpms_epsmu_t qpms_lorentzdrude_epsmu(complex double omega, const qpms_ldparams_t *);
93 
96  complex double omega,
97  const void *ldparams
98  );
99 
100 
102 // TODO use gsl_interp instead of gsl_spline.
104  double *wavelength_m;
105  double *n;
106  double *k;
107  gsl_interp *interp_n;
108  gsl_interp *interp_k;
109  size_t size;
110  // I could add gsl_interp_accel, but that is not necessary.
112 
115  const double *wavelength_m,
116  const double *n,
117  const double *k,
118  const gsl_interp_type *iptype
119  );
120 
123  const char *path,
124  const gsl_interp_type *iptype
125  );
126 
129  const qpms_permittivity_interpolator_t *interp, double omega_SI);
130 
132 
135  complex double omega,
136  const void * interpolator
137  );
138 
142 
146 
149 
151 static inline complex double qpms_drude_epsilon(
152  complex double eps_inf,
153  complex double omega_p,
154  complex double gamma_p,
155  complex double omega
156  ) {
157  return eps_inf - omega_p*omega_p/(omega*(omega+I*gamma_p));
158 }
159 
160 
161 #endif //QPMS_MATERIALS_H
static complex double qpms_wavenumber(complex double omega, qpms_epsmu_t em)
Gets wave number k from angular frequency and material permeability and permittivity.
Definition: materials.h:46
static complex double qpms_drude_epsilon(complex double eps_inf, complex double omega_p, complex double gamma_p, complex double omega)
Relative permittivity from the Drude model.
Definition: materials.h:151
complex double qpms_permittivity_interpolator_eps_at_omega(const qpms_permittivity_interpolator_t *interp, double omega_SI)
Evaluates interpolated material permittivity at a given angular frequency.
Definition: materials.c:120
const qpms_ldparams_t *const QPMS_LDPARAMS_CR
Lorentz-Drude parameters from for chromium.
Definition: drudeparam_data.c:85
static complex double qpms_refindex(qpms_epsmu_t em)
Gets refractive index of a material from its permeability and permittivity.
Definition: materials.h:40
qpms_epsmu_t qpms_lorentzdrude_epsmu(complex double omega, const qpms_ldparams_t *)
Lorentz-Drude optical properties, with relative permeability set always to one.
Definition: materials.c:166
const qpms_ldparams_t *const QPMS_LDPARAMS_AU
Lorentz-Drude parameters from for gold.
Definition: drudeparam_data.c:28
const qpms_ldparams_t *const QPMS_LDPARAMS_AG
Lorentz-Drude parameters from for silver.
Definition: drudeparam_data.c:43
struct qpms_permittivity_interpolator_t qpms_permittivity_interpolator_t
Interpolator of tabulated optical properties.
const qpms_ldparams_t *const QPMS_LDPARAMS_NI
Lorentz-Drude parameters from for nickel.
Definition: drudeparam_data.c:127
#define SPEED_OF_LIGHT
Speed of light in m/s.
Definition: materials.h:11
double qpms_permittivity_interpolator_omega_min(const qpms_permittivity_interpolator_t *ip)
Returns the minimum angular frequency supported by the interpolator.
Definition: materials.c:150
double qpms_permittivity_interpolator_omega_max(const qpms_permittivity_interpolator_t *ip)
Returns the minimum angular frequency supported by the interpolator.
Definition: materials.c:144
static complex double qpms_waveimpedance(qpms_epsmu_t em)
Gets (relative) wave impedance from material permeability and permittivity.
Definition: materials.h:52
qpms_epsmu_t qpms_epsmu_const_g(complex double omega, const void *epsmu)
Constant optical property "generator" for qpms_epsmu_generator_t.
Definition: materials.c:179
qpms_permittivity_interpolator_t * qpms_permittivity_interpolator_from_yml(const char *path, const gsl_interp_type *iptype)
Creates a permittivity interpolator from an yml file downloaded from refractiveindex....
Definition: materials.c:104
complex double qpms_lorentzdrude_eps(complex double omega, const qpms_ldparams_t *)
Lorentz-Drude permittivity.
Definition: materials.c:156
struct qpms_ldparams_triple_t qpms_ldparams_triple_t
A triple for qpms_ldparams_t.
const qpms_ldparams_t *const QPMS_LDPARAMS_W
Lorentz-Drude parameters from for tungsten.
Definition: drudeparam_data.c:169
qpms_epsmu_t qpms_lorentzdrude_epsmu_g(complex double omega, const void *ldparams)
Lorentz-Drude optical properties, with relative permeability set always to one, compatible with qpms_...
Definition: materials.c:174
const qpms_ldparams_t *const QPMS_LDPARAMS_TI
Lorentz-Drude parameters from for titanium.
Definition: drudeparam_data.c:99
const qpms_ldparams_t *const QPMS_LDPARAMS_CU
Lorentz-Drude parameters from for copper.
Definition: drudeparam_data.c:57
const qpms_ldparams_t *const QPMS_LDPARAMS_BE
Lorentz-Drude parameters from for beryllium.
Definition: drudeparam_data.c:113
void qpms_permittivity_interpolator_free(qpms_permittivity_interpolator_t *interp)
Destroy a permittivity interpolator.
Definition: materials.c:32
struct qpms_epsmu_generator_t qpms_epsmu_generator_t
Prototype for general optical property generator for isotropic materials.
qpms_permittivity_interpolator_t * qpms_permittivity_interpolator_create(const size_t incount, const double *wavelength_m, const double *n, const double *k, const gsl_interp_type *iptype)
Creates a permittivity interpolator from tabulated wavelengths, refraction indices and extinction coe...
Definition: materials.c:11
qpms_epsmu_t qpms_permittivity_interpolator_epsmu_g(complex double omega, const void *interpolator)
Evaluates interpolated material permittivity at a given angular frequency, qpms_epsmu_generator_t com...
Definition: materials.c:131
const qpms_ldparams_t *const QPMS_LDPARAMS_PD
Lorentz-Drude parameters from for polonium.
Definition: drudeparam_data.c:141
struct qpms_ldparams_t qpms_ldparams_t
Structure holding Lorentz-Drude model parameters of a material.
const qpms_ldparams_t *const QPMS_LDPARAMS_PT
Lorentz-Drude parameters from for platinum.
Definition: drudeparam_data.c:155
const qpms_ldparams_t *const QPMS_LDPARAMS_AL
Lorentz-Drude parameters from for aluminium.
Definition: drudeparam_data.c:71
static qpms_epsmu_t qpms_epsmu_generator_eval(qpms_epsmu_generator_t gen, complex double omega)
Convenience function for generating material properties at given frequency.
Definition: materials.h:28
Common qpms types.
struct qpms_epsmu_t qpms_epsmu_t
A type holding electric permittivity and magnetic permeability of a material.
Prototype for general optical property generator for isotropic materials.
Definition: materials.h:16
qpms_epsmu_t(* function)(complex double omega, const void *params)
Generator function.
Definition: materials.h:23
A type holding electric permittivity and magnetic permeability of a material.
Definition: qpms_types.h:422
complex double mu
Relative permeability.
Definition: qpms_types.h:424
complex double eps
Relative permittivity.
Definition: qpms_types.h:423
Structure holding Lorentz-Drude model parameters of a material.
Definition: materials.h:69
qpms_ldparams_triple_t data[]
"Oscillator" parameters.
Definition: materials.h:73
size_t n
Number of "oscillators".
Definition: materials.h:72
complex double eps_inf
Permittivity at infinity.
Definition: materials.h:70
double omega_p
Plasma frequency.
Definition: materials.h:71
A triple for qpms_ldparams_t.
Definition: materials.h:57
Interpolator of tabulated optical properties.
Definition: materials.h:103
size_t size
Size of n[], k[], and wavelength_m[].
Definition: materials.h:109
double * wavelength_m
Wavelength array (in meters).
Definition: materials.h:104
double * k
Attenuation coefficient array.
Definition: materials.h:106
gsl_interp * interp_k
Attenuation coeff interpolator object.
Definition: materials.h:108
double * n
Refraction index array.
Definition: materials.h:105
gsl_interp * interp_n
Refraction index interpolator object.
Definition: materials.h:107