begin
    import Pkg
    Pkg.activate(joinpath(@__DIR__, ".."))
    using CoupledDipole
    using CairoMakie
    using Rotations
end

Coupled uniaxial dye molecules

For point dipoles the material function returns a polarisability, not a dielectric function. The sizes (0, 0, 1) select a uniaxial molecular response; they do not describe an ellipsoidal particle. Compare an isolated molecule with a side-by-side pair separated by 0.8 nm in water.

The wave propagates along x, so one of its transverse polarisations excites the molecular z axis. Molecular scattering is tiny compared with absorption. Cross-sections are reported per molecule in nm^2.

begin
    wavelengths = collect(400.0:5.0:700.0)
    material = Material(wavelengths,
        Dict("Rhodamine" => alpha_lorentzmolecule, "medium" => λ -> 1.33))
    single = cluster_single(0, 0, 1, 0, 0, 0, "Rhodamine", PointDipole())
    pair = cluster_dimer(0.8, 0, 0, 1, 0, 0, 0, "Rhodamine", PointDipole())
    incidence = [RotY(π / 2)]
end
1-element Vector{RotY{Float64}}:
 [6.123233995736766e-17 0.0 1.0; 0.0 1.0 0.0; -1.0 0.0 6.123233995736766e-17]
begin
    isolated = spectrum_dispersion(single, material, incidence)
    coupled = spectrum_dispersion(pair, material, incidence)
    @assert size(coupled.extinction) == (length(wavelengths), 2)
    @assert all(isfinite, coupled.extinction)
end
let
    fig = Figure(size=(650, 350))
    ax = Axis(fig[1, 1], xlabel="Wavelength / nm", ylabel="Extinction / nm^2")
    lines!(ax, wavelengths, isolated.extinction[:, 1]; label="single")
    lines!(ax, wavelengths, coupled.extinction[:, 1]; label="pair")
    axislegend(ax)
    fig
end