SiteAnalyzer
- class emmet.core.featurization.robocrys.condense.site.SiteAnalyzer(bonded_structure, use_symmetry_equivalent_sites=False, symprec=0.01, minimum_geometry_op=0.4, use_iupac_formula=True)
Bases:
objectClass to extract information on site geometry and bonding.
- Attributes:
- symmetry_labels: A
dictmapping the site indices to the symmetry label for that site. If two sites are symmetrically equivalent they share the same symmetry label. The numbering begins at 1 for each element in the structure.
- equivalent_sites: A
listof indices mapping each site in the structure to a symmetrically or structurally equivalent site, depending on the value of
use_symmetry_equivalent_sites.
- symmetry_labels: A
- Args:
- bonded_structure: A bonded structure with nearest neighbor data
included. For example generated using
pymatgen.analysis.local_env.CrystalNNorpymatgen.analysis.local_env.VoronoiNN.- use_symmetry_equivalent_sites: Whether to use symmetry to determine if
sites are inequivalent. If
False, the site geometry and (next) nearest neighbor information will be used.- symprec: The tolerance used when determining the symmetry of
the structure. The symmetry can used both to determine if multiple sites are symmetrically equivalent and to obtain the symmetry labels for each site.
- minimum_geometry_op: The minimum geometrical order parameter for a
geometry match to be returned.
- use_iupac_formula (bool, optional): Whether to order formulas
by the iupac “electronegativity” series, defined in Table VI of “Nomenclature of Inorganic Chemistry (IUPAC Recommendations 2005)”. This ordering effectively follows the groups and rows of the periodic table, except the Lanthanides, Actanides and hydrogen. If set to
False, the elements will be ordered according to the electronegativity values.
- Parameters:
bonded_structure (StructureGraph)
use_symmetry_equivalent_sites (bool)
symprec (float)
minimum_geometry_op (float)
use_iupac_formula (bool)
- get_site_geometry(site_index)
Gets the bonding geometry of a site.
For example, “octahedral” or “square-planar”.
- Return type:
dict[str,str|float]- Parameters:
site_index (int)
- Args:
site_index: The site index (zero based).
- Returns:
The site geometry information formatted at as:
{'type': geometry_type, 'likeness': order_parameter}
Where
geometry_typeis astrcorresponding to the geometry type (e.g. octahedral) andorder_parameteris afloatindicating whether how close the geometry is to the perfect geometry. If the largest geometrical order parameter falls beneathrobocrys.site.SiteAnalyzer.minimum_geometry_op, the geometry type will be returned as “X-coordinate”, where X is the coordination number.
- get_nearest_neighbors(site_index, inc_inequivalent_site_index=True)
Gets information about the bonded nearest neighbors.
- Return type:
list[dict[str,Any]]- Parameters:
site_index (int)
inc_inequivalent_site_index (bool)
- Args:
site_index: The site index (zero based). inc_inequivalent_site_index: Whether to include the inequivalent
site indices in the nearest neighbor information.
- Returns:
For each site bonded to
site_index, returns adictwith the format:{'element': el, 'dist': distance}
If
inc_inequivalent_site_index=True, the data will have an additional key'inequiv_index'corresponding to the inequivalent site index. E.g. if two sites are structurally/symmetrically equivalent (depending on the value ofself.use_symmetry_equivalent_sitesthen they will have the sameinequiv_index.
- get_next_nearest_neighbors(site_index, inc_inequivalent_site_index=True)
Gets information about the bonded next nearest neighbors.
- Return type:
list[dict[str,Any]]- Parameters:
site_index (int)
inc_inequivalent_site_index (bool)
- Args:
site_index: The site index (zero based). inc_inequivalent_site_index: Whether to include the inequivalent
site indices.
- Returns:
A list of the next nearest neighbor information. For each next nearest neighbor site, returns a
dictwith the format:{'element': el, 'connectivity': con, 'geometry': geom, 'angles': angles, 'distance': distance}
The
connectivityproperty is the connectivity type to the next nearest neighbor, e.g. “face”, “corner”, or “edge”. Thegeometryproperty gives the geometry of the next nearest neighbor site. See theget_site_geometrymethod for the format of this data. Theanglesproperty gives the bond angles between the site and the next nearest neighbour. Returned as alistofint. Multiple bond angles are given when the two sites share more than nearest neighbor (e.g. if they are face-sharing or edge-sharing). Thedistanceproperty gives the distance between the site and the next nearest neighbor. Ifinc_inequivalent_site_index=True, the data will have an additional key'inequiv_index'corresponding to the inequivalent site index. E.g. if two sites are structurally/symmetrically equivalent (depending on the value ofself.use_symmetry_equivalent_sitesthen they will have the sameinequiv_index.
- get_site_summary(site_index)
Gets a summary of the site information.
- Return type:
dict[str,Any]- Parameters:
site_index (int)
- Args:
site_index: The site index (zero based).
- Returns:
A summary of the site information, formatted as:
{ 'element': 'Mo4+', 'geometry': { 'likesness': 0.5544, 'type': 'pentagonal pyramidal' }, 'nn': [2, 2, 2, 2, 2, 2], 'nnn': {'edge': [0, 0, 0, 0, 0, 0]}, 'poly_formula': 'S6', 'sym_labels': (1,) }
Where
elementis the species string (if the species has oxidation states, these will be included in the string). Thegeometrykey is the geometry information as produced bySiteAnalyzer.get_site_geometry(). The nn key lists the site indices of the nearest neighbor bonding sites. Note the inequivalent site index is given for each site. The nnn key gives the next nearest neighbor information, broken up by the connectivity to that neighbor. Thepoly_formulakey gives the formula of the bonded nearest neighbors.poly_formulawill beNoneif the site geometry is not inrobocrys.util.connected_geometries. Thesym_labelskey gives the symmetry labels of the site. If two sites are symmetrically equivalent they share the same symmetry label. The numbering begins at 1 for each element in the structure. IfSiteAnalyzer.use_symmetry_inequivalnt_sitesisFalse, each site may have more than one symmetry label, as structural features have instead been used to determine the site equivalences, i.e. two sites are symmetrically distinct but share the same geometry, nearest neighbor and next nearest neighbor properties.
- get_bond_distance_summary(site_index)
Gets the bond distance summary for a site.
- Return type:
dict[int,list[float]]- Parameters:
site_index (int)
- Args:
site_index: The site index (zero based).
- Returns:
The bonding data for the site, formatted as:
{to_site: [dist_1, dist_2, dist_3, ...]}
Where
to_siteis the index of a nearest neighbor site anddist_1etc are the bond distances asfloat.
- get_connectivity_angle_summary(site_index)
Gets the connectivity angle summary for a site.
The connectivity angles are the angles between a site and its next nearest neighbors.
- Return type:
dict[int,dict[str,list[float]]]- Parameters:
site_index (int)
- Args:
site_index: The site index (zero based).
- Returns:
The connectivity angle data for the site, formatted as:
{ to_site: { connectivity_a: [angle_1, angle_2, ...] connectivity_b: [angle_1, angle_2, ...] } }
Where
to_siteis the index of a next nearest neighbor site,connectivity_aetc are the bonding connectivity type, e.g.'edge'or'corner'(for edge-sharing and corner-sharing connectivity), andangle_1etc are the bond angles asfloat.
- get_nnn_distance_summary(site_index)
Gets the next nearest neighbor distance summary for a site.
- Return type:
dict[int,dict[str,list[float]]]- Parameters:
site_index (int)
- Args:
site_index: The site index (zero based).
- Returns:
The connectivity distance data for the site, formatted as:
{ to_site: { connectivity_a: [distance_1, distance_2, ...] connectivity_b: [distance_1, distance_2, ...] } }
Where
to_siteis the index of a next nearest neighbor site,connectivity_aetc are the bonding connectivity type, e.g.'edge'or'corner'(for edge-sharing and corner-sharing connectivity), anddistance_1etc are the bond angles asfloat.
- get_all_site_summaries()
Gets the site summaries for all sites.
- Returns:
The site summaries for all sites, formatted as:
{ site_index: site_summary }
Where
site_summaryhas the same format as produced bySiteAnalyzer.get_site_summary().
- get_all_bond_distance_summaries()
Gets the bond distance summaries for all sites.
- Return type:
dict[int,dict[int,list[float]]]
- Returns:
The bond distance summaries for all sites, formatted as:
{ from_site: { to_site: distances } }
Where
from_siteandto_siteare site indices anddistancesis alistoffloatof bond distances.
- get_all_connectivity_angle_summaries()
Gets the connectivity angle summaries for all sites.
The connectivity angles are the angles between a site and its next nearest neighbors.
- Return type:
dict[int,dict[int,dict[str,list[float]]]]
- Returns:
The connectivity angle summaries for all sites, formatted as:
{ from_site: { to_site: { connectivity: angles } } }
Where
from_siteandto_siteare the site indices of two sites,connectivityis the connectivity type (e.g.'edge'or'face') andanglesis alistoffloatof connectivity angles.
- get_all_nnn_distance_summaries()
Gets the next nearest neighbor distance summaries for all sites.
- Return type:
dict[int,dict[int,dict[str,list[float]]]]
- Returns:
The next nearest neighbor distance summaries for all sites, formatted as:
{ from_site: { to_site: { connectivity: distances } } }
Where
from_siteandto_siteare the site indices of two sites,connectivityis the connectivity type (e.g.'edge'or'face') anddistancesis alistoffloatof distances.
- get_inequivalent_site_indices(site_indices)
Gets the inequivalent site indices from a list of site indices.
- Return type:
list[int]- Parameters:
site_indices (list[int])
- Args:
site_indices: The site indices.
- Returns:
The inequivalent site indices. For example, if a structure has 4 sites where the first two are equivalent and the last two are inequivalent. If
site_indices=[0, 1, 2, 3]the output will be:[0, 0, 2, 3]