File: MatrixFlux.h

package info (click to toggle)
bornagain 23.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,936 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 318; ruby: 173; xml: 130; makefile: 51; ansic: 24
file content (75 lines) | stat: -rw-r--r-- 2,673 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//  ************************************************************************************************
//
//  BornAgain: simulate and fit reflection and scattering
//
//! @file     Resample/Flux/MatrixFlux.h
//! @brief    Defines class MatrixFlux.
//!
//! @homepage  http://www.bornagainproject.org
//! @license   GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2020
//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
//  ************************************************************************************************

#ifdef SWIG
#error no need to expose this header to Swig
#endif // SWIG
#ifndef BORNAGAIN_RESAMPLE_FLUX_MATRIXFLUX_H
#define BORNAGAIN_RESAMPLE_FLUX_MATRIXFLUX_H

#include "Base/Spin/SpinMatrix.h"
#include "Resample/Flux/IFlux.h"
#include <heinz/Vectors3D.h>

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

class MatrixFlux : public IFlux {
public:
    MatrixFlux(double kz_sign, const Spinor& k_eigen, const R3& b, double magnetic_SLD);

    //! The following functions return the transmitted and reflected amplitudes
    //! for different incoming beam polarizations and eigenmodes
    Spinor T1plus() const override;
    Spinor R1plus() const override;
    Spinor T2plus() const override;
    Spinor R2plus() const override;
    Spinor T1min() const override;
    Spinor R1min() const override;
    Spinor T2min() const override;
    Spinor R2min() const override;
    //! Returns z-part of the two wavevector eigenmodes
    Spinor getKz() const override;
    double magneticSLD() const { return m_magnetic_SLD; }

    SpinMatrix computeKappa() const;
    SpinMatrix computeInverseKappa() const;
    SpinMatrix eigenToMatrix(const Spinor& diagonal) const;

    SpinMatrix computeDeltaMatrix(double thickness) const;

    SpinMatrix getReflectionMatrix() const { return m_R; };

    complex_t k_eigen_up() const { return m_k_eigen.u; }
    complex_t k_eigen_dn() const { return m_k_eigen.v; }
    const R3& field() const { return m_b; }

private:
    Spinor m_k_eigen; //!< eigenvalues for wave propagation

public: // TODO privatize
    SpinMatrix m_T;
    SpinMatrix m_R;

private:
    R3 m_b;           //!< unit magnetic field vector
    double m_kz_sign; //! wave propagation direction (-1 for direct one, 1 for time reverse)
    double m_magnetic_SLD;

    // helper functions to compute DWBA compatible amplitudes used in the T1plus() etc. functions
    SpinMatrix T1Matrix() const;
    SpinMatrix T2Matrix() const;
};

#endif // BORNAGAIN_RESAMPLE_FLUX_MATRIXFLUX_H