use pyo3::prelude::*;
use super::vector::PyVector3;
use crate::effect::InverseSpinHall;
#[pyclass(name = "InverseSpinHall")]
#[derive(Clone)]
pub struct PyInverseSpinHall {
inner: InverseSpinHall,
}
#[pymethods]
impl PyInverseSpinHall {
#[new]
pub fn new(theta_sh: f64, rho: f64) -> Self {
Self {
inner: InverseSpinHall { theta_sh, rho },
}
}
#[getter]
pub fn theta_sh(&self) -> f64 {
self.inner.theta_sh
}
#[getter]
pub fn rho(&self) -> f64 {
self.inner.rho
}
pub fn convert(&self, js_flow: &PyVector3, js_polarization: &PyVector3) -> PyVector3 {
let e_field = self.inner.convert(js_flow.inner(), js_polarization.inner());
PyVector3::from_inner(e_field)
}
pub fn voltage(
&self,
js_flow: &PyVector3,
js_polarization: &PyVector3,
strip_width: f64,
) -> f64 {
self.inner
.voltage(js_flow.inner(), js_polarization.inner(), strip_width)
}
pub fn efficiency(&self) -> f64 {
self.inner.efficiency()
}
#[staticmethod]
pub fn platinum() -> Self {
Self {
inner: InverseSpinHall::platinum(),
}
}
#[staticmethod]
pub fn tantalum() -> Self {
Self {
inner: InverseSpinHall::tantalum(),
}
}
#[staticmethod]
pub fn tungsten() -> Self {
Self {
inner: InverseSpinHall::tungsten(),
}
}
pub fn __repr__(&self) -> String {
format!(
"InverseSpinHall(theta_sh={:.3}, rho={:.2e})",
self.inner.theta_sh, self.inner.rho
)
}
}
impl PyInverseSpinHall {
#[allow(dead_code)]
pub fn inner(&self) -> &InverseSpinHall {
&self.inner
}
}