xtalmet.validity module

This module offers classes to compute the validity of crystal structures.

class xtalmet.validity.SingleValidator(**kwargs)View on GitHub

Bases: object

Class to calculate validity of crystal structures using a single method.

Initialize SingleValidator.

Parameters:

**kwargs – Additional keyword arguments for the validity evaluation method.

validate(xtals: list[Crystal]) ndarray[float]View on GitHub

Validate a list of crystals.

Parameters:

xtals (list[Crystal]) – List of crystals to validate.

Returns:

Array of validity scores for each crystal.

Return type:

np.ndarray[float]

class xtalmet.validity.SMACTValidatorView on GitHub

Bases: SingleValidator

Class to calculate validity of crystal structures using SMACT.

Initialize SMACTValidator.

validate(xtals: list[Crystal]) ndarray[float]View on GitHub

Validate a list of crystals using SMACT.

Parameters:

xtals (list[Crystal]) – List of crystals to validate.

Returns:

Array of validity scores for each crystal. A value of 1.0 indicates that the crystal passed the SMACT screening, while 0.0 indicates that it failed.

Return type:

np.ndarray[float]

References

class xtalmet.validity.StructureValidator(threshold_distance: float = 0.5, threshold_volume: float = 0.1)View on GitHub

Bases: SingleValidator

Class to calculate structure-based validity of crystal structures.

Initialize StructureValidator.

Parameters:
  • threshold_distance (float) – Minimum allowed distance between atoms.

  • threshold_volume (float) – Minimum allowed volume of the unit cell.

References

  • Xie et al., (2022). Crystal Diffusion Variational Autoencoder for Periodic Material Generation. In International Conference on Learning Representations.

validate(xtals: list[Crystal]) ndarray[float]View on GitHub

Validate a list of crystals using structure-based method.

Parameters:

xtals (list[Crystal]) – List of crystals to validate.

Returns:

Array of validity scores for each crystal. A value of 1.0 indicates that the crystal passed the structure-based screening, while 0.0 indicates that it failed.

Return type:

np.ndarray[float]

class xtalmet.validity.Validator(methods: list[str], **kwargs)View on GitHub

Bases: object

Class to calculate validity of crystal structures.

Initialize Validator.

Parameters:
  • methods (list[str]) – List of validity evaluation methods to use. The currently supported methods are shown in SUPPORTED_VALIDITY in constants.py.

  • **kwargs – Additional keyword arguments for each validity evaluation method.

validate(xtals: list[Crystal], skip: list[str]) tuple[dict[str, ndarray[float]], dict[str, float]]View on GitHub

Validate a list of crystals using the specified methods.

Parameters:
  • xtals (list[Crystal]) – List of crystals to validate.

  • skip (list[str]) – List of validity methods to skip.

Returns:

A dictionary of individual scores from each validator, and a dictionary of time taken for each validity method.

Return type:

tuple[dict[str, np.ndarray[float]], dict[str, float]]