use ndarray::Array1;
use refeff_core::SfconvSo2convMaterialInput;
use crate::chi_dat::ChiDatData;
use crate::xmu_dat::XmuDatData;
pub const SFCONV_SO2CONV_CONVOLUTED_MARKER: &str = "# Convoluted with A(omega).";
#[derive(Debug, Clone, PartialEq)]
pub struct SfconvInput {
pub control: SfconvControl,
pub window: SfconvWindow,
pub spectrum: SfconvSpectrum,
pub cfname: String,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct SfconvControl {
pub msfconv: i32,
pub ipse: i32,
pub ipsk: i32,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct SfconvWindow {
pub wsigk: f64,
pub cen: f64,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct SfconvSpectrum {
pub ispec: i32,
pub ipr6: i32,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SfconvSo2convTargetKind {
Chi,
Xmu,
FeffPath,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SfconvSo2convTarget {
pub file_name: String,
pub kind: SfconvSo2convTargetKind,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct SfconvSo2convHeader {
pub material: SfconvSo2convMaterialInput,
pub already_convoluted: bool,
}
#[derive(Debug, Clone, PartialEq)]
pub enum SfconvSo2convTargetData {
Xmu {
header: SfconvSo2convHeader,
data: XmuDatData,
},
Chi {
header: SfconvSo2convHeader,
data: ChiDatData,
},
FeffPath {
header: SfconvSo2convHeader,
data: SfconvSo2convFeffPathData,
},
}
#[derive(Debug, Clone, PartialEq)]
pub struct SfconvSo2convFeffPathData {
pub header_lines: Vec<String>,
pub leg_count: usize,
pub degeneracy: f64,
pub effective_half_path_length_angstrom: f64,
pub wave_number_inverse_angstrom: Array1<f64>,
pub central_phase: Array1<f64>,
pub effective_amplitude: Array1<f64>,
pub effective_phase: Array1<f64>,
pub reduction_factor: Array1<f64>,
pub mean_free_path_angstrom: Array1<f64>,
pub real_momentum_inverse_angstrom: Array1<f64>,
}
impl SfconvSo2convTargetData {
#[must_use]
pub fn header(&self) -> SfconvSo2convHeader {
match self {
Self::Xmu { header, .. } | Self::Chi { header, .. } | Self::FeffPath { header, .. } => {
*header
}
}
}
#[must_use]
pub fn point_count(&self) -> usize {
match self {
Self::Xmu { data, .. } => data.point_count(),
Self::Chi { data, .. } => data.point_count(),
Self::FeffPath { data, .. } => data.point_count(),
}
}
}
impl SfconvSo2convFeffPathData {
#[must_use]
pub fn point_count(&self) -> usize {
self.wave_number_inverse_angstrom.len()
}
}