BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
SizeDistributionModelsBuilder.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/StandardSamples/SizeDistributionModelsBuilder.cpp
6 //! @brief Implements class ParticlesInSSCABuilder.
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 
24 
26 {
27  // cylindrical particle 1
28  double radius1(5);
29  double height1 = radius1;
30  Cylinder cylinder_ff1(radius1, height1);
31  Particle cylinder1(refMat::Particle, cylinder_ff1);
32 
33  // cylindrical particle 2
34  double radius2(8);
35  double height2(radius2);
36  Cylinder cylinder_ff2(radius2, height2);
37  Particle cylinder2(refMat::Particle, cylinder_ff2);
38 
39  // interference function
40  InterferenceRadialParaCrystal interference(18.0, 1e3);
41  Profile1DGauss pdf(3);
42  interference.setProbabilityDistribution(pdf);
43 
44  // assembling the sample
45  ParticleLayout particle_layout;
46  particle_layout.addParticle(cylinder1, 0.8);
47  particle_layout.addParticle(cylinder2, 0.2);
48  particle_layout.setInterference(interference);
49 
50  Layer vacuum_layer(refMat::Vacuum);
51  vacuum_layer.addLayout(particle_layout);
52  Layer substrate_layer(refMat::Substrate);
53 
54  auto* sample = new MultiLayer();
55  sample->addLayer(vacuum_layer);
56  sample->addLayer(substrate_layer);
57  return sample;
58 }
59 
60 // ----------------------------------------------------------------------------
61 
63 {
64  // cylindrical particle 1
65  double radius1(5);
66  double height1 = radius1;
67  Cylinder cylinder_ff1(radius1, height1);
68  Particle cylinder1(refMat::Particle, cylinder_ff1);
69 
70  // cylindrical particle 2
71  double radius2(8);
72  double height2(radius2);
73  Cylinder cylinder_ff2(radius2, height2);
74  Particle cylinder2(refMat::Particle, cylinder_ff2);
75 
76  // interference function1
77  InterferenceRadialParaCrystal interference1(16.8, 1e3);
78  Profile1DGauss pdf(3);
79  interference1.setProbabilityDistribution(pdf);
80 
81  // interference function2
82  InterferenceRadialParaCrystal interference2(22.8, 1e3);
83  interference2.setProbabilityDistribution(pdf);
84 
85  // assembling the sample
86  ParticleLayout particle_layout1;
87  particle_layout1.addParticle(cylinder1, 0.8);
88  particle_layout1.setInterference(interference1);
89 
90  ParticleLayout particle_layout2;
91  particle_layout2.addParticle(cylinder2, 0.2);
92  particle_layout2.setInterference(interference2);
93 
94  Layer vacuum_layer(refMat::Vacuum);
95  vacuum_layer.addLayout(particle_layout1);
96  vacuum_layer.addLayout(particle_layout2);
97  Layer substrate_layer(refMat::Substrate);
98 
99  auto* sample = new MultiLayer();
100  sample->addLayer(vacuum_layer);
101  sample->addLayer(substrate_layer);
102  return sample;
103 }
104 
105 // ----------------------------------------------------------------------------
106 
108 {
109  // cylindrical particle 1
110  double radius1(5);
111  double height1 = radius1;
112  Cylinder cylinder_ff1(radius1, height1);
113  Particle cylinder1(refMat::Particle, cylinder_ff1);
114 
115  // cylindrical particle 2
116  double radius2(8);
117  double height2(radius2);
118  Cylinder cylinder_ff2(radius2, height2);
119  Particle cylinder2(refMat::Particle, cylinder_ff2);
120 
121  // interference function
122  InterferenceRadialParaCrystal interference(18.0, 1e3);
123  Profile1DGauss pdf(3);
124  interference.setProbabilityDistribution(pdf);
125  interference.setKappa(1.0);
126 
127  // assembling the sample
128  ParticleLayout particle_layout;
129  particle_layout.addParticle(cylinder1, 0.8);
130  particle_layout.addParticle(cylinder2, 0.2);
131  particle_layout.setInterference(interference);
132 
133  Layer vacuum_layer(refMat::Vacuum);
134  vacuum_layer.addLayout(particle_layout);
135  Layer substrate_layer(refMat::Substrate);
136 
137  auto* sample = new MultiLayer();
138  sample->addLayer(vacuum_layer);
139  sample->addLayer(substrate_layer);
140  return sample;
141 }
142 
143 // ----------------------------------------------------------------------------
144 
146 {
147  throw std::runtime_error(
148  "This sample used ParticleDistribution which is not supported any more.");
149 
150  // #baRemoveParticleDistribution The following code is outdated. However, it is still kept,
151  // since it may be useful once the new particle distribution approach is implemented.
152  /*
153  Layer vacuum_layer(refMat::Vacuum);
154 
155  InterferenceRadialParaCrystal interparticle(15.0, 1e3);
156  Profile1DGauss pdf(5);
157  interparticle.setProbabilityDistribution(pdf);
158  interparticle.setKappa(4.02698);
159  ParticleLayout particle_layout;
160 
161  Cylinder ff_cylinder(5.0, 5.0);
162  Particle particle_prototype(refMat::Particle, ff_cylinder);
163 
164  DistributionGaussian gauss(5.0, 1.25);
165  ParameterPattern pattern_radius;
166  pattern_radius.add("Particle").add("Cylinder").add("Radius");
167  ParameterDistribution par_distr(pattern_radius.toStdString(), gauss, 30, 3.0);
168  ParameterPattern pattern_height;
169  pattern_height.add("Particle").add("Cylinder").add("Height");
170  par_distr.linkParameter(pattern_height.toStdString());
171  ParticleDistribution particle_collection(particle_prototype, par_distr);
172  particle_layout.addParticle(particle_collection);
173 
174  particle_layout.setInterference(interparticle);
175 
176  vacuum_layer.addLayout(particle_layout);
177 
178  auto* sample = new MultiLayer();
179  sample->addLayer(vacuum_layer);
180  return sample;
181  */
182 }
Defines class Cylinder.
Defines classes representing one-dimensional distributions.
Defines class InterferenceRadialParaCrystal.
Defines class Layer.
Defines class MultiLayer.
Defines class ParticleLayout.
Defines class Particle.
Defines materials in namespace refMat.
Defines various sample builder classes to test DA, LMA, SSCA approximations.
A circular cylinder.
Definition: Cylinder.h:23
Interference function of radial paracrystal.
void setKappa(double kappa)
Sets size spacing coupling parameter of the Size Spacing Correlation Approximation.
void setProbabilityDistribution(const IProfile1D &pdf)
Sets one-dimensional probability distribution.
A layer in a MultiLayer sample.
Definition: Layer.h:26
void addLayout(const ParticleLayout &layout)
Definition: Layer.cpp:49
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.
void setInterference(const IInterference &interparticle)
Adds interference functions.
A particle with a form factor and refractive index.
Definition: Particle.h:25
Gaussian IProfile1D; its Fourier transform standardizedFT(q) is a Gaussian starting at standardizedFT...
Definition: Profiles1D.h:87
MultiLayer * createSizeDistributionLMAModel()
MultiLayer * createSizeDistributionSSCAModel()
MultiLayer * createSizeDistributionDAModel()
static const Material Vacuum
static const Material Particle
static const Material Substrate