calculate_cell_size

calculate_cell_size#

autoplex.misc.utils.mock_custom_builder.calculate_cell_size(formula, density, slack=0.0)[source]#

Calculate the lattice parameter for the simulation cell.

Calculates the total mass of the given composition (formula), and divides by the density (given in g/cm^3) to give a cubic lattice parameter. A percentage variation from density can be specified (slack) to generate similuar cells of different volumes (useful if creating a convex hull, for instance).

Parameters:
  • formula (ase.formula.Formula) – The chemical formula of the target compositions

  • density (float) – The target average density of the unit cell, in g/cm^

  • slack (float) – How much the cell should be allowed to deviate from the specified density. If greater than 0, actual density will be selected according to random.uniform(density * (1 - slack), density * (1 + slack)). Default is 0.0

Returns:

The lattice parameter (in Ang)

Return type:

float