pymatgen.alchemy.materials module
This module provides various representations of transformed structures. A TransformedStructure is a structure that has been modified by undergoing a series of transformations.
- class TransformedStructure(structure, transformations=None, history=None, other_parameters=None)[source]
Bases:
monty.json.MSONable
Container object for new structures that include history of transformations.
Each transformed structure is made up of a sequence of structures with associated transformation history.
Initializes a transformed structure from a structure.
- Parameters
structure (Structure) – Input structure
transformations ([Transformations]) – List of transformations to apply.
history (list) – Previous history.
other_parameters (dict) – Additional parameters to be added.
- append_filter(structure_filter)[source]
Adds a filter.
- Parameters
structure_filter (StructureFilter) – A filter implementating the AbstractStructureFilter API. Tells transmuter waht structures to retain.
- append_transformation(transformation, return_alternatives=False, clear_redo=True)[source]
Appends a transformation to the TransformedStructure.
- Parameters
transformation – Transformation to append
return_alternatives – Whether to return alternative TransformedStructures for one-to-many transformations. return_alternatives can be a number, which stipulates the total number of structures to return.
clear_redo – Boolean indicating whether to clear the redo list. By default, this is True, meaning any appends clears the history of undoing. However, when using append_transformation to do a redo, the redo list should not be cleared to allow multiple redos.
- extend_transformations(transformations, return_alternatives=False)[source]
Extends a sequence of transformations to the TransformedStructure.
- Parameters
transformations – Sequence of Transformations
return_alternatives – Whether to return alternative TransformedStructures for one-to-many transformations. return_alternatives can be a number, which stipulates the total number of structures to return.
- static from_cif_string(cif_string, transformations=None, primitive=True, occupancy_tolerance=1.0)[source]
Generates TransformedStructure from a cif string.
- Parameters
cif_string (str) – Input cif string. Should contain only one structure. For cifs containing multiple structures, please use CifTransmuter.
transformations ([Transformations]) – Sequence of transformations to be applied to the input structure.
primitive (bool) – Option to set if the primitive cell should be extracted. Defaults to True. However, there are certain instances where you might want to use a non-primitive cell, e.g., if you are trying to generate all possible orderings of partial removals or order a disordered structure.
occupancy_tolerance (float) – If total occupancy of a site is between 1 and occupancy_tolerance, the occupancies will be scaled down to 1.
- Returns
TransformedStructure
- static from_poscar_string(poscar_string, transformations=None)[source]
Generates TransformedStructure from a poscar string.
- Parameters
poscar_string (str) – Input POSCAR string.
transformations ([Transformations]) – Sequence of transformations to be applied to the input structure.
- classmethod from_snl(snl)[source]
Create TransformedStructure from SNL.
- Parameters
snl (StructureNL) – Starting snl
- Returns
TransformedStructure
- get_vasp_input(vasp_input_set=<class 'pymatgen.io.vasp.sets.MPRelaxSet'>, **kwargs)[source]
Returns VASP input as a dict of vasp objects.
- Parameters
vasp_input_set (pymatgen.io.vaspio_set.VaspInputSet) – input set to create vasp input files from structures
- redo_next_change()[source]
Redo the last undone change in the TransformedStructure.
- Raises
IndexError – If already at the latest change.
- set_parameter(key, value)[source]
Set a parameter
- Parameters
key – The string key
value – The value.
- property structures[source]
Copy of all structures in the TransformedStructure. A structure is stored after every single transformation.
- to_snl(authors, **kwargs)[source]
Generate SNL from TransformedStructure.
- Parameters
authors – List of authors
**kwargs –
All kwargs supported by StructureNL.
- Returns
StructureNL
- undo_last_change()[source]
Undo the last change in the TransformedStructure.
- Raises
IndexError – If already at the oldest change.
- property was_modified[source]
Boolean describing whether the last transformation on the structure made any alterations to it one example of when this would return false is in the case of performing a substitution transformation on the structure when the specie to replace isn’t in the structure.
- write_vasp_input(vasp_input_set=<class 'pymatgen.io.vasp.sets.MPRelaxSet'>, output_dir='.', create_directory=True, **kwargs)[source]
Writes VASP input to an output_dir.
- Parameters
vasp_input_set – pymatgen.io.vaspio_set.VaspInputSet like object that creates vasp input files from structures
output_dir – Directory to output files
create_directory – Create the directory if not present. Defaults to True.
**kwargs – All keyword args supported by the VASP input set.