pymatgen.alchemy.filters module

class AbstractStructureFilter[source]

Bases: monty.json.MSONable

AbstractStructureFilter that defines an API to perform testing of Structures. Structures that return True to a test are retained during transmutation while those that return False are removed.

test(structure)[source]

Method to execute the test.

Returns:(bool) Structures that return true are kept in the Transmuter object during filtering.
class ChargeBalanceFilter[source]

Bases: pymatgen.alchemy.filters.AbstractStructureFilter

This filter removes structures that are not charge balanced from the transmuter. This only works if the structure is oxidation state decorated, as structures with only elemental sites are automatically assumed to have net charge of 0.

test(structure)[source]
class ContainsSpecieFilter(species, strict_compare=False, AND=True, exclude=False)[source]

Bases: pymatgen.alchemy.filters.AbstractStructureFilter

Filter for structures containing certain elements or species. By default compares by atomic number

Parameters:
  • species ([Specie/Element]) – list of species to look for
  • AND – whether all species must be present to pass (or fail) filter.
  • strict_compare – if true, compares objects by specie or element object if false, compares atomic number
  • exclude – If true, returns false for any structures with the specie (excludes them from the Transmuter)
as_dict()[source]
classmethod from_dict(d)[source]
test(structure)[source]
class RemoveDuplicatesFilter(structure_matcher=<pymatgen.analysis.structure_matcher.StructureMatcher object>, symprec=None)[source]

Bases: pymatgen.alchemy.filters.AbstractStructureFilter

This filter removes exact duplicate structures from the transmuter.

Remove duplicate structures based on the structure matcher and symmetry (if symprec is given).

Parameters:
  • structure_matcher – Provides a structure matcher to be used for structure comparison.
  • symprec – The precision in the symmetry finder algorithm if None ( default value), no symmetry check is performed and only the structure matcher is used. A recommended value is 1e-5.
test(structure)[source]
class RemoveExistingFilter(existing_structures, structure_matcher=<pymatgen.analysis.structure_matcher.StructureMatcher object>, symprec=None)[source]

Bases: pymatgen.alchemy.filters.AbstractStructureFilter

This filter removes structures existing in a given list from the transmuter.

Remove existing structures based on the structure matcher and symmetry (if symprec is given).

Parameters:
  • existing_structures – List of existing structures to compare with
  • structure_matcher – Provides a structure matcher to be used for structure comparison.
  • symprec – The precision in the symmetry finder algorithm if None ( default value), no symmetry check is performed and only the structure matcher is used. A recommended value is 1e-5.
as_dict()[source]
test(structure)[source]
class SpecieProximityFilter(specie_and_min_dist_dict)[source]

Bases: pymatgen.alchemy.filters.AbstractStructureFilter

This filter removes structures that have certain species that are too close together.

Parameters:specie_and_min_dist_dict – A species string to float mapping. For example, {“Na+”: 1} means that all Na+ ions must be at least 1 Angstrom away from each other. Multiple species criteria can be applied. Note that the testing is done based on the actual object . If you have a structure with Element, you must use {“Na”:1} instead to filter based on Element and not Specie.
as_dict()[source]
classmethod from_dict(d)[source]
test(structure)[source]
class SpeciesMaxDistFilter(sp1, sp2, max_dist)[source]

Bases: pymatgen.alchemy.filters.AbstractStructureFilter

This filter removes structures that do have two particular species that are not nearest neighbors by a predefined max_dist. For instance, if you are analyzing Li battery materials, you would expect that each Li+ would be nearest neighbor to lower oxidation state transition metal for electrostatic reasons. This only works if the structure is oxidation state decorated, as structures with only elemental sites are automatically assumed to have net charge of 0.

test(structure)[source]