20 complex_t checkForUnderflow(complex_t val)
22 return std::abs(val.imag()) < 1e-80 && val.real() < 0 ? complex_t(val.real(), 1e-40) : val;
25 std::pair<SpinMatrix, SpinMatrix> computeRoughnessMatrices(
const MatrixFlux& coeff_i,
31 auto roughness_matrix = [sigma, &coeff_i, &coeff_i1, beta_i, beta_i1](
double sign) {
34 auto b_p_vec = beta_i1 * coeff_i1.
m_b + sign * beta_i * coeff_i.
m_b;
36 auto square = [](
auto& v) {
return v.x() * v.x() + v.y() * v.y() + v.z() * v.z(); };
37 complex_t beta_p = std::sqrt(checkForUnderflow(square(b_p_vec)));
40 const complex_t alpha_pp = -(alpha_p * alpha_p + beta_p * beta_p) * sigma * sigma / 8.;
41 const complex_t beta_pp = -alpha_p * beta_p * sigma * sigma / 4.;
43 const complex_t factor1 = std::sqrt(2. * (1. + b_p_vec.z()));
44 const complex_t factor2 = std::sqrt(2. * (1. - b_p_vec.z()));
45 SpinMatrix QL((b_p_vec.z() + 1.) / factor1, (b_p_vec.z() - 1.) / factor2,
46 (b_p_vec.x() + I * b_p_vec.y()) / factor1,
47 (b_p_vec.x() + I * b_p_vec.y()) / factor2);
48 SpinMatrix QR((b_p_vec.z() + 1.) / factor1, (b_p_vec.x() - I * b_p_vec.y()) / factor1,
49 (b_p_vec.z() - 1.) / factor2, (b_p_vec.x() - I * b_p_vec.y()) / factor2);
51 const SpinMatrix exp1(std::exp(alpha_pp), 0, 0, std::exp(alpha_pp));
53 if (std::abs(beta_p) > std::numeric_limits<double>::epsilon() * 10.) {
54 SpinMatrix exp2(std::exp(beta_pp), 0, 0, std::exp(-beta_pp));
61 const SpinMatrix roughness_sum = roughness_matrix(1.);
62 const SpinMatrix roughness_diff = roughness_matrix(-1.);
64 return {roughness_sum, roughness_diff};
76 const auto ret = computeRoughnessMatrices(coeff_i, coeff_i1, sigma);
77 roughness_sum = std::get<0>(ret);
78 roughness_diff = std::get<1>(ret);
Defines class MatrixFlux.
Defines namespace MagneticNevotCroceTransition.
Specular reflection and transmission coefficients in a layer in case of magnetic interactions between...
SpinMatrix computeP() const
Spinor m_lambda
eigenvalues for wave propagation
SpinMatrix computeInverseP() const
R3 m_b
unit magnetic field vector
std::pair< SpinMatrix, SpinMatrix > backwardsSubmatrices(const MatrixFlux &coeff_i, const MatrixFlux &coeff_i1, double sigma)