+++
title = "Form factor"
weight = 5
+++

## Particle form factor

#### Theory

A particle shape is described
through the density function $n(\mathbf{r})$ in real space,
or the form factor
$$F(\mathbf{q}) = \int d^3r\thinspace e^{i\mathbf{q}\mathbf{r}} n(\mathbf{r})$$
in reciprocal space.

For a "hard" particle, $n(\mathbf{r})$ is an indicator function
with value 1 inside, 0 outside.
For a "soft" particle, $n(\mathbf{r})$ has a smooth transition from the inside limit of&nbsp;1
to the outside limit of&nbsp;0.

At large $q$, the exponential factor in the integral defining $F(\mathbf{q})$
oscillates rapidly. This leads to substantial errors if $q$ is of the same order
or larger than the inverse detector bin length.
In such cases, we recommend
[Monte-Carlo integration over detector bins](/ref/sim/setup/options/mc)
(see [example](/ref/sim/class/scattering/ex/mc)).

By construction, $F(\mathbf{q})$ is a holomorphic function.
Therefore expressions previously derived for real wave vectors $\mathbf{q}$
also hold for complex $\mathbf{q}$.

#### Implementation

The interface class {{% ref-class "Sample/Particle" "Formfactor" %}}
cannot be instantiated directly.
Instead, one has to choose one of the following child classes:

- hard particles:
  - spheroids:
  - cylinders and cones:
  - polygonal prisms:
  - pyramids (frusta):
    * rectangular
    * trigonal
    * quadratic: Pyramid4, Bipyramid4
    * hexagonal
  - other polyhedra:
- soft particles:
  - spherical:

Using Python scripting, it is also possible to define a [custom form factor](custom).

#### Usage

Form factors are used to define the shape of particles:
```python
ff = ba.Cylinder(5*nm, 5*nm)
particle = ba.Particle(material_Particle, ff)
```

#### Literature

Form factor catalogues in earlier software:
- IsGISAXS: [Lazzari, IsGISAXS manual v2.6 (2006)](http://www.insp.upmc.fr/oxydes/IsGISAXS/figures/doc/manual.html),
  [Renaud et al, Surf Sci Rep 64, 255 (2009)](https://doi.org/10.1016/j.surfrep.2009.07.002).
- FitGISAXS: [Babonneau, J Appl Cryst 35, 406 (2010)](https://doi.org/10.1107/S0021889810020352),
  [Babonneau, FitGISAXS v130531 (2013)](https://pprime.fr/wp-content/uploads/2020/01/FitGISAXS_130531.zip).

Stable algorithm for computing form factors of polyhedra: [Wuttke, J Appl Cryst 54, 580 (2021)](https://doi.org/10.1107/S1600576721001710).
