# pymatgen.analysis.chemenv.coordination_environments.structure_environments module¶

class ChemicalEnvironments(coord_geoms=None)[source]

Bases: monty.json.MSONable

Class used to store all the information about the chemical environment of a given site for a given list of coordinated neighbours (internally called “cn_map”)

Initializes the ChemicalEnvironments object containing all the information about the chemical environment of a given site :param coord_geoms: coordination geometries to be added to the chemical environment.

add_coord_geom(mp_symbol, symmetry_measure, algo='UNKNOWN', permutation=None, override=False, local2perfect_map=None, perfect2local_map=None, detailed_voronoi_index=None, other_symmetry_measures=None, rotation_matrix=None, scaling_factor=None)[source]

Adds a coordination geometry to the ChemicalEnvironments object :param mp_symbol: Symbol (internal) of the coordination geometry added :param symmetry_measure: Symmetry measure of the coordination geometry added :param algo: Algorithm used for the search of the coordination geometry added :param permutation: Permutation of the neighbors that leads to the csm stored :param override: If set to True, the coordination geometry will override the existent one if present :return: :raise: ChemenvError if the coordination geometry is already added and override is set to False

as_dict()[source]

Returns a dictionary representation of the ChemicalEnvironments object :return:

classmethod from_dict(d)[source]

Reconstructs the ChemicalEnvironments object from a dict representation of the ChemicalEnvironments created using the as_dict method. :param d: dict representation of the ChemicalEnvironments object :return: ChemicalEnvironments object

is_close_to(other, rtol=0.0, atol=1e-08)[source]
minimum_geometries(n=None, symmetry_measure_type=None, max_csm=None)[source]

Returns a list of geometries with increasing continuous symmetry measure in this ChemicalEnvironments object :param n: Number of geometries to be included in the list :return: list of geometries with increasing continuous symmetry measure in this ChemicalEnvironments object :raise: ValueError if no coordination geometry is found in this ChemicalEnvironments object

minimum_geometry(symmetry_measure_type=None, max_csm=None)[source]

Returns the geometry with the minimum continuous symmetry measure of this ChemicalEnvironments :return: tuple (symbol, csm) with symbol being the geometry with the minimum continuous symmetry measure and csm being the continuous symmetry measure associted to it :raise: ValueError if no coordination geometry is found in this ChemicalEnvironments object

class LightStructureEnvironments(strategy, coordination_environments=None, all_nbs_sites=None, neighbors_sets=None, structure=None, valences=None, valences_origin=None)[source]

Bases: monty.json.MSONable

Class used to store the chemical environments of a given structure obtained from a given ChemenvStrategy. Currently, only strategies leading to the determination of a unique environment for each site is allowed This class does not store all the information contained in the StructureEnvironments object, only the coordination environment found

Constructor for the LightStructureEnvironments object.

DEFAULT_STATISTICS_FIELDS = ['anion_list', 'anion_atom_list', 'cation_list', 'cation_atom_list', 'neutral_list', 'neutral_atom_list', 'atom_coordination_environments_present', 'ion_coordination_environments_present', 'fraction_atom_coordination_environments_present', 'fraction_ion_coordination_environments_present', 'coordination_environments_atom_present', 'coordination_environments_ion_present']
DELTA_MAX_OXIDATION_STATE = 0.1
class NeighborsSet(structure, isite, all_nbs_sites, all_nbs_sites_indices)[source]

Bases: object

Class used to store a given set of neighbors of a given site (based on a list of sites, the voronoi container is not part of the LightStructureEnvironments object).

as_dict()[source]
classmethod from_dict(dd, structure, all_nbs_sites)[source]
neighb_coords
neighb_indices_and_images
neighb_sites
neighb_sites_and_indices
as_dict()[source]

Bson-serializable dict representation of the LightStructureEnvironments object. :return: Bson-serializable dict representation of the LightStructureEnvironments object.

