BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
SpecularScalarNCStrategy.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/Specular/SpecularScalarNCStrategy.cpp
6 //! @brief Implements class SpecularScalarNCStrategy.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************** //
14 
16 #include <Eigen/Dense>
17 
18 std::pair<complex_t, complex_t> SpecularScalarNCStrategy::transition(complex_t kzi, complex_t kzi1,
19  double sigma) const
20 {
21  complex_t roughness_diff = 1;
22  complex_t roughness_sum = 1;
23  if (sigma > 0.0) {
24  roughness_diff = std::exp(-(kzi1 - kzi) * (kzi1 - kzi) * sigma * sigma / 2.);
25  roughness_sum = std::exp(-(kzi1 + kzi) * (kzi1 + kzi) * sigma * sigma / 2.);
26  }
27  const complex_t kz_ratio = kzi1 / kzi;
28 
29  const complex_t a00 = 0.5 * (1. + kz_ratio) * roughness_diff;
30  const complex_t a01 = 0.5 * (1. - kz_ratio) * roughness_sum;
31 
32  return {a00, a01};
33 }
std::complex< double > complex_t
Definition: Complex.h:20
Defines class SpecularScalarNCStrategy.
virtual std::pair< complex_t, complex_t > transition(complex_t kzi, complex_t kzi1, double sigma) const override
Roughness is modelled by a Gaussian profile, i.e.