Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
baptiste committed Nov 21, 2022
1 parent b61518e commit b2a305b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
14 changes: 10 additions & 4 deletions dev/book/dimer_linear.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ using FastGaussQuadrature
using DataFrames
using VegaLite

using AlgebraOfGraphics, CairoMakie



# dimer_model <- function(d, orientation = c("head-to-tail", "side-by-side"),
Expand Down Expand Up @@ -95,10 +97,16 @@ wavelength = collect(450:2:850.0)
media = Dict([("Au", epsilon_Au), ("medium", x -> 1.33)])
mat = Material(wavelength, media)

sizes = [SVector(0.0, 0.0, 0.0)]
positions = [SVector(0.0, 0.0, 0.0)]
# input parameters are Euler angles
rotations = [UnitQuaternion(RotZYZ(0.0, 0.0, 0.0))]
Cluster(positions, rotations, sizes, ["Au"], "particle")

cl0 = cluster_single(20.0, 50.0, 20.0)
# cl0 = cluster_single(50.0, 20.0, 20.0)
# s = spectrum_dispersion(cl0, mat, [UnitQuaternion(RotZ(0.0))])
s = spectrum_dispersion(cl0, mat, [SVector(0.0, 0.0, 0.0)])

s = spectrum_dispersion(cl0, mat, [UnitQuaternion(RotZ(0.0))])
single = dispersion_df(s, mat.wavelengths)


Expand All @@ -119,8 +127,6 @@ draw(layer * xy, facet=(; linkyaxes=:none))
# encoding = {x = "wavelength:q", y = "value:q", color = "d:n", strokeDash = "cluster:n"}
# )

using AlgebraOfGraphics, CairoMakie

# set_aog_theme!()


Expand Down
8 changes: 4 additions & 4 deletions src/Clusters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function cluster_single(a, b, c, α=0.0, β=0.0, γ=0.0, material="Au", type="pa
sizes = [SVector(a, b, c)]
positions = [SVector(0.0, 0.0, 0.0)]
# input parameters are Euler angles
rotations = [UnitQuaternion(RotZYZ([α, β, γ]))]
rotations = [Rotations.UnitQuaternion(Rotations.RotZYZ(α, β, γ))]
Cluster(positions, rotations, sizes, [material], type)
end

Expand Down Expand Up @@ -159,7 +159,7 @@ cluster_line(3, 500, 20, 20, 30, 0, 0, 0)
function cluster_line(N, Λ, a, b, c, α=0.0, β=0.0, γ=0.0, material="Au", type="particle")

sizes = [SVector(a, b, c) for ii in 1:N] # identical particles
rotations = [UnitQuaternion(RotZYZ([α, β, γ])) for _ 1:N] # identical particles
rotations = [UnitQuaternion(RotZYZ(α, β, γ)) for _ 1:N] # identical particles

positions = SVector.(-(N - 1)*Λ/2:Λ:(N-1)*Λ/2, zero(eltype(Λ)), zero(eltype(Λ)))

Expand Down Expand Up @@ -192,7 +192,7 @@ function cluster_array(N, Λ, a, b, c, α=0.0, β=0.0, γ=0.0, material="Au", ty
N = N′^2 # actual number, may have fewer than original N particles

sizes = [SVector(a, b, c) for _ 1:N] # identical particles
rotations = [UnitQuaternion(RotZYZ([α, β, γ])) for _ 1:N] # identical particles
rotations = [UnitQuaternion(RotZYZ(α, β, γ)) for _ 1:N] # identical particles

x = -(N′ - 1)*Λ/2:Λ:(N′-1)*Λ/2
positions = SVector.(Iterators.product(x, x, zero(eltype(x))))[:]
Expand Down Expand Up @@ -245,7 +245,7 @@ function cluster_shell(N, a, b, c, R; orientation="radial", material="Rhodamine"

end

quaternions = [UnitQuaternion(RotZYZ([r[1], r[2], r[3]])) for r in rotations]
quaternions = [UnitQuaternion(RotZYZ(r[1], r[2], r[3])) for r in rotations]

Cluster(positions, inv.(quaternions), sizes, [material for _ 1:N], type)

Expand Down
4 changes: 2 additions & 2 deletions src/HighLevel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ function spectrum_dispersion(
# store all rotation matrices
# ParticleRotations = map(euler_passive, cl.angles)
ParticleRotations = map(RotMatrix, cl.rotations) # now (active) Rotation objects
IncidenceRotations = map(euler_active, Incidence) # old Euler, no longer needed
#IncidenceRotations = map(RotMatrix, Incidence) # now given as quaternions
# IncidenceRotations = map(euler_active, Incidence) # old Euler, no longer needed
IncidenceRotations = map(RotMatrix, Incidence) # now given as quaternions
ScatteringVectors = map(euler_unitvector, quad_sca.nodes)
# NOTE: we only need the third column to rotate kz, should specialise

Expand Down
2 changes: 1 addition & 1 deletion src/Materials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ function alpha_kuwata(λ, ε, ε_m, Size)

V = 4π / 3 * prod(Size)
x = @. 2π / λ * Size
χ = depolarisation_spheroid(Size...)
χ = depolarisation_ellipsoid(Size...)

A = @. -0.4865 * χ - 1.046 * χ^2 + 0.8481 * χ^3
B = @. 0.01909 * χ + 0.19999 * χ^2 + 0.6077 * χ^3
Expand Down

0 comments on commit b2a305b

Please sign in to comment.