BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
MatrixFlux Class Reference

Description

Specular reflection and transmission coefficients in a layer in case of magnetic interactions between the scattered particle and the layer.

Definition at line 32 of file MatrixFlux.h.

Inheritance diagram for MatrixFlux:
[legend]
Collaboration diagram for MatrixFlux:
[legend]

Public Member Functions

 MatrixFlux (double kz_sign, const Spinor &eigenvalues, const R3 &b, double magnetic_SLD)
 
SpinMatrix computeDeltaMatrix (double thickness)
 
SpinMatrix computeInverseP () const
 
SpinMatrix computeP () const
 
Spinor getKz () const override
 Returns z-part of the two wavevector eigenmodes. More...
 
SpinMatrix getReflectionMatrix () const
 
double magneticSLD () const
 
Spinor R1min () const override
 
Spinor R1plus () const override
 
Spinor R2min () const override
 
Spinor R2plus () const override
 
Spinor T1min () const override
 
Spinor T1plus () const override
 The following functions return the transmitted and reflected amplitudes for different incoming beam polarizations and eigenmodes. More...
 
Spinor T2min () const override
 
Spinor T2plus () const override
 

Public Attributes

R3 m_b
 unit magnetic field vector More...
 
Spinor m_lambda
 eigenvalues for wave propagation More...
 
SpinMatrix m_R
 
SpinMatrix m_T
 

Private Member Functions

SpinMatrix pMatrixHelper (double sign) const
 
SpinMatrix T1Matrix () const
 
SpinMatrix T2Matrix () const
 
SpinMatrix TransformationMatrix (const Spinor &selection) const
 

Private Attributes

double m_kz_sign
 
double m_magnetic_SLD
 wave propagation direction (-1 for direct one, 1 for time reverse) More...
 

Constructor & Destructor Documentation

◆ MatrixFlux()

MatrixFlux::MatrixFlux ( double  kz_sign,
const Spinor eigenvalues,
const R3 &  b,
double  magnetic_SLD 
)

Definition at line 32 of file MatrixFlux.cpp.

33  : m_lambda(std::move(eigenvalues))
34  , m_T(+1, 0, 0, +1)
35  , m_R(-1, 0, 0, -1)
36  , m_b(b)
37  , m_kz_sign(kz_sign)
38  , m_magnetic_SLD(magnetic_SLD)
39 {
40  ASSERT(std::abs(m_b.mag() - 1) < eps || (m_b.mag() < eps && magnetic_SLD < eps));
41 }
#define ASSERT(condition)
Definition: Assert.h:45
double m_magnetic_SLD
wave propagation direction (-1 for direct one, 1 for time reverse)
Definition: MatrixFlux.h:64
Spinor m_lambda
eigenvalues for wave propagation
Definition: MatrixFlux.h:55
SpinMatrix m_T
Definition: MatrixFlux.h:58
SpinMatrix m_R
Definition: MatrixFlux.h:59
double m_kz_sign
Definition: MatrixFlux.h:63
R3 m_b
unit magnetic field vector
Definition: MatrixFlux.h:60

References ASSERT, and m_b.

Member Function Documentation

◆ computeDeltaMatrix()

SpinMatrix MatrixFlux::computeDeltaMatrix ( double  thickness)

Definition at line 146 of file MatrixFlux.cpp.

147 {
148  const complex_t alpha = 0.5 * thickness * (m_lambda.v + m_lambda.u);
149 
150  // Compute resulting phase matrix according to exp(i p_m d_m) = exp1 * Q * exp2 * Q.adjoint();
151  if (std::abs(m_b.mag() - 1.) < eps) {
152  const SpinMatrix exp2(GetImExponential(m_kz_sign * thickness * m_lambda.v), 0, 0,
153  GetImExponential(m_kz_sign * thickness * m_lambda.u));
154  const double factor1 = 2. * (1. + m_b.z());
155  SpinMatrix Q((1. + m_b.z()), (I * m_b.y() - m_b.x()), (m_b.x() + I * m_b.y()),
156  (m_b.z() + 1.));
157 
158  return Q * exp2 * Q.adjoint() / factor1;
159  }
160  if (m_b.mag() < eps)
161  return SpinMatrix::One() * GetImExponential(m_kz_sign * alpha);
162 
163  throw std::runtime_error("Broken magnetic field vector");
164 }
static SpinMatrix One()
Definition: SpinMatrix.cpp:36
complex_t v
Definition: Spinor.h:31
complex_t u
Definition: Spinor.h:31

References SpinMatrix::adjoint(), m_b, m_kz_sign, m_lambda, SpinMatrix::One(), Spinor::u, and Spinor::v.

Here is the call graph for this function:

◆ computeInverseP()

