+++
title = "Disordered"
weight = 30
+++

## Disordered 3D particle assemblies

Class `Dilute3D` models random assemblies of particles
dispersed in the bulk of a layer.
It can be used for thin films as long as the film thickness is
greater than the particle diameter.

Possible applications are
- nanoparticle-filled polymer films,
- colloidal suspensions, and
- any other system where particles (or holes) are dispersed
  in a matrix.

### Creating a 3D assembly

To fill a layer with randomly distributed particles:

```python
layer = ba.Layer(matrix_material, thickness)
layer.fill3D(ba.Dilute3D(density, particle))
```

If the layer contains an incoherent mixture of the disordered
assembly and something else, use `add3D` with a coverage
parameter:

```python
layer = ba.Layer(matrix_material, thickness)
disordered = ba.Dilute3D(density, particle)
layer.add3D(coverage, disordered)
```

Parameters:
- `density`: Volume number density in nm⁻³ (particles per
  cubic nanometer)
- `particle`: The particle to distribute throughout the layer
- `coverage` (second form only): surface coverage, between 0
  and 1

### Requirements

3D assemblies require material averaging to be enabled
(the default).
The layer thickness must be finite and larger than the
particle size.

### Examples

#### Dilute film

Spherical nanoparticles dispersed in a substrate layer:

{{< galleryscg >}}
{{< figscg src="/img/auto/scatter2d/DiluteFilm.png" width="350px"
    caption="Scattering from dilute film">}}
{{< /galleryscg >}}

{{< show-ex file="scatter2d/DiluteFilm.py" >}}

#### Film vs monolayer

Comparison between a 3D film (`fill3D`) and a 2D monolayer
(`deposit2D`). As film thickness increases, the scattering
pattern evolves from the monolayer limit:

{{< galleryscg >}}
{{< figscg src="/img/auto/scatter2d/FilmVsMonolayer.png"
    width="350px"
    caption="Film thickness dependence">}}
{{< /galleryscg >}}

{{< show-ex-collapsed file="scatter2d/FilmVsMonolayer.py" >}}
