BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
CoreShellParticleBuilder.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/StandardSamples/CoreShellParticleBuilder.cpp
6 //! @brief Implements class CoreShellParticleBuilder.
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 // --- CoreShellParticleBuilder ---
26 
27 MultiLayer* CoreShellParticleBuilder::buildSample() const
28 {
29  complex_t n_particle_shell(1.0 - 1e-4, 2e-8);
30  complex_t n_particle_core(1.0 - 6e-5, 2e-8);
31 
32  Material shell_material = HomogeneousMaterial("Shell", n_particle_shell);
33  Material core_material = HomogeneousMaterial("Core", n_particle_core);
34 
35  Layer vacuum_layer(refMat::Vacuum);
36 
37  FormFactorBox ff_box1(16 * Units::nanometer, 16 * Units::nanometer, 8 * Units::nanometer);
38  Particle shell_particle(shell_material, ff_box1);
39 
40  FormFactorBox ff_box2(12 * Units::nanometer, 12 * Units::nanometer, 7 * Units::nanometer);
41  Particle core_particle(core_material, ff_box2);
42 
43  kvector_t core_position(0.0, 0.0, 0.0);
44  ParticleCoreShell particle(shell_particle, core_particle, core_position);
45  ParticleLayout particle_layout(particle);
46 
47  vacuum_layer.addLayout(particle_layout);
48 
49  MultiLayer* multi_layer = new MultiLayer();
50  multi_layer->addLayer(vacuum_layer);
51  return multi_layer;
52 }
53 
54 // --- CoreShellBoxRotateZandYBuilder ---
55 
56 MultiLayer* CoreShellBoxRotateZandYBuilder::buildSample() const
57 {
58  const double layer_thickness(100.0 * Units::nanometer);
59 
60  // core shell particle
61  const double shell_length(50.0 * Units::nanometer);
62  const double shell_width(20.0 * Units::nanometer);
63  const double shell_height(10.0 * Units::nanometer);
64  double core_length = shell_length / 2.0;
65  double core_width = shell_width / 2.0;
66  double core_height = shell_height / 2.0;
67 
68  Particle core(refMat::Ag, FormFactorBox(core_length, core_width, core_height));
69  Particle shell(refMat::AgO2, FormFactorBox(shell_length, shell_width, shell_height));
70  ParticleCoreShell coreshell(shell, core,
71  kvector_t(0.0, 0.0, (shell_height - core_height) / 2.0));
72  coreshell.setRotation(RotationZ(90.0 * Units::degree));
73  coreshell.rotate(RotationY(90.0 * Units::degree));
74  coreshell.setPosition(kvector_t(0.0, 0.0, -layer_thickness / 2.0));
75 
76  ParticleLayout layout;
77  layout.addParticle(coreshell);
78 
79  Layer vacuum_layer(refMat::Vacuum);
80  Layer middle_layer(refMat::Teflon, layer_thickness);
81  middle_layer.addLayout(layout);
82  Layer substrate(refMat::Substrate2);
83 
84  MultiLayer* multi_layer = new MultiLayer();
85  multi_layer->addLayer(vacuum_layer);
86  multi_layer->addLayer(middle_layer);
87  multi_layer->addLayer(substrate);
88 
89  return multi_layer;
90 }
Defines class CoreShellParticleBuilder.
Defines class FormFactorBox.
Defines class Layer.
Defines class MultiLayer.
Defines ParticleCoreShell.
Defines class ParticleLayout.
Defines class Particle.
Defines materials in namespace refMat.
Defines some unit conversion factors and other constants in namespace Units.
A rectangular prism (parallelepiped).
Definition: FormFactorBox.h:24
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
void addLayer(const Layer &layer)
Adds object to multilayer.
Definition: MultiLayer.cpp:54
A particle with a core/shell geometry.
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 y axis.
Definition: Rotations.h:93
A rotation about the z axis.
Definition: Rotations.h:114
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).