Chiral dimer of gold nanorods

This example considers the "fingers-crossed" configuration of two gold nanorods arranged in a chiral dimer, with a pi/4 dihedral angle. The dipole-dipole interaction leads to circular dichroism with a characteristic bisignate lineshape.

using CoupledDipole
using DataFrames
using VegaLite


## materials
wavelength = collect(450:2:850.0)
media = Dict([("Au", epsilon_Au), ("medium", x -> 1.33)])
mat = Material(wavelength, media)

## dimer geometry
cl0 = cluster_single(20, 20, 40)
cl1 = cluster_dimer(80, 20, 20, 40, π/4)
Cluster{Float64, Float64, Int64}(SVector{3, Float64}[[0.0, -40.0, 0.0], [0.0, 40.0, 0.0]], Rotations.QuatRotation{Float64}[[1.0 0.0 0.0; 0.0 1.0 0.0; 0.0 0.0 1.0], [0.7071067811865475 0.0 0.7071067811865476; 0.0 1.0 0.0; -0.7071067811865476 0.0 0.7071067811865475]], SVector{3, Int64}[[20, 20, 40], [20, 20, 40]], ["Au", "Au"], "particle")

The following lines simulate the orientation-averaged optical response,

oa0 = spectrum_oa(cl0, mat)
oa1 = spectrum_oa(cl1, mat)
(average = CoupledDipole.CrossSections{Float64}([3492.7455678170463, 3489.2759312756325, 3487.191948976689, 3486.5842766774626, 3487.5436103518323, 3490.1603103945426, 3494.5239353642323, 3500.722661449714, 3508.842559600604, 3518.966697590924  …  245.7288426045277, 241.8676138081776, 238.1009266591927, 234.42558818417416, 230.83854252705473, 227.33686386140843, 223.91774972804848, 220.57851476900944, 217.31658483119625, 214.12949141498717], [3074.8498218254463, 3076.0694669658706, 3078.337069650578, 3081.719485584246, 3086.283010845897, 3092.092957441596, 3099.213139385335, 3107.7052487307296, 3117.6280975244276, 3129.036697929087  …  94.52529168237582, 93.14529270606451, 91.80116409824564, 90.49158392935931, 89.21529159943906, 87.97108446636412, 86.75781468659565, 85.5743862533614, 84.41975221843254, 83.29291208471204], [417.8547117136732, 413.16657394161143, 408.8160475543907, 404.8269333958265, 401.2236320010634, 398.031192222757, 395.27535886763815, 392.98261610531245, 391.18022261956855, 389.8962335231291  …  151.20389963745006, 148.72266206889316, 146.30009599088467, 143.93433035260162, 141.62356989123228, 139.36609141602042, 137.16024030511628, 135.00442720136232, 132.89712489415504, 130.83686537544955]), dichroism = CoupledDipole.CrossSections{Float64}([42.38643884277198, 42.22440559713405, 42.11790447714533, 42.06733213492995, 42.07310284912556, 42.13571266084484, 42.255808072058045, 42.43426043179411, 42.67224753088325, 42.97134436126001  …  7.343552256564735, 7.202304612206875, 7.064129118102895, 6.928963097766674, 6.796743978555319, 6.6674094496267955, 6.540897599202057, 6.417147033388628, 6.29609697858119, 6.177687369240638], [10.491046334416838, 10.632564687589028, 10.789255258915345, 10.957717104134602, 11.134383903384407, 11.315544723254922, 11.497363745693082, 11.675899711147524, 11.847126204251007, 12.006954356179811  …  -4.170971079128536, -4.068337103046255, -3.9693728693147627, -3.8739089516665004, -3.7817853789054285, -3.692851021912035, -3.606963025640224, -3.523986282434467, -3.443792943325302, -3.366261964254881], [31.89910636502521, 31.595811353206702, 31.332892622785923, 31.114147865499362, 30.94355796829803, 30.82533040118067, 30.76394819981359, 30.76422492093232, 30.83136596284655, 30.97103663274411  …  11.513745091653902, 11.269884695338106, 11.032765503400245, 10.802155439322727, 10.57783198433928, 10.359581722456753, 10.147199909770336, 9.940490066656881, 9.739263591520585, 9.543339394844532]))

From there we combine the cross-sections in long-format dataframes for plotting,

d0 = oa_df(oa0, mat.wavelengths)
d1 = oa_df(oa1, mat.wavelengths)

d = [insertcols!(d1, :cluster => "dimer");
     insertcols!(d0, :cluster => "single")]

d |> @vlplot(
 width= 400,
 height =  300,
     mark = {:line},
     row = "type",
     resolve={scale={y="independent"}},
     encoding = {x = "wavelength:q", y = "value:q", color = "variable:n", strokeDash="cluster:n"}
 )