Particle class

Usage

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)
Vertical alignement

This will be revised soon. For the time being:

The bottommost point of a particle is placed at the top interface of the layer to which is added. Exception: if a particle is added to the semiinfinite top layer, then the bottom of the particle is placed at the bottom interface of the layer.

Alignement can be changed with the translate function (see below).

This part of the API is due to change in one of the next releases per issue #238.

Create a Particle instance

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.

Set location and orientation

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

rotation = ba.RotationEuler(alpha, beta, gamma)
rotation = 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 commutative.