The standard way to add particles to a sample model is
particle = ...
layout = ba.ParticleLayout()
layout.addParticle(particle, abundance)
layer = ba.Layer(material, thickness)
layer.addLayout(layout)
sample = ba.Sample()
sample.addLayer(layer)
This will be revised soon. For the time being:
The bottommost point of a particle is placed at the bottom interface of the layer to which is added. Exception: if a particle is added to a bottom (substrate) layer, then the bottom of the particle is placed at the top interface of the layer.
Alignement can be changed with the translate
function (see below).
The particle
in the above code snippet can be a simple or a composite particle.
To create a simple particle, use
particle = ba.Particle(material, formfactor)
For the constructor arguments, see sections Material and Formfactor.
To create a composed particle, see
Magnetization is supported as a material property.
To translate any particle, simple or composite, use either the vectorial form
from bornagain import R3
translation = R3(x, y, z)
particle.translate(translation)
or
particle.translate(x, y, z)
If z>0, then the particle is translated upwards.
To change the orientation, use code like
rotate = ba.RotationEuler(alpha, beta, gamma)
rotate = ba.RotationX(angle) # alternative
particle.rotate(rotation)
For more information on the argument, see Rotation.
Translations and rotations may be applied in any order. They are not commutative.