use spintronics::prelude::*;
fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
println!("=============================================================");
println!(" Experimental Validation: Landmark Spintronics Papers");
println!("=============================================================");
let tolerance = 0.30_f64;
println!("\n--- Section 1: Demidov et al. PRL 96, 097202 (2006) ---\n");
let demidov = Demidov2006Validation::new()?;
println!(" Paper: BLS of Damon-Eshbach in 5-µm YIG / H = 1000 Oe");
println!(" Wavevectors probed: {} pts", demidov.k_values().len());
let disp = demidov.validate_dispersion(tolerance)?;
println!("\n DISPERSION ω(k):");
println!(
" Max relative error: {:.2} %",
disp.max_relative_error * 100.0
);
println!(
" Mean relative error: {:.2} %",
disp.mean_relative_error * 100.0
);
println!(
" Pass (tol = {}%)?: {}",
(tolerance * 100.0) as i32,
disp.passed
);
let nonrec = demidov.validate_nonreciprocity(tolerance)?;
println!("\n NON-RECIPROCITY Δω/ω:");
println!(
" Max relative error: {:.2} %",
nonrec.max_relative_error * 100.0
);
println!(
" Mean relative error: {:.2} %",
nonrec.mean_relative_error * 100.0
);
println!(
" Pass (tol = {}%)?: {}",
(tolerance * 100.0) as i32,
nonrec.passed
);
println!("\n--- Section 2: Saitoh et al. APL 88, 182509 (2006) ---\n");
let saitoh = Saitoh2006Validation::new()?;
println!(" Paper: ISHE voltage in Pt/Permalloy bilayer at FMR");
let theta_tol = 50.0_f64;
let sha = saitoh.validate_spin_hall_angle(theta_tol)?;
println!(
"\n SPIN HALL ANGLE (literature range {}–{}):",
spintronics::validation::experimental::saitoh_2006::THETA_SH_LITERATURE_MIN,
spintronics::validation::experimental::saitoh_2006::THETA_SH_LITERATURE_MAX
);
println!(
" Distance from window: {:.3} ({:.1}× the window centre)",
sha.mean_relative_error, sha.mean_relative_error
);
println!(" Pass (tol = {})?: {}", theta_tol, sha.passed);
let polarity = saitoh.validate_ishe_voltage_polarity()?;
println!("\n ISHE POLARITY (J_s × σ direction):");
println!(" E_ISHE has correct sign?: {polarity}");
let scaling = saitoh.validate_ishe_scaling(&[1.0e3, 5.0e3, 1.0e4, 5.0e4, 1.0e5], tolerance)?;
println!("\n ISHE LINEAR SCALING in J_s:");
println!(
" Max relative error: {:.2} %",
scaling.max_relative_error * 100.0
);
println!(" Pass (linear)?: {}", scaling.passed);
println!("\n--- Section 3: Uchida et al. Nature 455, 778 (2008) ---\n");
let uchida = Uchida2008Validation::new()?;
println!(" Paper: LSSE V_ISHE vs ΔT in Pt/YIG bilayer");
let lin = uchida.validate_linear_thermal_response(tolerance)?;
println!("\n LINEAR V_LSSE(ΔT) RESPONSE:");
println!(
" Max relative error: {:.2} %",
lin.max_relative_error * 100.0
);
println!(
" Mean relative error: {:.2} %",
lin.mean_relative_error * 100.0
);
println!(
" Pass (tol = {}%)?: {}",
(tolerance * 100.0) as i32,
lin.passed
);
let polarity_lsse = uchida.validate_polarity()?;
println!("\n LSSE POLARITY (sign convention):");
println!(" V_LSSE has correct sign for canonical orientation?: {polarity_lsse}");
let order = uchida.validate_seebeck_coefficient_order()?;
println!("\n SEEBECK COEFFICIENT ORDER (expected ~ µV/K - nV/K range):");
println!(" Order of magnitude reasonable?: {order}");
println!("\n--- Section 4: Validation Summary ---\n");
let entries: &[(&str, bool)] = &[
("Demidov 2006: DE dispersion ", disp.passed),
("Demidov 2006: DE non-reciprocity ", nonrec.passed),
("Saitoh 2006: spin Hall angle window", sha.passed),
("Saitoh 2006: ISHE polarity ", polarity),
("Saitoh 2006: linear J_s scaling ", scaling.passed),
("Uchida 2008: linear V_LSSE(ΔT) ", lin.passed),
("Uchida 2008: LSSE polarity ", polarity_lsse),
("Uchida 2008: Seebeck order-of-mag ", order),
];
let n_pass = entries.iter().filter(|&&(_, p)| p).count();
let n_total = entries.len();
println!(" {:<40} Status", "Test");
println!(" {}", "-".repeat(48));
for &(name, passed) in entries.iter() {
let status = if passed { "✓ PASS" } else { "✗ fail" };
println!(" {name} {status}");
}
println!("\n Overall: {n_pass}/{n_total} checks passed.");
println!("\n=============================================================");
println!(" Done. Three landmark spintronics papers validated against the");
println!(" simulation; relative errors quoted as quantitative reproducibility.");
println!("=============================================================\n");
Ok(())
}