BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
LayersWithAbsorptionBySLDBuilder.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/StandardSamples/LayersWithAbsorptionBySLDBuilder.cpp
6 //! @brief Implements class LayersWithAbsorptionBySLDBuilder.
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"
24 
25 using Units::deg;
26 
27 const double middle_layer_thickness(60.0);
28 
30 {
31  Material ambience_mat = MaterialBySLD("Vacuum", 0.0, 0.0);
32  Material middle_mat = MaterialBySLD("Teflon", 4.7573e-6, 1.6724e-12);
33  Material substrate_mat = MaterialBySLD("Substrate", 2.0728e-06, 2.3747e-11);
34  Material particle_mat = MaterialBySLD("Ag", 3.4682e-06, 1.0309e-08);
35 
36  Sphere ff(5.0);
37 
38  Particle particle(particle_mat, ff);
39  particle.setRotation(RotationZ(10.0 * deg));
40  particle.rotate(RotationY(10.0 * deg));
41  particle.rotate(RotationX(10.0 * deg));
42  particle.setParticlePosition(R3(0.0, 0.0, -middle_layer_thickness / 2.0));
43 
44  ParticleLayout layout;
45  layout.addParticle(particle);
46 
47  Layer vacuum_layer(ambience_mat);
48  Layer middle_layer(middle_mat, middle_layer_thickness);
49  Layer substrate(substrate_mat);
50 
51  middle_layer.addLayout(layout);
52 
53  auto* sample = new MultiLayer();
54  sample->addLayer(vacuum_layer);
55  sample->addLayer(middle_layer);
56  sample->addLayer(substrate);
57  return sample;
58 }
Defines class Layer.
const double middle_layer_thickness(60.0)
Defines class LayersWithAbsorptionBySLDBuilder.
Factory functions used to create material instances.
Defines class MultiLayer.
Defines class ParticleLayout.
Defines class Particle.
Defines IRotation classes.
Defines class Sphere.
Defines some unit conversion factors and other constants in namespace Units.
void setParticlePosition(R3 position)
Sets relative position of the particle's reference point in the coordinate system of parent.
Definition: IParticle.h:51
IParticle * rotate(const IRotation &rotation)
Rotates the particle, and returns this.
Definition: IParticle.cpp:41
void setRotation(const IRotation &rotation)
Sets transformation.
Definition: IParticle.cpp:36
A layer in a MultiLayer sample.
Definition: Layer.h:26
void addLayout(const ParticleLayout &layout)
Definition: Layer.cpp:49
A wrapper for underlying material implementation.
Definition: Material.h:35
Our sample model: a stack of layers one below the other.
Definition: MultiLayer.h:43
Decorator class that adds particles to ISampleNode objects.
void addParticle(const IParticle &particle, double abundance=-1.0)
Adds particle to the layout with abundance, position and the rotation defined.
A particle with a form factor and refractive index.
Definition: Particle.h:25
A rotation about the x axis.
Definition: Rotations.h:74
A rotation about the y axis.
Definition: Rotations.h:98
A rotation about the z axis.
Definition: Rotations.h:122
A full sphere.
Definition: Sphere.h:23
Material MaterialBySLD()
static constexpr double deg
Definition: Units.h:46