BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ResonatorBuilder.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/StandardSamples/ResonatorBuilder.cpp
6 //! @brief Implements ResonatorBuilder class.
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/Const/Units.h"
21 #include <memory>
22 
24 {
25  registerParameter("ti_thickness", &m_l_ti);
26 }
27 
29 {
30  auto* result = new MultiLayer;
31 
32  Material m_Si = HomogeneousMaterial("Si", 8.25218379931e-06, 0.0);
33  Material m_Ti = HomogeneousMaterial("Ti", -7.6593316363e-06, 3.81961616312e-09);
34  Material m_TiO2 = HomogeneousMaterial("TiO2", 1.04803530026e-05, 2.03233519385e-09);
35  Material m_Pt = HomogeneousMaterial("Pt", 2.52936993309e-05, 7.54553992473e-09);
36  Material m_D2O = HomogeneousMaterial("D2O", 2.52897204573e-05, 4.5224432814e-13);
37 
38  Layer l_TiO2(m_TiO2, 3.0 * Units::nm);
39  Layer l_Ti_top(m_Ti, 10.0 * Units::nm);
40  Layer l_Ti(m_Ti, m_l_ti);
41  Layer l_Si(m_Si);
42  Layer l_Pt(m_Pt, 32.0 * Units::nm);
43  Layer l_D2O(m_D2O);
44 
45  LayerRoughness roughness(2.0 * Units::nm, 0.8, 10.0 * Units::micrometer);
46 
47  result->addLayer(l_Si);
48 
49  const int nlayers = 3;
50  for (size_t i = 0; i < nlayers; ++i) {
51  result->addLayerWithTopRoughness(l_Ti, roughness);
52  result->addLayerWithTopRoughness(l_Pt, roughness);
53  }
54 
55  result->addLayerWithTopRoughness(l_Ti_top, roughness);
56  result->addLayerWithTopRoughness(l_TiO2, roughness);
57  result->addLayerWithTopRoughness(l_D2O, roughness);
58 
59  result->setCrossCorrLength(400 * Units::nm);
60 
61  return result;
62 }
Defines class LayerRoughness.
Defines class Layer.
Factory functions used to create material instances.
Defines class MultiLayer.
Defines ResonatorBuilder class.
Defines some unit conversion factors and other constants in namespace Units.
RealParameter & registerParameter(const std::string &name, double *parpointer)
Interface to the class capable to build samples to simulate.
A roughness of interface between two layers.
A layer, with thickness (in nanometer) and material.
Definition: Layer.h:28
A wrapper for underlying material implementation.
Definition: Material.h:29
Our sample model: a stack of layers one below the other.
Definition: MultiLayer.h:42
MultiLayer * buildSample() const
Material HomogeneousMaterial(const std::string &name, complex_t refractive_index, kvector_t magnetization)
Constructs a material with name, refractive_index and magnetization (in A/m).
Constants and functions for physical unit conversions.
Definition: Units.h:21
static constexpr double micrometer
Definition: Units.h:26
static constexpr double nm
Definition: Units.h:31