clear_environments(conditions=None)[source]
contains_only_one_anion(anion)[source]
contains_only_one_anion_atom(anion_atom)[source]
classmethod from_dict(d)[source]

Reconstructs the LightStructureEnvironments object from a dict representation of the LightStructureEnvironments created using the as_dict method. :param d: dict representation of the LightStructureEnvironments object :return: LightStructureEnvironments object

classmethod from_structure_environments(strategy, structure_environments, valences=None, valences_origin=None)[source]
get_site_info_for_specie_allces(specie, min_fraction=0.0)[source]
get_site_info_for_specie_ce(specie, ce_symbol, min_fraction=0.0)[source]
get_statistics(statistics_fields=['anion_list', 'anion_atom_list', 'cation_list', 'cation_atom_list', 'neutral_list', 'neutral_atom_list', 'atom_coordination_environments_present', 'ion_coordination_environments_present', 'fraction_atom_coordination_environments_present', 'fraction_ion_coordination_environments_present', 'coordination_environments_atom_present', 'coordination_environments_ion_present'], bson_compatible=False)[source]
setup_statistic_lists()[source]
site_contains_environment(isite, ce_symbol)[source]
site_has_clear_environment(isite, conditions=None)[source]
structure_contains_atom_environment(atom_symbol, ce_symbol)[source]

Checks whether the structure contains a given atom in a given environment :param atom_symbol: Symbol of the atom :param ce_symbol: Symbol of the coordination environment :return: True if the coordination environment is found, False otherwise

structure_has_clear_environments(conditions=None, skip_none=True, skip_empty=False)[source]
uniquely_determines_coordination_environments

True if the coordination environments are uniquely determined.

class StructureEnvironments(voronoi, valences, sites_map, equivalent_sites, ce_list, structure, neighbors_sets=None, info=None)[source]

Bases: monty.json.MSONable

Class used to store the chemical environments of a given structure.

Constructor for the StructureEnvironments object. :param voronoi: VoronoiContainer object for the structure :param valences: Valences provided :param sites_map: Mapping of equivalent sites to the unequivalent sites that have been computed. :param equivalent_sites: List of list of equivalent sites of the structure :param struct_sites_to_irreducible_site_list_map: Maps the index of a site to the index of the item in the list of equivalent sites to which the site belongs. :param ce_list: List of chemical environments :param structure: Structure object

AC = <pymatgen.analysis.chemenv.utils.defs_utils.AdditionalConditions object>
class NeighborsSet(structure, isite, detailed_voronoi, site_voronoi_indices, sources=None)[source]

Bases: object

Class used to store a given set of neighbors of a given site (based on the detailed_voronoi).

add_source(source)[source]
angle_plateau()[source]
angles
as_dict()[source]
coords
distance_plateau()[source]
distances
classmethod from_dict(dd, structure, detailed_voronoi)[source]
get_neighb_voronoi_indices(permutation)[source]
info
neighb_coords
neighb_sites
neighb_sites_and_indices
normalized_angles
normalized_distances
source
sphere_fraction_angles
voronoi_grid_surface_points(additional_condition=1, other_origins='DO_NOTHING')[source]

Get the surface points in the Voronoi grid for this neighbor from the sources. The general shape of the points should look like a staircase such as in the following figure :

^
0.0|

B—-C
| |
| |

a | k D——-E n | | | g | | | l | | | e | j F—-n———G

| |
| |
A—-g——-h—-i———H

1.0+————————————————->
1.0 distance 2.0 ->+Inf
Parameters: additional_condition – Additional condition for the neighbors. other_origins – What to do with sources that do not come from the Voronoi grid (e.g. “from hints”)
add_neighbors_set(isite, nb_set)[source]
as_dict()[source]

Bson-serializable dict representation of the StructureEnvironments object. :return: Bson-serializable dict representation of the StructureEnvironments object.

differences_wrt(other)[source]
classmethod from_dict(d)[source]

