BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
CylindersBuilder.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/StandardSamples/CylindersBuilder.cpp
6 //! @brief Implements classes of CylindersBuilder family.
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 // -----------------------------------------------------------------------------
26 // Cylinders in DWBA
27 // -----------------------------------------------------------------------------
29 {
30 }
31 
33 {
34  Layer vacuum_layer(refMat::Vacuum);
35  Layer substrate_layer(refMat::Substrate);
36 
37  FormFactorCylinder ff_cylinder(m_radius, m_height);
38 
39  Particle particle(refMat::Particle, ff_cylinder);
40  ParticleLayout particle_layout(particle);
41 
42  vacuum_layer.addLayout(particle_layout);
43 
44  MultiLayer* multi_layer = new MultiLayer();
45  multi_layer->addLayer(vacuum_layer);
46  multi_layer->addLayer(substrate_layer);
47  return multi_layer;
48 }
49 
50 // -----------------------------------------------------------------------------
51 // Cylinders in BA
52 // -----------------------------------------------------------------------------
53 CylindersInBABuilder::CylindersInBABuilder() : m_height(5 * Units::nm), m_radius(5 * Units::nm)
54 {
55  registerParameter("height", &m_height);
56  registerParameter("radius", &m_radius);
57 }
58 
60 {
61  Layer vacuum_layer(refMat::Vacuum);
62 
63  FormFactorCylinder ff_cylinder(m_radius, m_height);
64  Particle cylinder(refMat::Particle, ff_cylinder);
65 
66  ParticleLayout particle_layout(cylinder);
67 
68  vacuum_layer.addLayout(particle_layout);
69 
70  MultiLayer* multi_layer = new MultiLayer();
71  multi_layer->addLayer(vacuum_layer);
72  return multi_layer;
73 }
74 
75 // -----------------------------------------------------------------------------
76 // Large cylinders in DWBA
77 // -----------------------------------------------------------------------------
79  : m_height(1000 * Units::nm), m_radius(500 * Units::nm)
80 {
81 }
82 
84 {
85  Layer vacuum_layer(refMat::Vacuum);
86  Layer substrate_layer(refMat::Substrate);
87 
88  FormFactorCylinder ff_cylinder(m_radius, m_height);
89 
90  Particle particle(refMat::Particle, ff_cylinder);
91  ParticleLayout particle_layout(particle);
92 
93  vacuum_layer.addLayout(particle_layout);
94 
95  MultiLayer* multi_layer = new MultiLayer();
96  multi_layer->addLayer(vacuum_layer);
97  multi_layer->addLayer(substrate_layer);
98  return multi_layer;
99 }
100 
101 // -----------------------------------------------------------------------------
102 // Rotated cylinders in DWBA
103 // -----------------------------------------------------------------------------
105  : m_height(5 * Units::nm), m_radius(5 * Units::nm)
106 {
107 }
108 
110 {
111  FormFactorCylinder ff_cylinder(m_radius, m_height);
112 
113  Particle particle(refMat::Particle, ff_cylinder);
114  ParticleLayout particle_layout;
115  particle_layout.addParticle(particle, 1.0, kvector_t(), RotationY(M_PI));
116 
117  Layer vacuum_layer(refMat::Vacuum);
118  Layer substrate_layer(refMat::Substrate);
119  substrate_layer.addLayout(particle_layout);
120 
121  MultiLayer* multi_layer = new MultiLayer();
122  multi_layer->addLayer(vacuum_layer);
123  multi_layer->addLayer(substrate_layer);
124  return multi_layer;
125 }
#define M_PI
Definition: Constants.h:44
Defines classes of CylindersBuilder family.
Defines class FormFactorCylinder.
Defines class LayerInterface.
Defines class Layer.
Defines class MultiLayer.
Defines class ParticleLayout.
Defines class Particle.
Defines materials in namespace refMat.
Defines some unit conversion factors and other constants in namespace Units.
BasicVector3D< double > kvector_t
Definition: Vectors3D.h:21
MultiLayer * buildSample() const
MultiLayer * buildSample() const
A circular cylinder.
RealParameter & registerParameter(const std::string &name, double *parpointer)
MultiLayer * buildSample() const
A layer in a MultiLayer sample.
Definition: Layer.h:27
void addLayout(const ParticleLayout &decoration)
Definition: Layer.cpp:58
Our sample model: a stack of layers one below the other.
Definition: MultiLayer.h:41
void addLayer(const Layer &layer)
Adds layer with default (zero) roughness.
Definition: MultiLayer.cpp:53
Decorator class that adds particles to ISampleNode 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:24
MultiLayer * buildSample() const
A rotation about the y axis.
Definition: Rotations.h:93
Constants and functions for physical unit conversions.
Definition: Units.h:30
static constexpr double nm
Definition: Units.h:39
static const Material Vacuum
static const Material Particle
static const Material Substrate