BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
LayerRoughness.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/Slice/LayerRoughness.cpp
6 //! @brief Implements class LayerRoughness.
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 
18 
19 //! Constructor of layer roughness.
20 //! @param sigma: rms of the roughness in nanometers
21 //! @param hurstParameter: hurst parameter which describes how jagged the interface,
22 //! dimensionless [0.0, 1.0], where 0.0 gives more spikes, 1.0 more smoothness
23 //! @param lateralCorrLength: lateral correlation length of the roughness in nanometers
24 LayerRoughness::LayerRoughness(double sigma, double hurstParameter, double lateralCorrLength)
25  : m_sigma(sigma), m_hurstParameter(hurstParameter), m_lateralCorrLength(lateralCorrLength)
26 {
27  setName("LayerBasicRoughness");
28  registerParameter("Sigma", &m_sigma);
30  registerParameter("CorrelationLength", &m_lateralCorrLength).setUnit("nm").setNonnegative();
31 }
32 
34 
35 /* ************************************************************************* */
36 //! Power spectral density of the surface roughness is a result of two-dimensional
37 //! Fourier transform of the correlation function of the roughness profile.
38 //!
39 //! Based on the article
40 //! D.K.G. de Boer, Physical review B, Volume 51, Number 8, 15 February 1995
41 //! "X-ray reflection and transmission by rough surfaces"
42 /* ************************************************************************* */
43 double LayerRoughness::getSpectralFun(const kvector_t kvec) const
44 {
45  double H = m_hurstParameter;
46  double clength2 = m_lateralCorrLength * m_lateralCorrLength;
47  double Qpar2 = kvec.x() * kvec.x() + kvec.y() * kvec.y();
48  return 4.0 * M_PI * H * m_sigma * m_sigma * clength2
49  * std::pow((1.0 + Qpar2 * clength2), (-1 - H));
50 }
51 
52 //! Correlation function of the roughness profile
53 
55 {
56  double H = m_hurstParameter;
57  double clength = m_lateralCorrLength;
58  double R = sqrt(k.x() * k.x() + k.y() * k.y());
59  return m_sigma * m_sigma * std::exp(-1.0 * std::pow(R / clength, 2. * H));
60 }
Defines class LayerRoughness.
Defines M_PI and some more mathematical constants.
#define M_PI
Definition: MathConstants.h:39
Defines class RealParameter.
T y() const
Returns y-component in cartesian coordinate system.
Definition: BasicVector3D.h:66
T x() const
Returns x-component in cartesian coordinate system.
Definition: BasicVector3D.h:64
RealParameter & registerParameter(const std::string &name, double *parpointer)
void setName(const std::string &name)
A roughness of interface between two layers.
double m_hurstParameter
Hurst parameter which describes how jagged the interface, 0<H<=1.
double getSpectralFun(const kvector_t kvec) const
Returns power spectral density of the surface roughness.
double m_lateralCorrLength
lateral correlation length of the roughness
double getCorrFun(const kvector_t k) const
Correlation function of the roughness profile.
double m_sigma
rms of roughness
RealParameter & setNonnegative()
RealParameter & setUnit(const std::string &name)