use super::*;
use crate::utils::from_celsius_to_kelvin;
use dim::{
f64prefixes::MICRO,
ucum::{self, K, M},
};
pub const META: CrystalMeta = CrystalMeta {
id: "AgGaSe2_1",
name: "AgGaSe2 Ref 1",
reference_url: "https://www.sciencedirect.com/science/article/pii/0030401873903167",
axis_type: OpticAxisType::NegativeUniaxial,
point_group: PointGroup::HM_3m,
transmission_range: Some(ValidWavelengthRange(1_000e-9, 13_500e-9)),
temperature_dependence_known: true,
};
const DNX: f64 = 15e-5;
const DNY: f64 = DNX;
const DNZ: f64 = 15e-5;
#[allow(clippy::unreadable_literal)]
pub fn get_indices(wavelength: Wavelength, temperature: ucum::Kelvin<f64>) -> Indices {
let lambda = wavelength / (MICRO * M);
let mut nx = (3.9362
+ 2.9113 / (1.0 - (0.38821 / lambda).powi(2))
+ 1.7954 / (1.0 - (40.0 / lambda).powi(2)))
.sqrt();
let mut ny = nx;
let mut nz = (3.3132
+ 3.3616 / (1.0 - (0.38201 / lambda).powi(2))
+ 1.7677 / (1.0 - (40.0 / lambda).powi(2)))
.sqrt();
let f = *((temperature - from_celsius_to_kelvin(20.0)) / K);
nx += f * DNX;
ny += f * DNY;
nz += f * DNZ;
Indices::new(na::Vector3::new(nx, ny, nz))
}