# AtomsBuilder

Documentation for AtomsBuilder.

`AtomsBuilder._flexible_system`

`AtomsBuilder.bulk`

`AtomsBuilder.randz!`

`AtomsBuilder.rattle!`

`AtomsBuilder.union`

`Base.deleteat!`

`Base.repeat`

`AtomsBuilder._flexible_system`

— MethodHelper function to convert construct a FlexibleSystem from a list of positions, elements, cell matrix and pbc tuple

`AtomsBuilder.bulk`

— Method`bulk(sym)`

: generates a `FlexibleSystem`

unit cell for a bulk crystal structure. If `sym`

is a chemical symbol then the phase and lattice constant are taken from a database that is consistent with ASE. If `sym`

is one of `[:fcc, :bcc, :diamond, :hcp]`

then one needs to specify the kwargs `a`

or `c`

to determine the lattice constants.

`AtomsBuilder.randz!`

— Method`randz!(sys::FlexibleSystem, zlist) -> sys`

Randomly assigns elements to the atoms in the system `sys`

according to the probabilities given in `zlist`

. `zlist`

is an iterable over pairs of the form `id => p`

where `id`

is an atom id (e.g. atomic number or chemical symbol) and `p`

a probability. E.g.,

```
sys = bulk(:Ti, cubic=true) * 3
sys = randz!(sys, [ :Ti => 0.2, :O => 0.8 ])
```

This function was developed mostly for generating testing systems. It may not be suitable for generating random alloys. PRs to improve it are welcome.

`AtomsBuilder.rattle!`

— Method`rattle!(sys, r::Union{AbstractFloat, Quantity}) -> at`

Randomly perturbs the atom positions within a ball of radius `r`

. The perturbation is uniform in angular component, and uniform in radial component. (Note this is not the same as choosing them uniform in cartesian coordinates!).

If `r`

is unitless, then the unit of the system is applied.

`AtomsBuilder.union`

— Method`union(sys1::FlexibleSystem, sys2::FlexibleSystem)`

takes the union of two particle systems provided their cells are identical.

`Base.deleteat!`

— Method`deleteat!(sys::FlexibleSystem, n) -> sys`

:

returns the same `FlexibleSystem`

`object`

sys`, but with the atom(s) specified by`

n` removed.

`Base.repeat`

— Method```
repeat(at, n::NTuple{3})
repeat(at, n::Integer)
```

Takes a structure and repeats it n_j times into the j-th cell-vector direction. For example,

`at = repeat(bulk(:C), (3,2,4))`

creates 3 x 2 x 4 unit cells of carbon.

The same can be achieved by `*`

:

`at = bulk(:) * (3, 2, 4)`