Reconstructs the StructureEnvironments object from a dict representation of the StructureEnvironments created using the as_dict method. :param d: dict representation of the StructureEnvironments object :return: StructureEnvironments object

get_coordination_environments(isite, cn, nb_set)[source]
get_csm(isite, mp_symbol)[source]
get_csm_and_maps(isite, max_csm=8.0, figsize=None, symmetry_measure_type=None)[source]
get_csms(isite, mp_symbol)[source]
Returns the continuous symmetry measure(s) of site with index isite with respect to the
perfect coordination environment with mp_symbol. For some environments, a given mp_symbol might not be available (if there is no voronoi parameters leading to a number of neighbours corresponding to the coordination number of environment mp_symbol). For some environments, a given mp_symbol might lead to more than one csm (when two or more different voronoi parameters lead to different neighbours but with same number of neighbours).
Parameters: isite – Index of the site mp_symbol – MP symbol of the perfect environment for which the csm has to be given List of csms for site isite with respect to geometry mp_symbol
get_environments_figure(isite, plot_type=None, title='Coordination numbers', max_dist=2.0, additional_condition=1, colormap=None, figsize=None, strategy=None)[source]

Plotting of the coordination environments of a given site for all the distfactor/angfactor regions. The chemical environments with the lowest continuous symmetry measure is shown for each distfactor/angfactor region as the value for the color of that distfactor/angfactor region (using a colormap). :param isite: Index of the site for which the plot has to be done :param plot_type: How to plot the coordinations :param title: Title for the figure :param max_dist: Maximum distance to be plotted when the plotting of the distance is set to ‘initial_normalized’

or ‘initial_real’ (Warning: this is not the same meaning in both cases! In the first case, the closest atom lies at a “normalized” distance of 1.0 so that 2.0 means refers to this normalized distance while in the second case, the real distance is used)
Parameters: figsize – Size of the figure to be plotted The figure object to be plotted or saved to file
init_neighbors_sets(isite, additional_conditions=None, valences=None)[source]
plot_csm_and_maps(isite, max_csm=8.0)[source]

Plotting of the coordination numbers of a given site for all the distfactor/angfactor parameters. If the chemical environments are given, a color map is added to the plot, with the lowest continuous symmetry measure as the value for the color of that distfactor/angfactor set. :param isite: Index of the site for which the plot has to be done :param plot_type: How to plot the coordinations :param title: Title for the figure :param max_dist: Maximum distance to be plotted when the plotting of the distance is set to ‘initial_normalized’

or ‘initial_real’ (Warning: this is not the same meaning in both cases! In the first case, the closest atom lies at a “normalized” distance of 1.0 so that 2.0 means refers to this normalized distance while in the second case, the real distance is used)
Parameters: figsize – Size of the figure to be plotted Nothing returned, just plot the figure
plot_environments(isite, plot_type=None, title='Coordination numbers', max_dist=2.0, additional_condition=1, figsize=None, strategy=None)[source]

Plotting of the coordination numbers of a given site for all the distfactor/angfactor parameters. If the chemical environments are given, a color map is added to the plot, with the lowest continuous symmetry measure as the value for the color of that distfactor/angfactor set. :param isite: Index of the site for which the plot has to be done :param plot_type: How to plot the coordinations :param title: Title for the figure :param max_dist: Maximum distance to be plotted when the plotting of the distance is set to ‘initial_normalized’

or ‘initial_real’ (Warning: this is not the same meaning in both cases! In the first case, the closest atom lies at a “normalized” distance of 1.0 so that 2.0 means refers to this normalized distance while in the second case, the real distance is used)
Parameters: figsize – Size of the figure to be plotted Nothing returned, just plot the figure
save_environments_figure(isite, imagename='image.png', plot_type=None, title='Coordination numbers', max_dist=2.0, additional_condition=1, figsize=None)[source]
update_coordination_environments(isite, cn, nb_set, ce)[source]