pymatgen.transformations.transformation_abc module

Defines an abstract base class contract for Transformation object.

class AbstractTransformation[source]

Bases: MSONable

Abstract transformation class.

abstract apply_transformation(structure: Structure)[source]

Applies the transformation to a structure. Depending on whether a transformation is one-to-many, there may be an option to return a ranked list of structures.

  • structure – input structure

  • return_ranked_list – Boolean stating whether or not multiple structures are returned. If return_ranked_list is a number, that number of structures is returned.


depending on returned_ranked list, either a transformed structure or a list of dictionaries, where each dictionary is of the form {‘structure’ = …. , ‘other_arguments’} the key ‘transformation’ is reserved for the transformation that was actually applied to the structure. This transformation is parsed by the alchemy classes for generating a more specific transformation history. Any other information will be stored in the transformation_parameters dictionary in the transmuted structure class.

abstract property inverse: AbstractTransformation | None[source]

Returns the inverse transformation if available. Otherwise, should return None.

abstract property is_one_to_many: bool[source]

Determines if a Transformation is a one-to-many transformation. If a Transformation is a one-to-many transformation, the apply_transformation method should have a keyword arg “return_ranked_list” which allows for the transformed structures to be returned as a ranked list.

property use_multiprocessing: bool[source]

Indicates whether the transformation can be applied by a subprocessing pool. This should be overridden to return True for transformations that the transmuter can parallelize.