bsym.interface.pymatgen

bsym.interface.pymatgen.configuration_space_from_molecule(molecule, subset=None, atol=1e-05)[source]

Generate a ConfigurationSpace object from a pymatgen Molecule.

Parameters:
  • molecule (pymatgen Molecule) – molecule to be used to define the ConfigurationSpace.
  • subset (Optional [list]) – list of atom indices to be used for generating the configuration space.
  • atol (Optional [float]) – tolerance factor for the pymatgen `coordinate mapping`_ under each symmetry operation.
Returns:

a new ConfigurationSpace instance.

bsym.interface.pymatgen.configuration_space_from_structure(structure, subset=None, atol=1e-05)[source]

Generate a ConfigurationSpace object from a pymatgen Structure.

Parameters:
  • structure (pymatgen Structure) – structure to be used to define the ConfigurationSpace.
  • subset (Optional [list]) – list of atom indices to be used for generating the configuration space.
  • atol (Optional [float]) – tolerance factor for the pymatgen `coordinate mapping`_ under each symmetry operation.
Returns:

a new ConfigurationSpace instance.

bsym.interface.pymatgen.molecule_cartesian_coordinates_mapping(molecule, symmop)[source]

Maps the coordinates of pymatgen Molecule according to a SymmOp symmetry operation.

Parameters:
  • molecule (Structure) – The pymatgen Molecule.
  • symmop (SymmOp) – The pymatgen symmetry operation object.
Returns
(np.array): The mapped Cartesian coordinates.
bsym.interface.pymatgen.molecule_mapping_list(new_molecule, mapping_molecule, atol)[source]

Gives the index mapping between two pymatgen Molecule objects.

Parameters:
  • new_structure (Molecule) –
  • mapping_structure (Molecule) –
Returns:

list of indices such that mapping_molecule.sites[indices] == new_molecule.sites

bsym.interface.pymatgen.new_structure_from_substitution(parent_structure, site_substitution_index, new_species_list)[source]

Generate a new pymatgen Structure from site substitution parameters.

Parameters:
  • parent_structure (Structure) – The parent pymatgen Struture object.
  • site_substitution_index (list[int]) – The list of site indices to be substituted.
  • new_species_list (list[str]) – A list of the replacement atomic species.
Returns:

The new pymatgen Structure.

Return type:

(Structure)

Notes

pymatgen Structure and Molecule classes both subclass SiteCollection. This function will also accept a parent Molecule object, and return a new Molecule.

bsym.interface.pymatgen.parse_site_distribution(site_distribution)[source]

Converts a site distribution using species labels into one using integer labels.

Parameters:site_distribution (dict) – e.g. { ‘Mg’: 1, ‘Li’: 3 }
Returns:e.g. { 1:1, 0:3 } numeric_site_mapping (dict): e.g. { 0:’Mg’, 1:’Li’ }
Return type:numeric_site_distribution ( dict)
bsym.interface.pymatgen.point_group_from_molecule(molecule, subset=None, atol=1e-05)[source]

Generates a PointGroup object from a pymatgen Molecule.

Parameters:
  • molecule (pymatgen Molecule) – molecule to be used to define the PointGroup.
  • subset (Optional [list]) – list of atom indices to be used for generating the symmetry operations.
  • atol (Optional [float]) – tolerance factor for the pymatgen `coordinate mapping`_ under each symmetry operation.
Returns:

a new PointGroup instance

bsym.interface.pymatgen.space_group_from_structure(structure, subset=None, atol=1e-05)[source]

Generates a SpaceGroup object from a pymatgen Structure.

Parameters:
  • structure (pymatgen Structure) – structure to be used to define the SpaceGroup.
  • subset (Optional [list]) – list of atom indices to be used for generating the symmetry operations.
  • atol (Optional [float]) – tolerance factor for the pymatgen `coordinate mapping`_ under each symmetry operation.
Returns:

a new SpaceGroup instance

bsym.interface.pymatgen.space_group_symbol_from_structure(structure)[source]

Returns the symbol for the space group defined by this structure.

Parameters:structure (pymatgen Structure) – The input structure.
Returns:The space group symbol.
Return type:(str)
bsym.interface.pymatgen.structure_cartesian_coordinates_mapping(structure, symmop)[source]

Maps the coordinates of pymatgen Structure according to a SymmOp symmetry operation.

Parameters:
  • structure (Structure) – The pymatgen Structure.
  • symmop (SymmOp) – The pymatgen symmetry operation object.
Returns
(np.array): The mapped Cartesian coordinates.
bsym.interface.pymatgen.structure_mapping_list(new_structure, mapping_structure, atol)[source]

Gives the index mapping between two pymatgen Structure objects.

Parameters:
  • new_structure (Structure) –
  • mapping_structure (Structure) –
Returns:

list of indices such that mapping_structure.sites[indices] == new_structure.sites

bsym.interface.pymatgen.unique_structure_substitutions(structure, to_substitute, site_distribution, verbose=False, atol=1e-05, show_progress=False)[source]

Generate all symmetry-unique structures formed by substituting a set of sites in a pymatgen structure.

Parameters:
  • structure (pymatgen.Structure) – The parent structure.
  • to_substitute (str) – atom label for the sites to be substituted.
  • site_distribution (dict) – A dictionary that defines the number of each substituting element.
  • verbose (bool) – verbose output.
  • atol (Optional [float]) – tolerance factor for the pymatgen `coordinate mapping`_ under each symmetry operation. Default=1e-5.
  • (opt (show_progress) – default=False): Show a progress bar. Setting to True gives a simple progress bar. Setting to “notebook” gives a Jupyter notebook compatible progress bar.
Returns:

A list of Structure objects for each unique substitution.

Return type:

(list[Structure])

Notes

The number of symmetry-equivalent configurations for each structure is stored in the number_of_equivalent_configurations attribute.

If the parent structure was previously generated using this function (as part of a sequence of substitutions) the full configuration degeneracy of each symmetry inequivalent configuration is stored in the full_configuration_degeneracy attribute. If the parent structure is a standard Pymatgen Structure object, number_of_equivalent_configurations and full_configuration_degeneracy will be equal.

bsym.interface.pymatgen.unique_symmetry_operations_as_vectors_from_structure(structure, verbose=False, subset=None, atol=1e-05)[source]

Uses pymatgen symmetry analysis to find the minimum complete set of symmetry operations for the space group of a structure.

Parameters:
  • structure (pymatgen Structure) – structure to be analysed.
  • subset (Optional [list]) – list of atom indices to be used for generating the symmetry operations.
  • atol (Optional [float]) – tolerance factor for the pymatgen `coordinate mapping`_ under each symmetry operation.
Returns:

a list of lists, containing the symmetry operations as vector mappings.

Return type:

(list[list])