pymatgen.transformations.standard_transformations module

class AutoOxiStateDecorationTransformation(symm_tol=0.1, max_radius=4, max_permutations=100000, distance_scale_factor=1.015)[source]

Bases: pymatgen.transformations.transformation_abc.AbstractTransformation

This transformation automatically decorates a structure with oxidation states using a bond valence approach.

Parameters:
  • symm_tol (float) – Symmetry tolerance used to determine which sites are symmetrically equivalent. Set to 0 to turn off symmetry.
  • max_radius (float) – Maximum radius in Angstrom used to find nearest neighbors.
  • max_permutations (int) – Maximum number of permutations of oxidation states to test.
  • distance_scale_factor (float) – A scale factor to be applied. This is useful for scaling distances, esp in the case of calculation-relaxed structures, which may tend to under (GGA) or over bind (LDA). The default of 1.015 works for GGA. For experimental structure, set this to 1.
apply_transformation(structure)[source]
inverse
is_one_to_many
class DeformStructureTransformation(deformation)[source]

Bases: pymatgen.transformations.transformation_abc.AbstractTransformation

This transformation deforms a structure by a deformation gradient matrix

Parameters:deformation (array) – deformation gradient for the transformation
apply_transformation(structure)[source]
inverse
is_one_to_many
class OrderDisorderedStructureTransformation(algo=0, symmetrized_structures=False)[source]

Bases: pymatgen.transformations.transformation_abc.AbstractTransformation

Order a disordered structure. The disordered structure must be oxidation state decorated for ewald sum to be computed. No attempt is made to perform symmetry determination to reduce the number of combinations.

Hence, attempting to performing ordering on a large number of disordered sites may be extremely expensive. The time scales approximately with the number of possible combinations. The algorithm can currently compute approximately 5,000,000 permutations per minute.

Also, simple rounding of the occupancies are performed, with no attempt made to achieve a target composition. This is usually not a problem for most ordering problems, but there can be times where rounding errors may result in structures that do not have the desired composition. This second step will be implemented in the next iteration of the code.

If multiple fractions for a single species are found for different sites, these will be treated separately if the difference is above a threshold tolerance. currently this is .1

For example, if a fraction of .25 Li is on sites 0,1,2,3 and .5 on sites 4, 5, 6, 7 1 site from [0,1,2,3] will be filled and 2 sites from [4,5,6,7] will be filled, even though a lower energy combination might be found by putting all lithium in sites [4,5,6,7].

USE WITH CARE.

Parameters:
  • algo (int) – Algorithm to use.
  • symmetrized_structures (bool) – Whether the input structures are instances of SymmetrizedStructure, and that their symmetry should be used for the grouping of sites.
ALGO_BEST_FIRST = 2
ALGO_COMPLETE = 1
ALGO_FAST = 0
apply_transformation(structure, return_ranked_list=False)[source]

For this transformation, the apply_transformation method will return only the ordered structure with the lowest Ewald energy, to be consistent with the method signature of the other transformations. However, all structures are stored in the all_structures attribute in the transformation object for easy access.

Parameters:
  • structure – Oxidation state decorated disordered structure to order
  • return_ranked_list (bool) – Whether or not multiple structures are returned. If return_ranked_list is a number, that number of structures is returned.
Returns:

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.

inverse
is_one_to_many
lowest_energy_structure
class OxidationStateDecorationTransformation(oxidation_states)[source]

Bases: pymatgen.transformations.transformation_abc.AbstractTransformation

This transformation decorates a structure with oxidation states.

Parameters:
  • oxidation_states (dict) – Oxidation states supplied as a dict,
  • {"Li" (e.g.,) – 1, “O”:-2}
apply_transformation(structure)[source]
inverse
is_one_to_many
class OxidationStateRemovalTransformation[source]

Bases: pymatgen.transformations.transformation_abc.AbstractTransformation

This transformation removes oxidation states from a structure.

apply_transformation(structure)[source]
inverse
is_one_to_many
class PartialRemoveSpecieTransformation(specie_to_remove, fraction_to_remove, algo=0)[source]

Bases: pymatgen.transformations.transformation_abc.AbstractTransformation

Remove fraction of specie from a structure.

Requires an oxidation state decorated structure for ewald sum to be computed.

Given that the solution to selecting the right removals is NP-hard, there are several algorithms provided with varying degrees of accuracy and speed. Please see pymatgen.transformations.site_transformations.PartialRemoveSitesTransformation.

