BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
MesoCrystalBuilder.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/StandardSamples/MesoCrystalBuilder.cpp
6 //! @brief Implements class MesoCrystalBuilder.
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"
26 
28 {
29  // mesocrystal lattice
30  kvector_t lattice_basis_a(5.0, 0.0, 0.0);
31  kvector_t lattice_basis_b(0.0, 5.0, 0.0);
32  kvector_t lattice_basis_c(0.0, 0.0, 5.0);
33  Lattice lattice(lattice_basis_a, lattice_basis_b, lattice_basis_c);
34 
35  // spherical particle that forms the base of the mesocrystal
36  FormFactorFullSphere sphere_ff(2.0);
37  Particle sphere(refMat::Particle, sphere_ff);
38 
39  // crystal structure
40  Crystal crystal(sphere, lattice);
41 
42  // mesocrystal
43  FormFactorCylinder meso_ff(20.0, 50.0);
44  MesoCrystal meso(crystal, meso_ff);
45 
46  ParticleLayout particle_layout;
47  particle_layout.addParticle(meso);
48 
49  Layer vacuum_layer(refMat::Vacuum);
50  vacuum_layer.addLayout(particle_layout);
51  Layer substrate_layer(refMat::Substrate);
52 
53  MultiLayer* multi_layer = new MultiLayer();
54  multi_layer->addLayer(vacuum_layer);
55  multi_layer->addLayer(substrate_layer);
56  return multi_layer;
57 }
Defines class Crystal.
Defines class FormFactorCylinder.
Defines class FormFactorFullSphere.
Defines class Layer.
Defines class MesoCrystalBuilder.
Defines class MesoCrystal.
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.
A crystal structure with a ParticleComposition as a basis.
Definition: Crystal.h:26
A circular cylinder.
A lattice with three basis vectors.
Definition: Lattice.h:28
A layer, with thickness (in nanometer) and material.
Definition: Layer.h:28
void addLayout(const ILayout &decoration)
Definition: Layer.cpp:57
MultiLayer * buildSample() const
A particle with an internal structure of smaller particles.
Definition: MesoCrystal.h:26
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
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
static const Material Vacuum
static const Material Particle
static const Material Substrate