BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
MesoCrystalBuilder.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
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 
26 
28 {
29  // mesocrystal lattice
30  R3 lattice_basis_a(5.0, 0.0, 0.0);
31  R3 lattice_basis_b(0.0, 5.0, 0.0);
32  R3 lattice_basis_c(0.0, 0.0, 5.0);
33  Lattice3D lattice(lattice_basis_a, lattice_basis_b, lattice_basis_c);
34 
35  // spherical particle that forms the base of the mesocrystal
36  Sphere sphere_ff(2.0);
37  Particle sphere(refMat::Particle, sphere_ff);
38 
39  // crystal structure
40  Crystal crystal(sphere, lattice);
41 
42  // mesocrystal
43  Cylinder 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  auto* sample = new MultiLayer();
54  sample->addLayer(vacuum_layer);
55  sample->addLayer(substrate_layer);
56  return sample;
57 }
Defines class Crystal.
Defines class Cylinder.
Defines class Lattice.
Defines class Layer.
Defines class MesoCrystalBuilder.
Defines class MesoCrystal.
Defines class MultiLayer.
Defines class ParticleLayout.
Defines class Particle.
Defines materials in namespace refMat.
Defines class Sphere.
A crystal structure, defined by a Bravais lattice, a basis, and a position variance.
Definition: Crystal.h:34
A circular cylinder.
Definition: Cylinder.h:23
A Bravais lattice, characterized by three basis vectors, and optionally an ISelectionRule.
Definition: Lattice3D.h:30
A layer in a MultiLayer sample.
Definition: Layer.h:26
void addLayout(const ParticleLayout &layout)
Definition: Layer.cpp:49
A particle with a crystalline inner structure, made of smaller particles, and an outer shape describe...
Definition: MesoCrystal.h:27
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.
A particle with a form factor and refractive index.
Definition: Particle.h:25
A full sphere.
Definition: Sphere.h:23
MultiLayer * createMesoCrystal()
static const Material Vacuum
static const Material Particle
static const Material Substrate