BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
SpecularScalarTanhStrategy.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Specular/SpecularScalarTanhStrategy.cpp
6 //! @brief Implements class SpecularScalarTanhStrategy.
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 "Base/Math/Constants.h"
17 #include "Base/Math/Functions.h"
18 #include <Eigen/Dense>
19 
20 namespace {
21 const double pi2_15 = std::pow(M_PI_2, 1.5);
22 }
23 
24 std::pair<complex_t, complex_t>
26 {
27  complex_t roughness = 1;
28  if (sigma > 0.0) {
29  const double sigeff = pi2_15 * sigma;
30  roughness = std::sqrt(Math::tanhc(sigeff * kzi1) / Math::tanhc(sigeff * kzi));
31  }
32  const complex_t inv_roughness = 1.0 / roughness;
33  const complex_t kz_ratio = kzi1 / kzi * roughness;
34 
35  const complex_t a00 = 0.5 * (inv_roughness + kz_ratio);
36  const complex_t a01 = 0.5 * (inv_roughness - kz_ratio);
37 
38  return {a00, a01};
39 }
std::complex< double > complex_t
Definition: Complex.h:20
Defines M_PI and some more mathematical constants.
#define M_PI_2
Definition: Constants.h:45
Defines functions in namespace Math.
Defines class SpecularScalarTanhStrategy.
virtual std::pair< complex_t, complex_t > transition(complex_t kzi, complex_t kzi1, double sigma) const override
Roughness is modelled by tanh profile [see e.g. Phys. Rev. B, vol. 47 (8), p. 4385 (1993)].
complex_t tanhc(const complex_t z)
Complex tanhc function: .
Definition: Functions.cpp:69