SpinMatrix MatrixFlux::computeInverseP ( ) const

Definition at line 132 of file MatrixFlux.cpp.

133 {
134  const complex_t alpha = m_lambda.v + m_lambda.u;
135  const complex_t beta = m_lambda.v - m_lambda.u;
136 
137  if (std::abs(alpha * alpha - beta * beta) == 0.)
138  return SpinMatrix();
139 
140  SpinMatrix result = pMatrixHelper(-1.);
141  result *= 2. / (alpha * alpha - beta * beta);
142 
143  return result;
144 }
SpinMatrix pMatrixHelper(double sign) const
Definition: MatrixFlux.cpp:113
double beta(double z, double w)

References ROOT::Math::Cephes::beta(), m_lambda, pMatrixHelper(), Spinor::u, and Spinor::v.

Referenced by Compute::MagneticNevotCroceTransition::backwardsSubmatrices(), and Compute::TransitionMagneticTanh::backwardsSubmatrices().

Here is the call graph for this function:

◆ computeP()

SpinMatrix MatrixFlux::computeP ( ) const

Definition at line 124 of file MatrixFlux.cpp.

125 {
126  SpinMatrix result = pMatrixHelper(1.);
127  result *= 0.5;
128 
129  return result;
130 }

References pMatrixHelper().

Referenced by Compute::MagneticNevotCroceTransition::backwardsSubmatrices(), and Compute::TransitionMagneticTanh::backwardsSubmatrices().

Here is the call graph for this function:

◆ getKz()

Spinor MatrixFlux::getKz ( ) const
overridevirtual

Returns z-part of the two wavevector eigenmodes.

Implements IFlux.

Definition at line 108 of file MatrixFlux.cpp.

109 {
110  return m_kz_sign * m_lambda;
111 }

References m_kz_sign, and m_lambda.

◆ getReflectionMatrix()

SpinMatrix MatrixFlux::getReflectionMatrix ( ) const
inline

Definition at line 55 of file MatrixFlux.h.

55 { return m_R; };

References m_R.

◆ magneticSLD()

double MatrixFlux::magneticSLD ( ) const
inline

Definition at line 48 of file MatrixFlux.h.

48 { return m_magnetic_SLD; }

References m_magnetic_SLD.

◆ pMatrixHelper()

SpinMatrix MatrixFlux::pMatrixHelper ( double  sign) const
private

Definition at line 113 of file MatrixFlux.cpp.

114 {
115  const complex_t alpha = m_lambda.v + m_lambda.u;
116  const complex_t beta = m_lambda.v - m_lambda.u;
117 
118  SpinMatrix result(alpha + sign * beta * m_b.z(), sign * beta * (m_b.x() - I * m_b.y()),
119  sign * beta * (m_b.x() + I * m_b.y()), alpha - sign * beta * m_b.z());
120 
121  return m_kz_sign * result;
122 }

References ROOT::Math::Cephes::beta(), m_b, m_kz_sign, m_lambda, Spinor::u, and Spinor::v.

Referenced by computeInverseP(), and computeP().

Here is the call graph for this function:

◆ R1min()

Spinor MatrixFlux::R1min ( ) const
overridevirtual

Implements IFlux.

Definition at line 93 of file MatrixFlux.cpp.

94 {
95  return T1Matrix() * m_R.col1();
96 }
SpinMatrix T1Matrix() const
Definition: MatrixFlux.cpp:58
Spinor col1() const
Definition: SpinMatrix.cpp:160

References SpinMatrix::col1(), m_R, and T1Matrix().

Here is the call graph for this function:

◆ R1plus()

Spinor MatrixFlux::R1plus ( ) const
overridevirtual

Implements IFlux.

Definition at line 73 of file MatrixFlux.cpp.

74 {
75  return T1Matrix() * m_R.col0();
76 }
Spinor col0() const
Definition: SpinMatrix.cpp:155

References SpinMatrix::col0(), m_R, and T1Matrix().

Here is the call graph for this function:

◆ R2min()

Spinor MatrixFlux::R2min ( ) const
overridevirtual

Implements IFlux.

Definition at line 103 of file MatrixFlux.cpp.

104 {
105  return T2Matrix() * m_R.col1();
106 }
SpinMatrix T2Matrix() const
Definition: MatrixFlux.cpp:63

References SpinMatrix::col1(), m_R, and T2Matrix().

Here is the call graph for this function:

◆ R2plus()

Spinor MatrixFlux::R2plus ( ) const
overridevirtual

Implements IFlux.

Definition at line 83 of file MatrixFlux.cpp.

84 {
85  return T2Matrix() * m_R.col0();
86 }

References SpinMatrix::col0(), m_R, and T2Matrix().

