BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
SlicedCompositionBuilder.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/StandardSamples/SlicedCompositionBuilder.cpp
6 //! @brief Defines classes to build various particles crossing interfaces.
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 MultiLayer* SlicedCompositionBuilder::buildSample() const
26 {
27  const double sphere_radius = 10.0;
28  const double bottom_cup_height = 4.0;
29  const double composition_shift = bottom_cup_height;
30 
31  Particle topCup(refMat::Ag, FormFactorTruncatedSphere(
32  sphere_radius, sphere_radius * 2 - bottom_cup_height, 0));
33  Particle bottomCup(refMat::Teflon,
34  FormFactorTruncatedSphere(sphere_radius, bottom_cup_height, 0));
35  bottomCup.setRotation(RotationX(180 * Units::deg));
36 
37  ParticleComposition composition;
38  composition.addParticle(topCup, kvector_t(0.0, 0.0, bottom_cup_height));
39  composition.addParticle(bottomCup, kvector_t(0.0, 0.0, bottom_cup_height));
40  composition.setPosition(0, 0, -composition_shift);
41 
42  ParticleLayout particle_layout;
43  particle_layout.addParticle(composition);
44 
45  Layer vacuum_layer(refMat::Vacuum);
46  vacuum_layer.addLayout(particle_layout);
47 
48  Layer substrate_layer(refMat::Substrate2);
49 
50  MultiLayer* multi_layer = new MultiLayer();
51  multi_layer->addLayer(vacuum_layer);
52  multi_layer->addLayer(substrate_layer);
53  return multi_layer;
54 }
Defines class FormFactorTruncatedSphere.
Defines class Layer.
Defines class MultiLayer.
Defines class ParticleComposition.
Defines class ParticleLayout.
Defines class Particle.
Defines materials in namespace refMat.
Defines classes to build various particles crossing interfaces.
Defines some unit conversion factors and other constants in namespace Units.
void setPosition(kvector_t position)
Sets relative position of the particle's reference point in the coordinate system of parent.
Definition: IParticle.h:50
A layer, with thickness (in nanometer) and material.
Definition: Layer.h:28
Our sample model: a stack of layers one below the other.
Definition: MultiLayer.h:42
void addLayer(const Layer &layer)
Adds object to multilayer.
Definition: MultiLayer.cpp:54
A composition of particles at fixed positions.
Decorator class that adds particles to ISample objects.
void addParticle(const IAbstractParticle &particle, double abundance=-1.0, const kvector_t position={}, const IRotation &rotation=IdentityRotation())
Adds particle to the layout with abundance, position and the rotation defined.
A particle with a form factor and refractive index.
Definition: Particle.h:26
A rotation about the x axis.
Definition: Rotations.h:72