crystal_torture.pymatgen_doping

crystal_torture.pymatgen_doping.count_sites(structure, species=None, labels=None)

Given structure object and either specie string or label string, it counts and returns the number of sites with that species or label (or both) in the structure

Args:
  • structure (Structure): pymatgen structure object
  • species ({str}): site species to count
  • labels ({str}): site labels to count
Returns:
  • (int): number of sites occupied by species or label (or both) in structure
crystal_torture.pymatgen_doping.dope_structure(structure, conc, species_to_rem, species_to_insert, label_to_remove=None)

Dope a pymatgen structure object to a particular concentration (within the bounds of integer sites). Removes conc * no(species_to_remove) from structure and inserts species to insert in their place. Does so at random (excepting when label_to_remove is passed)

Args:
  • structure (Structure): pymatgen structure object
  • conc (real): fractional % of sites to remove
  • species_to_rem (str): the species to remove from structure
  • species_to_insert ([str,str]): a list of species to equally distribute over sites that are removed
  • label_to_remove (str): label of sites to select for removal.
crystal_torture.pymatgen_doping.dope_structure_by_no(structure, no_dopants, species_to_rem, species_to_insert, label_to_remove=None)

Dope a pymatgen structure object by swapping ‘no_dopants’ of ‘species_to_rem’ from the original structure. Removes no_dopants(species_to_remove) from structure and inserts species to insert in their place. Does so at random (excepting when label_to_remove is passed)

Args:
  • structure (Structure): pymatgen structure object
  • no_dopants (int): no of each type of dopant to insert
  • species_to_remove (str): the species to remove from structure
  • species_to_insert ([str,str]): a list of species to equally distribute over sites that are removed
  • label_to_remove (str): label of sites to select for removal.
crystal_torture.pymatgen_doping.index_sites(structure, species=None, labels=None)

Return a list of the site indices in a structure that are occupied by specie or label (or both)

Args:
  • structure (Structure): pymatgen structure object
  • species ({str}): site species to count
  • label ({str}): site label to count
Returns:
  • ([int]): list with site indices occupied by species or label (or both) in structure
crystal_torture.pymatgen_doping.sort_structure(structure, order)

Given a pymatgen structure object sort the species so that their indices sit side by side in the structure, in given order - allows for POSCAR file to be written in a readable way after doping

Args:
  • structure (Structure): pymatgen structure object
  • order ([str,str..]): list of species str in order to sort
Returns:
  • structure (Structure): ordered pymatgen Structure object