Here is the call graph for this function:

◆ T1Matrix()

SpinMatrix MatrixFlux::T1Matrix ( ) const
private

Definition at line 58 of file MatrixFlux.cpp.

59 {
60  return TransformationMatrix({0., 1.});
61 }
SpinMatrix TransformationMatrix(const Spinor &selection) const
Definition: MatrixFlux.cpp:43

References TransformationMatrix().

Referenced by R1min(), R1plus(), T1min(), and T1plus().

Here is the call graph for this function:

◆ T1min()

Spinor MatrixFlux::T1min ( ) const
overridevirtual

Implements IFlux.

Definition at line 88 of file MatrixFlux.cpp.

89 {
90  return T1Matrix() * m_T.col1();
91 }

References SpinMatrix::col1(), m_T, and T1Matrix().

Here is the call graph for this function:

◆ T1plus()

Spinor MatrixFlux::T1plus ( ) const
overridevirtual

The following functions return the transmitted and reflected amplitudes for different incoming beam polarizations and eigenmodes.

Implements IFlux.

Definition at line 68 of file MatrixFlux.cpp.

69 {
70  return T1Matrix() * m_T.col0();
71 }

References SpinMatrix::col0(), m_T, and T1Matrix().

Here is the call graph for this function:

◆ T2Matrix()

SpinMatrix MatrixFlux::T2Matrix ( ) const
private

Definition at line 63 of file MatrixFlux.cpp.

64 {
65  return TransformationMatrix({1., 0.});
66 }

References TransformationMatrix().

Referenced by R2min(), R2plus(), T2min(), and T2plus().

Here is the call graph for this function:

◆ T2min()

Spinor MatrixFlux::T2min ( ) const
overridevirtual

Implements IFlux.

Definition at line 98 of file MatrixFlux.cpp.

99 {
100  return T2Matrix() * m_T.col1();
101 }

References SpinMatrix::col1(), m_T, and T2Matrix().

Here is the call graph for this function:

◆ T2plus()

Spinor MatrixFlux::T2plus ( ) const
overridevirtual

Implements IFlux.

Definition at line 78 of file MatrixFlux.cpp.

79 {
80  return T2Matrix() * m_T.col0();
81 }

References SpinMatrix::col0(), m_T, and T2Matrix().

Here is the call graph for this function:

◆ TransformationMatrix()

SpinMatrix MatrixFlux::TransformationMatrix ( const Spinor selection) const
private

Definition at line 43 of file MatrixFlux.cpp.

44 {
45  const SpinMatrix exp2(selection.u, 0, 0, selection.v);
46 
47  if (std::abs(m_b.mag() - 1.) < eps) {
48  const double factor1 = 2. * (1. + m_b.z());
49  SpinMatrix Q(1. + m_b.z(), I * m_b.y() - m_b.x(), m_b.x() + I * m_b.y(), m_b.z() + 1.);
50  return Q * exp2 * Q.adjoint() / factor1;
51  }
52  if (m_b.mag() < eps)
53  return exp2;
54 
55  throw std::runtime_error("Broken magnetic field vector");
56 }

References SpinMatrix::adjoint(), m_b, Spinor::u, and Spinor::v.

Referenced by T1Matrix(), and T2Matrix().

Here is the call graph for this function:

Member Data Documentation

◆ m_b

R3 MatrixFlux::m_b

unit magnetic field vector

Definition at line 60 of file MatrixFlux.h.

Referenced by MatrixFlux(), computeDeltaMatrix(), pMatrixHelper(), and TransformationMatrix().

◆ m_kz_sign

double MatrixFlux::m_kz_sign
private

Definition at line 63 of file MatrixFlux.h.

Referenced by computeDeltaMatrix(), getKz(), and pMatrixHelper().

◆ m_lambda

Spinor MatrixFlux::m_lambda

eigenvalues for wave propagation

Definition at line 57 of file MatrixFlux.h.

Referenced by computeDeltaMatrix(), computeInverseP(), getKz(), and pMatrixHelper().

◆ m_magnetic_SLD

double MatrixFlux::m_magnetic_SLD
private

wave propagation direction (-1 for direct one, 1 for time reverse)

Definition at line 64 of file MatrixFlux.h.

Referenced by magneticSLD().

◆ m_R

SpinMatrix MatrixFlux::m_R

Definition at line 59 of file MatrixFlux.h.

Referenced by getReflectionMatrix(), R1min(), R1plus(), R2min(), and R2plus().

◆ m_T

SpinMatrix MatrixFlux::m_T

Definition at line 58 of file MatrixFlux.h.

Referenced by T1min(), T1plus(), T2min(), and T2plus().


The documentation for this class was generated from the following files: