API reference
CoupledDipole.ClusterCoupledDipole.DipoleKindCoupledDipole.HalfSpaceOpticalStateCoupledDipole.InterfacePoleCoupledDipole.KuwataCoupledDipole.MajicCoupledDipole.MaterialCoupledDipole.MieApproxCoupledDipole.ParticleDipoleCoupledDipole.PointDipoleCoupledDipole.PolarizabilityPrescriptionCoupledDipole.SommerfeldContourPlanCoupledDipole.SommerfeldIntegrationDiagnosticsCoupledDipole.absorption!CoupledDipole.alpha_embedCoupledDipole.alpha_imagedCoupledDipole.alpha_imagedCoupledDipole.alpha_kuwataCoupledDipole.alpha_lorentzmoleculeCoupledDipole.alpha_particlesCoupledDipole.alpha_rh6gCoupledDipole.alpha_scaleCoupledDipole.alpha_voigtCoupledDipole.alpha_wrapperCoupledDipole.analyze_halfspace_polesCoupledDipole.axis_angleCoupledDipole.channel_spectra_dfCoupledDipole.choose_halfspace_contour_planCoupledDipole.cluster_arrayCoupledDipole.cluster_chainCoupledDipole.cluster_dimerCoupledDipole.cluster_helixCoupledDipole.cluster_mixtureCoupledDipole.cluster_orientationCoupledDipole.cluster_pumpkinCoupledDipole.cluster_quadrimerCoupledDipole.cluster_shellCoupledDipole.cluster_shell_landingsCoupledDipole.cluster_singleCoupledDipole.contour_integralCoupledDipole.cubature_sphereCoupledDipole.depolarisation_ellipsoidCoupledDipole.depolarisation_spheroidCoupledDipole.dipole_kindCoupledDipole.dipole_kindCoupledDipole.dispersion_dfCoupledDipole.epsilon_AgCoupledDipole.epsilon_AuCoupledDipole.epsilon_SiCoupledDipole.epsilon_SiCoupledDipole.epsilon_waterCoupledDipole.euler_activeCoupledDipole.euler_passiveCoupledDipole.euler_unitvectorCoupledDipole.expand_gridCoupledDipole.extinction!CoupledDipole.far_fieldCoupledDipole.fresnel_denominator_teCoupledDipole.fresnel_denominator_tmCoupledDipole.fresnel_reflection_teCoupledDipole.fresnel_reflection_tmCoupledDipole.incidence_labelsCoupledDipole.incidence_labelsCoupledDipole.incident_field_dip!CoupledDipole.incident_field_probeCoupledDipole.incident_field_pwCoupledDipole.incident_field_pw!CoupledDipole.incident_field_sphereCoupledDipole.incident_field_sphere!CoupledDipole.interaction_matrix_halfspace_labframeCoupledDipole.interaction_matrix_halfspace_labframe!CoupledDipole.interaction_matrix_labframeCoupledDipole.interaction_matrix_labframe!CoupledDipole.interaction_matrix_sphere_labframeCoupledDipole.interaction_matrix_sphere_labframe!CoupledDipole.is_admissible_surface_poleCoupledDipole.is_insideCoupledDipole.iterate_field!CoupledDipole.kz_radiation_branchCoupledDipole.locate_halfspace_surface_poleCoupledDipole.lorentzianCoupledDipole.map_nfCoupledDipole.mie_dipole_zCoupledDipole.mie_ffCoupledDipole.mie_pwe_zCoupledDipole.mie_susceptibilityCoupledDipole.mie_vsh_pitau01CoupledDipole.molecular_polarisabilityCoupledDipole.oa_analyticalCoupledDipole.oa_c_absCoupledDipole.oa_c_extCoupledDipole.oa_dfCoupledDipole.particle_polarisabilityCoupledDipole.pmap_dfCoupledDipole.polarisationCoupledDipole.polarisation!CoupledDipole.prescription_kindCoupledDipole.prescription_kindCoupledDipole.propagator_sphere_zCoupledDipole.quadrature_lgwtCoupledDipole.reflected_coupling_matrix_halfspace_prototypeCoupledDipole.reflected_dyadic_block_j0_prototypeCoupledDipole.reflected_kernel_j0_channelsCoupledDipole.reflected_kernel_reference_channelsCoupledDipole.reflected_kernel_te_j0CoupledDipole.reflected_kernel_te_j2CoupledDipole.reflected_kernel_tm_j0CoupledDipole.reflected_kernel_tm_j2CoupledDipole.reflected_self_block_halfspace_prototypeCoupledDipole.ricatti_besselCoupledDipole.scattered_fieldCoupledDipole.scattering!CoupledDipole.scattering_channelsCoupledDipole.scattering_channels!CoupledDipole.scattering_channels_halfspace_prototypeCoupledDipole.scattering_channels_halfspace_prototype!CoupledDipole.scattering_patternCoupledDipole.simulate_core_shellCoupledDipole.simulate_core_shellCoupledDipole.simulate_mieCoupledDipole.simulate_mieCoupledDipole.simulate_mixtureCoupledDipole.solve_fieldsCoupledDipole.solve_fieldsCoupledDipole.spectrum_coreshell_dipoleCoupledDipole.spectrum_coreshell_dipoleCoupledDipole.spectrum_coreshell_dispersionCoupledDipole.spectrum_coreshell_dispersionCoupledDipole.spectrum_coreshell_oaCoupledDipole.spectrum_coreshell_oaCoupledDipole.spectrum_dispersionCoupledDipole.spectrum_dispersion_halfspace_channels_prototypeCoupledDipole.spectrum_mixtureCoupledDipole.spectrum_oaCoupledDipole.spectrum_oa_analyticalCoupledDipole.spheroid_arCoupledDipole.spheroid_projected_areaCoupledDipole.vacuum_wavenumberCoupledDipole.visualise_makieCoupledDipole.visualise_threejs
CoupledDipole.DipoleKind — Type
DipoleKindAbstract type describing how a single dipole's polarisability is modelled. Concrete subtypes are the singletons PointDipole and ParticleDipole.
Using dispatchable types instead of raw strings ("point"/"particle") avoids typos silently falling through to an @error at runtime, and lets alpha_wrapper branch on isa rather than comparing strings in a hot loop.
CoupledDipole.HalfSpaceOpticalState — Type
HalfSpaceOpticalStateOptical parameters for a homogeneous planar interface:
- upper medium refractive index
n_upper, - lower (substrate) refractive index
n_lower, - vacuum wavelength
wavelength(same units as any geometric lengths used later).
CoupledDipole.InterfacePole — Type
InterfacePoleDetected pole of a spectral kernel denominator.
CoupledDipole.Kuwata — Type
Kuwata et al.'s modified long-wavelength approximation for a spheroid.
CoupledDipole.Majic — Type
Majic et al.'s dynamic-depolarisation expansion for a spheroid.
CoupledDipole.MieApprox — Type
Exact (electric-dipole order) Mie-theory polarisability for a sphere.
CoupledDipole.ParticleDipole — Type
A finite particle: polarisability from a quasistatic/Mie-type prescription.
CoupledDipole.PointDipole — Type
A point dipole: polarisability from the bare embedded/rescaled molecular response.
CoupledDipole.PolarizabilityPrescription — Type
PolarizabilityPrescriptionAbstract type describing which quasistatic/Mie-type prescription is used to compute a particle's polarisability. Concrete subtypes are the singletons Kuwata, Majic and MieApprox.
Using dispatchable types instead of raw strings avoids a typo silently falling through to a @warn-and-fallback branch, and lets alpha_particles dispatch on type rather than comparing strings in a hot loop.
CoupledDipole.SommerfeldContourPlan — Type
SommerfeldContourPlanPiecewise-linear contour in complex k_ρ plane for Sommerfeld-type integrals. nodes are ordered polyline vertices; consecutive pairs define segments.
CoupledDipole.SommerfeldIntegrationDiagnostics — Type
SommerfeldIntegrationDiagnosticsIntegration diagnostics for contour-based Sommerfeld evaluations.
CoupledDipole.alpha_imaged — Method
alpha_imaged(α, d; ε_medium=1.0, ε_substrate=2.25, averaged=true)Image-dipole correction for a polarizable dipole a distance d (nm) above a planar interface between ε_medium and ε_substrate.
- with
averaged=true(default), returns orientational average(2α∥ + α⊥)/3 - with
averaged=false, returnsSVector(α∥, α∥, α⊥)
CoupledDipole.alpha_imaged — Method
alpha_imaged(α::SVector{3}, d; ε_medium=1.0, ε_substrate=2.25)Component-wise image-dipole correction for a principal-axis polarisability vector (αx, αy, αz) at distance d above a planar interface.
The x/y components use the parallel-channel correction and z uses the perpendicular-channel correction.
CoupledDipole.alpha_particles — Method
alphaparticles(Epsilon, Sizes, εm, λ; prescription="kuwata")
Principal polarisability components of N particles
λ: wavelengthε: complex dielectric functionε_m: dielectric function of surrounding mediumSizes: Vector of 3-SVectors of particle sizesprescription:PolarizabilityPrescription(Kuwata()/Majic()/MieApprox()), or the legacy strings "kuwata"/"majic"/"mie"
Examples
julia> alpha_particles(500, -10+1im, 1.33^3, [SVector(30, 30, 50) for i in 1:4])
4-element Vector{SVector{3, ComplexF64}}:
[83399.81975161123 + 64172.28157743772im, 83399.81975161123 + 64172.28157743772im, -86034.64340475321 + 79773.72029581512im]
[83399.81975161123 + 64172.28157743772im, 83399.81975161123 + 64172.28157743772im, -86034.64340475321 + 79773.72029581512im]
[83399.81975161123 + 64172.28157743772im, 83399.81975161123 + 64172.28157743772im, -86034.64340475321 + 79773.72029581512im]
[83399.81975161123 + 64172.28157743772im, 83399.81975161123 + 64172.28157743772im, -86034.64340475321 + 79773.72029581512im]CoupledDipole.alpha_rh6g — Method
alpha_rh6g(λ::Real)
bare polarisability of dye Rhodamine 6G retrieved from extinction measurements
lambda = 400:800 a1 = alpha_rh6g.(lambda)
α∞=9.6e-39, αk=5.76e-38, λk=526.0, µk=1.0e4
a2 = alphalorentzmolecule.(lambda) a3 = alphalorentzmolecule.(lambda; αk=[5.76e-38, 1.552e-38], λk=[526, 496], µ_k=[10000, 6000])
series([real.(a1), real.(a2), real.(a3), imag.(a1), imag.(a2), imag.(a3)])
CoupledDipole.alpha_voigt — Method
alpha_voigt(λ; α_∞=9.6e-39, α_k=5.76e-38, λ_k=526.0, µ_k=1.0e4, σ_k=10.0)Complex scalar molecular polarizability using Gaussian-broadened Lorentz oscillators, evaluated analytically with the Faddeeva function (SpecialFunctions.faddeeva). σ_k is the standard deviation (in nm) of resonance-wavelength inhomogeneous broadening. Set σ_k=0 to recover the pure Lorentzian model.
CoupledDipole.alpha_wrapper — Method
alpha_wrapper(cl, mat, λ, prescription)
High-level wrapper for both types of polarisabilities
Examples
λ = 633.0
media = Dict([("Au", epsilon_Au), ("medium", x -> 1.33)])
mat = Material(λ, media)
cl = cluster_chain(5, 100, 1,2,3)
n_medium = mat.media["medium"](λ)
particle_dipoles = [true, false, true, true, false]
point_dipoles = .!particle_dipoles
alpha_wrapper(cl, mat, λ, "kuwata")CoupledDipole.analyze_halfspace_poles — Method
analyze_halfspace_poles(state; previous_tm=nothing, include_te=false, tol=1e-10, maxiter=40)Analyze candidate interface poles for a homogeneous substrate. This is intended as a dynamic pre-pass before selecting Sommerfeld contours.
When previous_tm is provided, it is used as continuation seed for TM poles across neighboring wavelengths or material parameters.
CoupledDipole.channel_spectra_df — Method
channel_spectra_df(channels, wavelength; format="long")Long-format dataframe for prototype half-space channel spectra returned by spectrum_dispersion_halfspace_channels_prototype.
channels: named tuple with channel arrays (upper,lower_raw,lower_transmitted,substrate_loss_estimate,total_estimate), each of sizeN_λ × 2N_inc,wavelength: wavelength vector (N_λentries).
CoupledDipole.choose_halfspace_contour_plan — Method
choose_halfspace_contour_plan(state, rho, zsum; pole=nothing, offset_imag_factor=0.2, safety_margin_factor=0.02)Build a piecewise-linear contour for half-space Sommerfeld integrals.
If pole is provided and close to the default contour, the intermediate node is shifted to keep a minimum lateral clearance from the pole.
CoupledDipole.cluster_mixture — Method
cluster_mixture(N, a, b, c, R; proportion=0.5, orientation="radial",
position="fibonacci", material_A="Rhodamine", material_B="NileBlue",
type="point", min_exclusion=1.0)Spherical shell of N particles with two material labels mixed on one geometry. proportion is the fraction of particles assigned to material_A.
CoupledDipole.cluster_orientation — Method
cluster_orientation(N, a, b, c, R, tilt; position="fibonacci", material="Rhodamine",
type="point", min_exclusion=1.0)Spherical shell where each particle is tilted by a fixed tilt (radians) away from the local radial direction with random azimuth in the tangent plane.
CoupledDipole.cluster_pumpkin — Method
cluster_pumpkin(N, a, b, c, R, cone_angle; position="fibonacci", material="Rhodamine",
type="point", min_exclusion=1.0, tilt=0.0)Patchy spherical-shell cluster restricted to a polar cone around +z with half-angle cone_angle (radians). Optional tilt applies the same fixed tilt away from radial for all particles.
CoupledDipole.cluster_quadrimer — Function
cluster_quadrimer(r, d, material="Au", type="particle")
Particle cluster consisting of 4 identical spheres in a chiral geometry
r: sphere radiusd: gap between spheresmaterial: String referencing the material of every particletype: DipoleKind (PointDipole()/ParticleDipole()), or the legacy strings "point"/"particle"
Examples
cluster_quadrimer(80, 10)CoupledDipole.cluster_shell — Method
cluster_shell(N, a, b, c, R; orientation="radial", position="fibonacci", material="Rhodamine", type="point", min_exclusion=1.0)Create a shell cluster on radius R with configurable position sampling and particle orientation.
CoupledDipole.cluster_shell_landings — Function
cluster_shell_landings(N, a, R, threshold_d=0.5; monomer_mat="NileBlueM", dimer_mat="NileBlueD", type="point")Build a shell cluster from random landing points, labeling near-neighbor pairs as dimers.
CoupledDipole.contour_integral — Method
contour_integral(integrand, plan; rtol=1e-6, atol=1e-10)Integrate a complex-valued spectral integrand(k_rho) along plan and return (value, diagnostics).
CoupledDipole.depolarisation_ellipsoid — Method
depolarisation_ellipsoid(a, b, c)
Depolarisation factor of an ellipsoid
a: semi-axis along xb: semi-axis along yc: semi-axis along z
Examples
julia> round.(depolarisation_ellipsoid(1, 1, 1.5), digits=5)
3-element SVector{3, Float64} with indices SOneTo(3):
0.38351
0.38351
0.23298CoupledDipole.dipole_kind — Method
dipole_kind(s::AbstractString)String overload of dipole_kind for legacy "point"/"particle" inputs.
CoupledDipole.dipole_kind — Method
dipole_kind(x)Normalise x to a DipoleKind instance.
Accepts a DipoleKind directly (returned unchanged), or the legacy strings "point"/"particle" for backward compatibility with existing scripts.
CoupledDipole.epsilon_Si — Method
epsilon_Si(λ::Real)
lambda = 400:800 eps = epsilon_Si.(lambda) series([real.(eps), imag.(eps)])
CoupledDipole.epsilon_Si — Method
epsilon_Si(λ)Silicon dielectric function convenience wrapper delegated to DielectricFunctions.
CoupledDipole.epsilon_water — Method
epsilon_water(λ::Real; temperature::Real=20)
lambda = 400:800 eps = epsilonwater.(lambda) eps2 = epsilonwater.(lambda; temperature=10) series([eps, eps2])
CoupledDipole.expand_grid — Method
expand_grid(; kws...)
Expand all combinations of named arguments
kws...: named parameters
Examples
julia> expand_grid(a=[0.1,0.2,0.3], b = [1,2])
6×2 DataFrame
Row │ a b
│ Float64 Int64
─────┼────────────────
1 │ 0.1 1
2 │ 0.2 1
3 │ 0.3 1
4 │ 0.1 2
5 │ 0.2 2
6 │ 0.3 2CoupledDipole.far_field — Method
far_field(direction, k, positions, dipoles)Evaluate the far-field electric contribution for a given scattering direction.
direction: SVector/tuple of Euler angles used byeuler_unitvectork: wavenumber in mediumpositions: source dipole positionsdipoles: stacked dipole moments (3 rows per source)
CoupledDipole.fresnel_denominator_te — Method
fresnel_denominator_te(state, k_rho)TE Fresnel denominator in k_rho form for nonmagnetic media: D_TE = kz₁ + kz₂.
CoupledDipole.fresnel_denominator_tm — Method
fresnel_denominator_tm(state, k_rho)TM Fresnel denominator in k_rho form for nonmagnetic media: D_TM = ε₂ kz₁ + ε₁ kz₂, where media 1/2 are upper/lower half-spaces.
CoupledDipole.fresnel_reflection_te — Method
fresnel_reflection_te(state, k_rho)TE Fresnel reflection coefficient r_TE(k_ρ) for a half-space interface.
CoupledDipole.fresnel_reflection_tm — Method
fresnel_reflection_tm(state, k_rho)TM Fresnel reflection coefficient r_TM(k_ρ) for a half-space interface.
CoupledDipole.incidence_labels — Method
incidence_labels(d, Incidence, labels)As incidence_labels(d, Incidence), with an additional categorical labels column attached to each incidence direction.
CoupledDipole.incidence_labels — Method
incidence_labels(d, Incidence)Merging incidence information with dataframe of dispersion spectra
d: long-format output from dispersion_dfIncidence: vector of Rotation objects
CoupledDipole.incident_field_dip! — Method
incidentfielddip!(Ein, source, k, positions)
Incident field at particle positions, from a dipole source
Ein:3N_dip x N_incmatrix, right-hand side of coupled-dipole systemsource: 3-Svector, source positionk: wavenumber in incident mediumpositions:N_dip-vector of 3-Svectors of particle positions
CoupledDipole.incident_field_probe — Method
incidentfieldprobe(Ejones, k, probe, IncidenceRotations)
evaluates the E and B fields at a probe location, for mapping purposes Note that much of the functionality is common with incidentfieldpw
probe: SVector, point where the scattered EM field is to be evaluatedk: wavenumber- n_medium
Ejones: 2-Svectors defining 2 orthogonal Jones polarisationsIncidenceRotations:N_inc-vector of rotation 3-Smatrices
CoupledDipole.incident_field_pw — Method
incident_field_pw(Ejones, kn, R, IncidenceRotations)Allocate and return the plane-wave incident-field matrix used on the right-hand side of the coupled-dipole linear system.
CoupledDipole.incident_field_sphere! — Method
incident_field_sphere!(Esphere, Ejones, R, IncidenceRotations, Egrid)Incident-field contribution scattered by a spherical core, evaluated at dipole positions for two orthogonal Jones polarisations.
Esphere:3N_dip x 2N_incoutput matrixEjones: tuple/vector of 2 Jones vectors (SVector{2})R: dipole positions (Vector{SVector{3}})IncidenceRotations: incident-direction rotations (Vectorof 3x3 rotations)Egrid: sphere-scattered field coefficients (theta,Ecr,Ect,Esf,Ep0)
CoupledDipole.incident_field_sphere — Method
incident_field_sphere(Ejones, R, IncidenceRotations, Egrid)Allocate and return the sphere-scattered incident-field contribution at dipole positions for the supplied incidence set.
CoupledDipole.interaction_matrix_halfspace_labframe! — Method
interaction_matrix_halfspace_labframe!(F, k, R, AlphaBlocks, state; previous_poles=nothing, rtol=1e-6, atol=1e-10)Fill F with the prototype half-space interaction matrix:
F = I - (G⁰ + Gᴿ) α
where the reflected contribution Gᴿ is assembled from the stage-A spectral reference kernels in reflected_coupling_matrix_halfspace_prototype.
Returns a named tuple with pole candidates used for contour steering ((; tm, te)), which can be fed back through previous_poles in subsequent calls as continuation seeds.
CoupledDipole.interaction_matrix_halfspace_labframe — Method
interaction_matrix_halfspace_labframe(k, R, AlphaBlocks, state; previous_poles=nothing, rtol=1e-6, atol=1e-10)Allocate and return (F, poles) for the prototype half-space interaction matrix assembly.
CoupledDipole.interaction_matrix_labframe — Method
interaction_matrix_labframe(k, R, AlphaBlocks)Allocate and return the free-space interaction matrix in the lab frame.
CoupledDipole.interaction_matrix_sphere_labframe! — Method
interaction_matrix_sphere_labframe!(S, R, AlphaBlocks, Egrid; self_reaction=true)Fill S (size 3N × 3N) with the dipole-dipole interaction matrix mediated by a sphere, using the precomputed field grid Egrid.
CoupledDipole.interaction_matrix_sphere_labframe — Method
interaction_matrix_sphere_labframe(R, AlphaBlocks, Egrid; self_reaction=true)Allocate and return the sphere-mediated interaction matrix in the lab frame.
CoupledDipole.is_admissible_surface_pole — Method
is_admissible_surface_pole(state, k_rho)Basic physical admissibility check for source/observer above substrate:
- positive real part of lateral wavenumber,
- non-growing vertical factors in both media (
imag(kz₁), imag(kz₂) ≥ -atol).
CoupledDipole.is_inside — Method
is_inside(probe, positions, sizes, ParticleRotations)Test whether probe lies inside any ellipsoidal particle and return (overall::Bool, ids) where ids are matching indices.
CoupledDipole.iterate_field! — Method
iterate_field!(E, P, σ_ext, Ein, F, kn, AlphaBlocks, tol=1e-4, maxiter=1000)Order-of-scattering iteration of the total field
E:3N_dip x N_incmatrix, total field for all incidencesP:3N_dip x N_incmatrix, polarisations for all incidencesEin:3N_dip x N_incmatrix, total field for all incidencesF:3N_dip x 3N_dipinteraction matrix (I - G0 Alpha)AlphaBlocks:N_dip-vector of 3x3 Smatrices (polarisability tensors in the lab frame)
CoupledDipole.kz_radiation_branch — Method
kz_radiation_branch(k_rho, k_medium)Return kz = sqrt(k_medium^2 - k_rho^2) on the radiation branch:
imag(kz) ≥ 0,- if
imag(kz) ≈ 0, enforcereal(kz) ≥ 0.
CoupledDipole.locate_halfspace_surface_pole — Method
locate_halfspace_surface_pole(state; polarization=:TM, initial_guess=nothing, tol=1e-10, maxiter=40, admissibility_tol=1e-10)Find one spectral pole candidate for a homogeneous half-space interface by solving D(k_rho)=0 with complex Newton/secant updates.
Returns nothing if:
- solver does not converge to residual
≤ tol, or - candidate fails
is_admissible_surface_pole.
CoupledDipole.map_nf — Method
map_nf(probes, cl::Cluster, mat::Material, Incidence; polarisation="linear", prescription="kuwata")
probes: array of SVectors, points where the scattered EM field is to be evaluatedcl: cluster of particlesmat: dielectric functionsIncidence: N_inc vector of quaternions describing incidence directionspolarisation: incident field consists of 2 orthogonal "linear" or "circular" polarisationsprescription: polarisability prescription for particlesevaluate_inside: logical, whether to compute the (unphysical) scattered field inside particles
example
x = -200.0:2.0:200
probes = SVector.(Iterators.product(x, x, zero(eltype(x))))[:]
probes = SVector.(Iterators.product(x, zero(eltype(x)), zero(eltype(x))))[:]
CoupledDipole.mie_dipole_z — Method
mie_dipole_z(d, wavelength, epsilon, medium, radius, N_esa, N_mie, N_theta)Re-exported from MieScattering.
CoupledDipole.mie_ff — Method
mie_ff(radius, wavelength, epsilon, medium, nmax)Re-exported from MieScattering.
CoupledDipole.mie_pwe_z — Method
mie_pwe_z(d, wavelength, epsilon, medium, radius, N_mie, N_theta)Re-exported from MieScattering.
CoupledDipole.mie_susceptibility — Method
mie_susceptibility(x, s, nmax)Re-exported from MieScattering.
CoupledDipole.mie_vsh_pitau01 — Method
mie_vsh_pitau01(nmax, theta)Re-exported from MieScattering.
CoupledDipole.molecular_polarisability — Method
molecular_polarisability(cl, mat, λ, point_dipoles, n_medium)Local-field-corrected molecular/point-dipole polarisabilities (alpha_embed then alpha_scale) for the dipoles flagged true in point_dipoles.
This is the "molecular local-field correction" component factored out of alpha_wrapper so it can be composed/tested independently of the particle prescription branch.
CoupledDipole.oa_analytical — Method
oa_analytical(kn, cl.positions, AlphaBlocks)
Interaction matrix
k: wavenumber in incident mediumR:N_dip-vector of 3-Svectors of particle positionsAlphaBlocks:N_dip-vector of 3x3 Smatrices (polarisability tensors in the lab frame)
CoupledDipole.oa_c_abs — Method
oacabs(k, G0, invA, diagInvAlpha)
Computes the OA absorption cross-section from the solution of CDA equations
PARAMETERS:
- kn [scalar] wavenumber in medium
- G0 3Nrx3Nr matrix of free-space Green tensor at positions r_i
- invA 3Nrx3Nr inverse of the interaction matrix
- diagInvAlpha 3Nrx3Nr inverse of the block-diagonal matrix of polarisabilities
RETURNS: absorption cross-section analytically orientation-averaged
DEPENDS: Asym
FAMILY: lowlevel, crosssection
CoupledDipole.oa_c_ext — Method
oacext(kn, G0, B, diagA, shift)
Computes the OA absorption cross-section from the solution of CDA equations
PARAMETERS:
- kn [scalar] wavenumber in medium
- G 3NrxN_inc matrix
- W 3NrxN_inc matrix
- invV 3NrxN_inc matrix
RETURNS: absorption cross-section analytically orientation-averaged
DEPENDS: Asym
FAMILY: lowlevel, crosssection
CoupledDipole.particle_polarisability — Method
particle_polarisability(cl, mat, λ, particle_dipoles, n_medium, prescription)Particle polarisabilities (alpha_particles, under the chosen PolarizabilityPrescription) for the dipoles flagged true in particle_dipoles.
This is the "particle prescription" component factored out of alpha_wrapper so it can be composed/tested independently of the molecular local-field correction branch.
CoupledDipole.pmap_df — Method
pmap_df(p, f, kws...; join = true)
Expand all combinations of named arguments
p: DataFrame-like array of parametersf: function to apply to each row vectorkws...: extra arguments passed to fjoin: logical, join parameters and results
CoupledDipole.polarisation — Method
polarisation(E, AlphaBlocks)Allocate and return P = αE using polarisation!.
CoupledDipole.prescription_kind — Method
prescription_kind(s::AbstractString)String overload of prescription_kind for legacy "kuwata", "majic" and "mie" inputs.
CoupledDipole.prescription_kind — Method
prescription_kind(x)Normalise x to a PolarizabilityPrescription instance.
Accepts a PolarizabilityPrescription directly (returned unchanged), or the legacy strings "kuwata"/"majic"/"mie" for backward compatibility with existing scripts.
CoupledDipole.propagator_sphere_z — Method
propagator_sphere_z(theta, phi, Egrid)Sphere-mediated Green tensor (cartesian blocks) in a rotated frame where the source dipole is placed on the +z axis.
Egrid must provide fields theta, Ep0, Ecr, Ect, Esf, Em0r, Em0t. Returns a 3N × 3 matrix where each 3-row block is the cartesian Green tensor block for one target position.
CoupledDipole.reflected_coupling_matrix_halfspace_prototype — Method
reflected_coupling_matrix_halfspace_prototype(k, R, AlphaBlocks, state; previous_poles=nothing, rtol=1e-6, atol=1e-10)Prototype reflected coupling matrix contribution (off-diagonal blocks only) matching interaction_matrix_labframe! block conventions:
C[i,j] = Gᴿ_ij * α_j for i ≠ j, with zero diagonal.
previous_poles can provide continuation seeds as named tuple (; tm=<InterfacePole or nothing>, te=<InterfacePole or nothing>).
CoupledDipole.reflected_dyadic_block_j0_prototype — Method
reflected_dyadic_block_j0_prototype(state, r_obs, r_src; tm_pole=nothing, te_pole=nothing, rtol=1e-6, atol=1e-10)Prototype reflected 3×3 dyadic block for source/observer above a homogeneous substrate, assembled from the Weyl/Sommerfeld tensor representation with explicit TE/TM projectors and azimuthal averaging.
CoupledDipole.reflected_kernel_j0_channels — Method
reflected_kernel_j0_channels(state, rho, zsum; tm_pole=nothing, te_pole=nothing, rtol=1e-6, atol=1e-10)Evaluate both TM and TE reference J0-channel integrals and return (tm=value_tm, te=value_te, diagnostics=(tm=diag_tm, te=diag_te)).
This is a solver-agnostic prototype API for assembling reflected dyadic blocks.
CoupledDipole.reflected_kernel_reference_channels — Method
reflected_kernel_reference_channels(state, rho, zsum; tm_pole=nothing, te_pole=nothing, rtol=1e-6, atol=1e-10)Evaluate TM/TE J0 and J2 reference channels for reflected-kernel prototyping. Returns values and per-channel diagnostics.
CoupledDipole.reflected_kernel_te_j0 — Method
reflected_kernel_te_j0(state, rho, zsum; pole=nothing, rtol=1e-6, atol=1e-10)Reference Sommerfeld integral (TE, J0 channel) for source/observer above the substrate:
I_TE(ρ, Z) = ∫ k_ρ r_TE(k_ρ) J₀(k_ρ ρ) exp(i kz₁ Z) dk_ρ
where Z = z + z' > 0.
CoupledDipole.reflected_kernel_te_j2 — Method
reflected_kernel_te_j2(state, rho, zsum; pole=nothing, rtol=1e-6, atol=1e-10)Reference Sommerfeld integral (TE, J2 channel):
I_TE,2(ρ, Z) = ∫ k_ρ r_TE(k_ρ) J₂(k_ρ ρ) exp(i kz₁ Z) dk_ρ.
CoupledDipole.reflected_kernel_tm_j0 — Method
reflected_kernel_tm_j0(state, rho, zsum; pole=nothing, rtol=1e-6, atol=1e-10)Reference Sommerfeld integral (TM, J0 channel) for source/observer above the substrate:
I_TM(ρ, Z) = ∫ k_ρ r_TM(k_ρ) J₀(k_ρ ρ) exp(i kz₁ Z) dk_ρ
where Z = z + z' > 0.
This is a stage-A reference evaluator: direct contour integration with diagnostics, intended for correctness and algorithm development.
CoupledDipole.reflected_kernel_tm_j2 — Method
reflected_kernel_tm_j2(state, rho, zsum; pole=nothing, rtol=1e-6, atol=1e-10)Reference Sommerfeld integral (TM, J2 channel):
I_TM,2(ρ, Z) = ∫ k_ρ r_TM(k_ρ) J₂(k_ρ ρ) exp(i kz₁ Z) dk_ρ.
CoupledDipole.reflected_self_block_halfspace_prototype — Method
reflected_self_block_halfspace_prototype(state, r; tm_pole=nothing, te_pole=nothing, rtol=1e-6, atol=1e-10)Prototype reflected self-interaction dyadic block at point r above the substrate, evaluated through the reflected kernel only (z + z' = 2z).
This contribution is finite for z > 0 and excludes the free-space singular self term (which remains handled by existing radiative-reaction/polarizability prescriptions).
CoupledDipole.ricatti_bessel — Method
ricatti_bessel(x, nmax)Legacy alias re-exported from MieScattering.
CoupledDipole.scattered_field — Function
scattered_field(probe, k, n_medium, positions, sizes, rotations, P, Epsilon=missing; evaluate_inside=true)probe: SVector, point where the scattered EM field is to be evaluatedk: wavenumbern_medium: refractive index of mediumpositions: SVector of dipole positionssizes: SVector of dipole sizesrotations: SVector of particle rotation matricesP: 3Ndipx2Ninc matrix of self-consistent dipole momentsEpsilon: list of dielectric function inside each particle (for internal fields)evaluate_inside: logical, whether to compute the (unphysical) scattered field inside particles
Returns (Esca, Bsca, inside, id) where inside/id describe whether probe is inside one of the particles.
CoupledDipole.scattering_channels! — Method
scattering_channels!(Cup, Cdown, positions, ScatteringVectors, weights, kn, P)Prototype hemisphere-resolved scattering channels for each incident angle.
Cup integrates free-space far-field intensity over directions with n_z ≥ 0 (upper hemisphere), while Cdown integrates n_z < 0 (lower hemisphere), using the same quadrature and normalization as scattering!, so:
Cup + Cdown ≈ Csca.
CoupledDipole.scattering_channels — Method
scattering_channels(positions, ScatteringVectors, weights, kn, P)Allocate and return hemisphere-resolved prototype channels as a named tuple: (; upper, lower, total) with total = upper + lower.
CoupledDipole.scattering_channels_halfspace_prototype! — Method
scattering_channels_halfspace_prototype!(Cup, Cdown_trans, Cdown_raw, Closs,
positions, ScatteringVectors, weights, kn, P, n_upper, n_lower)Prototype interface-aware channel estimator using free-space angular dipole intensities with Fresnel transmission weighting on the lower hemisphere.
Cup: upper-hemisphere channel (unchanged from free-space angular intensity),Cdown_raw: raw lower-hemisphere channel from free-space angular intensity,Cdown_trans: lower channel weighted by average TE/TM Fresnel transmission,Closs: estimate of substrate-channel loss (Cdown_raw - Cdown_trans, clamped).
CoupledDipole.scattering_channels_halfspace_prototype — Method
scattering_channels_halfspace_prototype(positions, ScatteringVectors, weights, kn, P, n_upper, n_lower)Allocate and return prototype interface-aware channel estimates as a named tuple:
upper: upper-hemisphere channel,lower_transmitted: Fresnel-weighted lower channel estimate,lower_raw: unweighted lower channel,substrate_loss_estimate:max(lower_raw-lower_transmitted, 0),total_estimate:upper + lower_transmitted.
CoupledDipole.scattering_pattern — Method
scattering_pattern(probes, cl::Cluster, mat::Material, source; polarisation="linear", prescription="kuwata")
directions: array of SVectors, directions where the scattered EM field is to be evaluatedcl: cluster of particlesmat: dielectric functionssource: SVector of dipole source positionprescription: polarisability prescription for particles
example
φ = range(0,2π,36)
θ = range(0,π,18)
directions = SVector.(Iterators.product(φ, θ, 0.0))[:]
CoupledDipole.simulate_core_shell — Function
simulate_core_shell(rho_dye, tensor_type, position_type, wavelength, medium, R0, d, N_inc=36; kwargs...)Convenience wrapper that builds a shell cluster/material model and returns core-shell spectra as a dense matrix.
The returned matrix columns are: [cext, cabs, csca, dext, dabs, dsca, cdext, cdabs, cdsca], each normalized per shell dipole.
CoupledDipole.simulate_mie — Function
simulate_mie(rho_dye, R0, d, spacer, wavelength, medium, N_nmax=20, shell=false, mloc=false)Compute multilayer Mie-based shell cross-sections with optional local-field correction.
Returns an N_λ × 3 matrix with columns [cext, cabs, csca] / N_dye, built from coated-minus-bare multilayer Mie cross-sections.
When mloc=true, outputs are additionally divided by the multilayer MLocAve enhancement factor.
CoupledDipole.simulate_mixture — Function
simulate_mixture(proportion, rho_dye, uniaxiality, position_type, wavelength, medium, R0, d, N_inc=36; kwargs...)Build and simulate a two-species molecular shell mixture around a spherical core.
CoupledDipole.solve_fields — Method
solve_fields(k, positions, alpha_blocks, incident; method="direct",
interaction="pairwise", preconditioner="none", rtol=1e-8,
atol=0.0, restart=50, maxiter=300, rhs_strategy="sequential",
preconditioner_positions=nothing, preconditioner_rotation=nothing,
preconditioner_blocksize=32)Solve the homogeneous-host finite electric-dipole field equation. incident is a 3N x nrhs matrix; alpha_blocks contains local lab-frame 3x3 tensors. Return fields, polarizations, diagnostics and operator setup time. Direct LU uses private dense scratch; GMRES does not allocate a dense interaction matrix. FFT requires an axis-aligned xy Cartesian grid. Chan uses the mean local tensor as its reference response. Unsupported combinations and nonconvergence throw.
Preconditioners: "none", "chan" (FFT grid, or interaction="pairwise" with preconditioner_positions supplying the nominal grid for a position-disordered array), "nearfield" (block-Jacobi over contiguous storage-index groups of preconditioner_blocksize particles; geometry agnostic), and "circulant1d" (index-Toeplitz circulant in a frame co-rotating with preconditioner_rotation, e.g. RotZ(δ) for a uniform helix with angular step δ; identity when nothing). Preconditioners are built from primal values and never change the converged answer.
rhs_strategy="block" solves all right-hand sides with one shared block Arnoldi basis per restart cycle, evaluating each (pairwise) kernel sweep once for all columns; restart then counts block steps (memory ~(restart+1)*nrhs field vectors) and maxiter caps total block steps. Blocks at least as wide as the system (nrhs >= 3N) silently fall back to the sequential strategy.
GMRES: Saad & Schultz (1986), doi:10.1137/0907058, via IterativeSolvers.jl. Chan: doi:10.1137/0909051. See docs/src/finite_solvers.md for boundaries, autodiff support and dependency licences.
CoupledDipole.spectrum_coreshell_dipole — Method
spectrum_coreshell_dipole(cl, mat; kwargs...)Hybrid workflow that augments a shell cluster with an explicit core dipole and reports shell-normalized extinction/absorption observables.
Returns an N_λ × 3 matrix with columns: [cext, cabs, dabs] / N_shell, where dabs = cabs - cabs_core and cabs_core = 4πk·Im(tr(α_core))/3.
CoupledDipole.spectrum_coreshell_dispersion — Method
spectrum_coreshell_dispersion(cl, mat, Incidence; kwargs...)Compute wavelength-resolved cross-sections for a molecular shell around a spherical core for explicit incidence directions.
CoupledDipole.spectrum_coreshell_oa — Method
spectrum_coreshell_oa(cl, mat; kwargs...)Compute orientation-averaged core-shell spectra and related differential and dichroic observables.
Returns a named tuple with:
average::CrossSections(total shell-normalized response),differential::CrossSections(core-present minus bare-core response),dichroism::CrossSections(LCP-RCP orientation-averaged difference),dipole_absorption(shell-only absorption from coupled dipoles).
Key numerical controls:
N_mie: multipole truncation for sphere response expansions,N_esa: electrostatic asymptotic blending order for near-sphere dipole fields,N_theta: angular interpolation grid for sphere-mediated kernels,N_inc,N_sca: cubature orders for orientation and scattering integrals.
CoupledDipole.spectrum_dispersion_halfspace_channels_prototype — Method
spectrum_dispersion_halfspace_channels_prototype(cl, mat, Incidence; kwargs...)Prototype high-level helper returning wavelength-resolved cross-sections together with hemisphere-separated channel estimates in one call.
This helper follows spectrum_dispersion assembly/solve semantics and adds Fresnel-weighted lower-medium channel estimates through scattering_channels_halfspace_prototype.
CoupledDipole.spectrum_mixture — Method
spectrum_mixture(cl, mat; kwargs...)Compute spectra for mixed molecular shells around a core by delegating to the core-shell OA workflow.
CoupledDipole.spectrum_oa_analytical — Method
spectrum_oa(cl::Cluster, mat::Material,
Cubature = "gl", N_inc::Int = 36, N_sca::Int=36)Orientation-averaged far-field cross-sections for multiple wavelengths
cl: cluster of particlesmat: dielectric functionsCubature: spherical cubature methodN_inc: number of incident angles for spherical cubatureN_sca: number of scattering angles for spherical cubature estimate of σ_scaprescription: polarisability prescription for particlesmethod: solution of linear system (direct or iterative)
CoupledDipole.spheroid_ar — Method
spheroid_ar(a₀, χ)Convert equivalent-radius a₀ and aspect ratio χ = c/a to spheroid semiaxes (a, c) preserving volume.
CoupledDipole.spheroid_projected_area — Method
spheroid_projected_area(a₀, χ)Projected-area equivalent used in surface-density estimates for a spheroid parameterized by equivalent radius a₀ and aspect ratio χ.
CoupledDipole.vacuum_wavenumber — Method
vacuum_wavenumber(state)Return k0 = 2π/λ for a HalfSpaceOpticalState.