Parameters:
  • specie_to_remove – Specie to remove. Must have oxidation state E.g., “Li+”
  • fraction_to_remove – Fraction of specie to remove. E.g., 0.5
  • algo – This parameter allows you to choose the algorithm to perform ordering. Use one of PartialRemoveSpecieTransformation.ALGO_* variables to set the algo.
ALGO_BEST_FIRST = 2
ALGO_COMPLETE = 1
ALGO_ENUMERATE = 3
ALGO_FAST = 0
apply_transformation(structure, return_ranked_list=False)[source]

Apply the transformation.

Parameters:
  • structure – input structure
  • return_ranked_list (bool/int) – Boolean stating whether or not multiple structures are returned. If return_ranked_list is an int, that number of structures is returned.
Returns:

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.

inverse
is_one_to_many
class PerturbStructureTransformation(amplitude=0.01)[source]

Bases: pymatgen.transformations.transformation_abc.AbstractTransformation

This transformation perturbs a structure by a specified distance in random directions. Used for breaking symmetries.

Parameters:amplitude (float) – Amplitude of perturbation in angstroms. All sites will be perturbed by exactly that amplitude in a random direction.
apply_transformation(structure)[source]
inverse
is_one_to_many
class PrimitiveCellTransformation(tolerance=0.5)[source]

Bases: pymatgen.transformations.transformation_abc.AbstractTransformation

This class finds the primitive cell of the input structure. It returns a structure that is not necessarily orthogonalized Author: Will Richards

Parameters:tolerance (float) – Tolerance for each coordinate of a particular site. For example, [0.5, 0, 0.5] in cartesian coordinates will be considered to be on the same coordinates as [0, 0, 0] for a tolerance of 0.5. Defaults to 0.5.
apply_transformation(structure)[source]

Returns most primitive cell for structure.

Parameters:structure – A structure
Returns:The most primitive structure found. The returned structure is guaranteed to have len(new structure) <= len(structure).
inverse
is_one_to_many
class RemoveSpeciesTransformation(species_to_remove)[source]

Bases: pymatgen.transformations.transformation_abc.AbstractTransformation

Remove all occurrences of some species from a structure.

Parameters:species_to_remove – List of species to remove. E.g., [“Li”, “Mn”]
apply_transformation(structure)[source]
inverse
is_one_to_many
class RotationTransformation(axis, angle, angle_in_radians=False)[source]

Bases: pymatgen.transformations.transformation_abc.AbstractTransformation

The RotationTransformation applies a rotation to a structure.

Parameters:
  • axis (3x1 array) – Axis of rotation, e.g., [1, 0, 0]
  • angle (float) – Angle to rotate
  • angle_in_radians (bool) – Set to True if angle is supplied in radians. Else degrees are assumed.
apply_transformation(structure)[source]
inverse
is_one_to_many
class SubstitutionTransformation(species_map)[source]

Bases: pymatgen.transformations.transformation_abc.AbstractTransformation

This transformation substitutes species for one another.

Parameters:species_map – A dict or list of tuples containing the species mapping in string-string pairs. E.g., {“Li”:”Na”} or [(“Fe2+”,”Mn2+”)]. Multiple substitutions can be done. Overloaded to accept sp_and_occu dictionary E.g. {“Si: {“Ge”:0.75, “C”:0.25}}, which substitutes a single species with multiple species to generate a disordered structure.
apply_transformation(structure)[source]
inverse
is_one_to_many
class SupercellTransformation(scaling_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)))[source]

Bases: pymatgen.transformations.transformation_abc.AbstractTransformation

The RotationTransformation applies a rotation to a structure.

Parameters:scaling_matrix – A matrix of transforming the lattice vectors. Defaults to the identity matrix. Has to be all integers. e.g., [[2,1,0],[0,3,0],[0,0,1]] generates a new structure with lattice vectors a” = 2a + b, b” = 3b, c” = c where a, b, and c are the lattice vectors of the original structure.
apply_transformation(structure)[source]
static from_scaling_factors(scale_a=1, scale_b=1, scale_c=1)[source]

Convenience method to get a SupercellTransformation from a simple series of three numbers for scaling each lattice vector. Equivalent to calling the normal with [[scale_a, 0, 0], [0, scale_b, 0], [0, 0, scale_c]]

Parameters:
  • scale_a – Scaling factor for lattice direction a. Defaults to 1.
  • scale_b – Scaling factor for lattice direction b. Defaults to 1.
  • scale_c – Scaling factor for lattice direction c. Defaults to 1.
Returns:

SupercellTransformation.

inverse
is_one_to_many