26 const Eigen::Matrix2cd Unit_Matrix(Eigen::Matrix2cd::Identity());
31 const Eigen::Matrix2cd Pauli_X((Eigen::Matrix2cd() << 0, 1, 1, 0).finished());
32 const Eigen::Matrix2cd Pauli_Y((Eigen::Matrix2cd() << 0, -I, I, 0).finished());
33 const Eigen::Matrix2cd Pauli_Z((Eigen::Matrix2cd() << 1, 0, 0, -1).finished());
37 Eigen::Matrix2cd MaterialUtils::MagnetizationCorrection(complex_t unit_factor,
38 double magnetic_factor,
41 Eigen::Matrix2cd result =
42 unit_factor * Unit_Matrix
44 * (Pauli_X * polarization[0] + Pauli_Y * polarization[1] + Pauli_Z * polarization[2]);
49 template Eigen::Matrix2cd MaterialUtils::MagnetizationCorrection(complex_t unit_factor,
50 double magnetic_factor,
52 template Eigen::Matrix2cd MaterialUtils::MagnetizationCorrection(complex_t unit_factor,
53 double magnetic_factor,
58 return n * n - n_ref * n_ref * k.
sin2Theta();
64 Eigen::Matrix2cd result;
65 double factor = magnetic_prefactor / k.
mag2();
67 return MagnetizationCorrection(unit_factor, factor, b_field);
72 MATERIAL_TYPES result = MATERIAL_TYPES::RefractiveMaterial;
73 bool isDefault =
true;
74 for (
const Material* mat : materials) {
76 result = mat->typeID();
77 isDefault = mat->isDefaultMaterial();
80 if (mat->typeID() != result && !mat->isDefaultMaterial())
81 return MATERIAL_TYPES::InvalidMaterialType;
Declares functions in namespace MaterialUtils.
Defines the values of physical constants (SI)
constexpr double g_factor_n
neutron g-factor
constexpr double h_bar
Reduced Plank constant, J s.
constexpr double m_n
Neutron mass, kg.
constexpr double mu_N
Nuclear magneton ( ), J/T.
Forked from CLHEP/Geometry by E.
double mag2() const
Returns magnitude squared of the vector.
double sin2Theta() const
Returns squared sine of polar angle.
A wrapper for underlying material implementation.
MATERIAL_TYPES checkMaterialTypes(const std::vector< const Material * > &materials)
Checks if all non-default materials in materials are of the same type and returns this type.
complex_t ScalarReducedPotential(complex_t n, kvector_t k, double n_ref)
Function for calculating the reduced potential, used for obtaining the Fresnel coefficients (non-pola...
Eigen::Matrix2cd PolarizedReducedPotential(complex_t n, kvector_t b_field, kvector_t k, double n_ref)
Function for calculating the reduced potential, used for obtaining the Fresnel coefficients (polarize...