pymatgen.analysis.structure_analyzer module¶

class
OxideType
(structure, relative_cutoff=1.1)[source]¶ Bases:
object
Separate class for determining oxide type.
Parameters:  structure – Input structure.
 relative_cutoff – Relative_cutoff * act. cutoff stipulates the max. distance two O atoms must be from each other. Default value is 1.1. At most 1.1 is recommended, nothing larger, otherwise the script cannot distinguish between superoxides and peroxides.

class
RelaxationAnalyzer
(initial_structure, final_structure)[source]¶ Bases:
object
This class analyzes the relaxation in a calculation.
Please note that the input and final structures should have the same ordering of sites. This is typically the case for most computational codes.
Parameters: 
get_percentage_bond_dist_changes
(max_radius=3.0)[source]¶ Returns the percentage bond distance changes for each site up to a maximum radius for nearest neighbors.
Parameters: max_radius (float) – Maximum radius to search for nearest neighbors. This radius is applied to the initial structure, not the final structure. Returns: Bond distance changes as a dict of dicts. E.g., {index1: {index2: 0.011, …}}. For economy of representation, the index1 is always less than index2, i.e., since bonding between site1 and siten is the same as bonding between siten and site1, there is no reason to duplicate the information or computation.


class
VoronoiAnalyzer
(cutoff=5.0, qhull_options='Qbb Qc Qz')[source]¶ Bases:
object
Performs a statistical analysis of Voronoi polyhedra around each site. Each Voronoi polyhedron is described using Schaefli notation. That is a set of indices {c_i} where c_i is the number of faces with i number of vertices. E.g. for a bcc crystal, there is only one polyhedron notation of which is [0,6,0,8,0,0,…]. In perfect crystals, these also corresponds to the WignerSeitz cells. For distortedcrystals, liquids or amorphous structures, rather than onetype, there is a statistical distribution of polyhedra. See ref: Microstructure and its relaxation in FeB amorphous system simulated by molecular dynamics,
Stepanyuk et al., J. Noncryst. Solids (1993), 159, 8087.Parameters:  cutoff (float) – cutoff distance to search for neighbors of a given atom (default = 5.0)
 qhull_options (str) – options to pass to qhull (optional)

analyze
(structure, n=0)[source]¶ Performs Voronoi analysis and returns the polyhedra around atom n in Schlaefli notation.
Parameters:  structure (Structure) – structure to analyze
 n (int) – index of the center atom in structure
Returns:  <c3,c4,c6,c6,c7,c8,c9,c10>
where c_i denotes number of facets with i vertices.
Return type: voronoi index of n

analyze_structures
(structures, step_freq=10, most_frequent_polyhedra=15)[source]¶ Perform Voronoi analysis on a list of Structures. Note that this might take a significant amount of time depending on the size and number of structures.
Parameters:  structures (list) – list of Structures
 (float (cutoff) – cutoff distance around an atom to search for neighbors
 step_freq (int) – perform analysis every step_freq steps
 qhull_options (str) – options to pass to qhull
 most_frequent_polyhedra (int) – this many unique polyhedra with highest frequences is stored.
Returns: A list of tuples in the form (voronoi_index,frequency)

class
VoronoiConnectivity
(structure, cutoff=10)[source]¶ Bases:
object
Computes the solid angles swept out by the shared face of the voronoi polyhedron between two sites.
Parameters:  structure (Structure) – Input structure
 cutoff (float) –

connectivity_array
¶ Provides connectivity array.
Returns: An array of shape [atomi, atomj, imagej]. atomi is the index of the atom in the input structure. Since the second atom can be outside of the unit cell, it must be described by both an atom index and an image index. Array data is the solid angle of polygon between atomi and imagej of atomj Return type: connectivity

get_connections
()[source]¶ Returns a list of site pairs that are Voronoi Neighbors, along with their realspace distances.

get_sitej
(site_index, image_index)[source]¶ Assuming there is some value in the connectivity array at indices (1, 3, 12). sitei can be obtained directly from the input structure (structure[1]). sitej can be obtained by passing 3, 12 to this function
Parameters:  site_index (int) – index of the site (3 in the example)
 image_index (int) – index of the image (12 in the example)

max_connectivity
¶ returns the 2d array [sitei, sitej] that represents the maximum connectivity of site i to any periodic image of site j

average_coordination_number
(structures, freq=10)[source]¶ Calculates the ensemble averaged Voronoi coordination numbers of a list of Structures using VoronoiNN. Typically used for analyzing the output of a Molecular Dynamics run. :param structures: list of Structures. :type structures: list :param freq: sampling frequency of coordination number [every freq steps]. :type freq: int
Returns: Dictionary of elements as keys and average coordination numbers as values.

contains_peroxide
(structure, relative_cutoff=1.1)[source]¶ Determines if a structure contains peroxide anions.
Parameters:  structure (Structure) – Input structure.
 relative_cutoff – The peroxide bond distance is 1.49 Angstrom. Relative_cutoff * 1.49 stipulates the maximum distance two O atoms must be to each other to be considered a peroxide.
Returns: Boolean indicating if structure contains a peroxide anion.

get_dimensionality
(structure, max_hkl=2, el_radius_updates=None, min_slab_size=5, min_vacuum_size=5, standardize=True, bonds=None)[source]¶ This method returns whether a structure is 3D, 2D (layered), or 1D (linear chains or molecules) according to the algorithm published in Gorai, P., Toberer, E. & Stevanovic, V. Computational Identification of Promising Thermoelectric Materials Among Known Quasi2D Binary Compounds. J. Mater. Chem. A 2, 4136 (2016).
Note that a 1D structure detection might indicate problems in the bonding algorithm, particularly for ionic crystals (e.g., NaCl)
Users can change the behavior of bonds detection by passing either el_radius_updates to update atomic radii for autodetection of max bond distances, or bonds to explicitly specify max bond distances for atom pairs. Note that if you pass both, el_radius_updates are ignored.
Parameters:  structure – (Structure) structure to analyze dimensionality for
 max_hkl – (int) max index of planes to look for layers
 el_radius_updates – (dict) symbol>float to update atomic radii
 min_slab_size – (float) internal surface construction parameter
 min_vacuum_size – (float) internal surface construction parameter
 standardize (bool) – whether to standardize the structure before analysis. Set to False only if you already have the structure in a convention where layers / chains will be along low <hkl> indexes.
 bonds ({(specie1, specie2) – max_bond_dist}: bonds are specified as a dict of tuples: float of specie1, specie2 and the max bonding distance. For example, PO4 groups may be defined as {(“P”, “O”): 3}.
 Returns: (int) the dimensionality of the structure  1 (molecules/chains),
 2 (layered), or 3 (3D)

get_max_bond_lengths
(structure, el_radius_updates=None)[source]¶ Provides max bond length estimates for a structure based on the JMol table and algorithms.
Parameters:  structure – (structure)
 el_radius_updates – (dict) symbol>float to update atomic radii
 Returns: (dict)  (Element1, Element2) > float. The two elements are
 ordered by Z.

oxide_type
(structure, relative_cutoff=1.1, return_nbonds=False)[source]¶ Determines if an oxide is a peroxide/superoxide/ozonide/normal oxide
Parameters:  structure (Structure) – Input structure.
 relative_cutoff (float) – Relative_cutoff * act. cutoff stipulates the max distance two O atoms must be from each other.
 return_nbonds (bool) – Should number of bonds be requested?