pymatgen.analysis.dimensionality module

This module provides functions to get the dimensionality of a structure.

A number of different algorithms are implemented. These are based on the following publications:

get_dimensionality_larsen:
    1. Larsen, M. Pandey, M. Strange, K. W. Jacobsen, 2018, arXiv:1808.02114
get_dimensionality_cheon:
  • Cheon, G.; Duerloo, K.-A. N.; Sendek, A. D.; Porter, C.; Chen, Y.; Reed, E. J. Data Mining for New Two- and One-Dimensional Weakly Bonded Solids and Lattice-Commensurate Heterostructures. Nano Lett. 2017.
get_dimensionality_gorai:
  • Gorai, P., Toberer, E. & Stevanovic, V. Computational Identification of Promising Thermoelectric Materials Among Known Quasi-2D Binary Compounds. J. Mater. Chem. A 2, 4136 (2016).
calculate_dimensionality_of_site(bonded_structure, site_index, inc_vertices=False)[source]

Calculates the dimensionality of the component containing the given site.

Implements directly the modified breadth-first-search algorithm described in Algorithm 1 of:

  1. Larsem, M. Pandey, M. Strange, K. W. Jacobsen, 2018, arXiv:1808.02114
Parameters:
  • bonded_structure (StructureGraph) – A structure with bonds, represented as a pymatgen structure graph. For example, generated using the CrystalNN.get_bonded_structure() method.
  • site_index (int) – The index of a site in the component of interest.
  • inc_vertices (bool, optional) – Whether to return the vertices (site images) of the component.
Returns:

If inc_vertices is False, the dimensionality of the component will be returned as an int. If inc_vertices is true, the function will return a tuple of (dimensionality, vertices), where vertices is a list of tuples. E.g. [(0, 0, 0), (1, 1, 1)].

Return type:

(int or tuple)

find_clusters(struct, connected_list)[source]

Finds bonded clusters of atoms in the structure with periodic boundary conditions.

If there are atoms that are not bonded to anything, returns [0,1,0]. (For faster computation time in FindDimension())

Author: “Gowoon Cheon” Email: “gcheon@stanford.edu

Parameters:
  • struct (Structure) – Input structure
  • connected_list – Must be made from the same structure with FindConnected() function. An array of shape (number of bonded pairs, 2); each row of is of the form [atomi, atomj].
Returns:

the size of the largest cluster in the crystal structure min_cluster: the size of the smallest cluster in the crystal structure clusters: list of bonded clusters found here, clusters are formatted as sets of indices of atoms

Return type:

max_cluster

find_connected_atoms(struct, tolerance=0.45, ldict={'Ac': 1.88, 'Ag': 1.59, 'Al': 1.35, 'Am': 1.51, 'Ar': 1.57, 'As': 1.21, 'At': 1.7, 'Au': 1.5, 'B': 0.83, 'Ba': 1.34, 'Be': 0.35, 'Bh': 1.6, 'Bi': 1.54, 'Bk': 1.5, 'Br': 1.21, 'C': 0.68, 'Ca': 0.99, 'Cd': 1.69, 'Ce': 1.83, 'Cf': 1.5, 'Cl': 0.99, 'Cm': 1.5, 'Co': 1.33, 'Cr': 1.35, 'Cs': 1.67, 'Cu': 1.52, 'Db': 1.6, 'Dy': 1.75, 'Er': 1.73, 'Es': 1.5, 'Eu': 1.99, 'F': 0.64, 'Fe': 1.34, 'Fm': 1.5, 'Fr': 2, 'Ga': 1.22, 'Gd': 1.79, 'Ge': 1.17, 'H': 0.23, 'He': 0.93, 'Hf': 1.57, 'Hg': 1.7, 'Ho': 1.74, 'Hs': 1.6, 'I': 1.4, 'In': 1.63, 'Ir': 1.32, 'K': 1.33, 'Kr': 1.91, 'La': 1.87, 'Li': 0.68, 'Lr': 1.5, 'Lu': 1.72, 'Md': 1.5, 'Mg': 1.1, 'Mn': 1.35, 'Mo': 1.47, 'Mt': 1.6, 'N': 0.68, 'Na': 0.97, 'Nb': 1.48, 'Nd': 1.81, 'Ne': 1.12, 'Ni': 1.5, 'No': 1.5, 'Np': 1.55, 'O': 0.68, 'Os': 1.37, 'P': 0.75, 'Pa': 1.61, 'Pb': 1.54, 'Pd': 1.5, 'Pm': 1.8, 'Po': 1.68, 'Pr': 1.82, 'Pt': 1.5, 'Pu': 1.53, 'Ra': 1.9, 'Rb': 1.47, 'Re': 1.35, 'Rf': 1.6, 'Rh': 1.45, 'Rn': 2.4, 'Ru': 1.4, 'S': 1.02, 'Sb': 1.46, 'Sc': 1.44, 'Se': 1.22, 'Sg': 1.6, 'Si': 1.2, 'Sm': 1.8, 'Sn': 1.46, 'Sr': 1.12, 'Ta': 1.43, 'Tb': 1.76, 'Tc': 1.35, 'Te': 1.47, 'Th': 1.79, 'Ti': 1.47, 'Tl': 1.55, 'Tm': 1.72, 'U': 1.58, 'V': 1.33, 'W': 1.37, 'Xe': 1.98, 'Y': 1.78, 'Yb': 1.94, 'Zn': 1.45, 'Zr': 1.56})[source]

Finds the list of bonded atoms.

Author: “Gowoon Cheon” Email: “gcheon@stanford.edu

Parameters:
  • struct (Structure) – Input structure
  • tolerance – length in angstroms used in finding bonded atoms. Two atoms are considered bonded if (radius of atom 1) + (radius of atom 2) + (tolerance) < (distance between atoms 1 and 2). Default value = 0.45, the value used by JMol and Cheon et al.
  • ldict – dictionary of bond lengths used in finding bonded atoms. Values from JMol are used as default
Returns:

A numpy array of shape (number of bonded pairs, 2); each row of is of the form [atomi, atomj]. atomi and atomj are the indices of the atoms in the input structure. If any image of atomj is bonded to atomi with periodic boundary conditions, [atomi, atomj] is included in the list. If atomi is bonded to multiple images of atomj, it is only counted once.

Return type:

(np.ndarray)

get_dimensionality_cheon(structure_raw, tolerance=0.45, ldict={'Ac': 1.88, 'Ag': 1.59, 'Al': 1.35, 'Am': 1.51, 'Ar': 1.57, 'As': 1.21, 'At': 1.7, 'Au': 1.5, 'B': 0.83, 'Ba': 1.34, 'Be': 0.35, 'Bh': 1.6, 'Bi': 1.54, 'Bk': 1.5, 'Br': 1.21, 'C': 0.68, 'Ca': 0.99, 'Cd': 1.69, 'Ce': 1.83, 'Cf': 1.5, 'Cl': 0.99, 'Cm': 1.5, 'Co': 1.33, 'Cr': 1.35, 'Cs': 1.67, 'Cu': 1.52, 'Db': 1.6, 'Dy': 1.75, 'Er': 1.73, 'Es': 1.5, 'Eu': 1.99, 'F': 0.64, 'Fe': 1.34, 'Fm': 1.5, 'Fr': 2, 'Ga': 1.22, 'Gd': 1.79, 'Ge': 1.17, 'H': 0.23, 'He': 0.93, 'Hf': 1.57, 'Hg': 1.7, 'Ho': 1.74, 'Hs': 1.6, 'I': 1.4, 'In': 1.63, 'Ir': 1.32, 'K': 1.33, 'Kr': 1.91, 'La': 1.87, 'Li': 0.68, 'Lr': 1.5, 'Lu': 1.72, 'Md': 1.5, 'Mg': 1.1, 'Mn': 1.35, 'Mo': 1.47, 'Mt': 1.6, 'N': 0.68, 'Na': 0.97, 'Nb': 1.48, 'Nd': 1.81, 'Ne': 1.12, 'Ni': 1.5, 'No': 1.5, 'Np': 1.55, 'O': 0.68, 'Os': 1.37, 'P': 0.75, 'Pa': 1.61, 'Pb': 1.54, 'Pd': 1.5, 'Pm': 1.8, 'Po': 1.68, 'Pr': 1.82, 'Pt': 1.5, 'Pu': 1.53, 'Ra': 1.9, 'Rb': 1.47, 'Re': 1.35, 'Rf': 1.6, 'Rh': 1.45, 'Rn': 2.4, 'Ru': 1.4, 'S': 1.02, 'Sb': 1.46, 'Sc': 1.44, 'Se': 1.22, 'Sg': 1.6, 'Si': 1.2, 'Sm': 1.8, 'Sn': 1.46, 'Sr': 1.12, 'Ta': 1.43, 'Tb': 1.76, 'Tc': 1.35, 'Te': 1.47, 'Th': 1.79, 'Ti': 1.47, 'Tl': 1.55, 'Tm': 1.72, 'U': 1.58, 'V': 1.33, 'W': 1.37, 'Xe': 1.98, 'Y': 1.78, 'Yb': 1.94, 'Zn': 1.45, 'Zr': 1.56}, standardize=True)[source]

Algorithm for finding the dimensions of connected subunits in a structure. This method finds the dimensionality of the material even when the material is not layered along low-index planes, or does not have flat layers/molecular wires.

Author: “Gowoon Cheon” Email: “gcheon@stanford.edu

See details at :

Cheon, G.; Duerloo, K.-A. N.; Sendek, A. D.; Porter, C.; Chen, Y.; Reed, E. J. Data Mining for New Two- and One-Dimensional Weakly Bonded Solids and Lattice-Commensurate Heterostructures. Nano Lett. 2017.

Parameters:
  • structure_raw (Structure) – A pymatgen Structure object.
  • tolerance (float) – length in angstroms used in finding bonded atoms. Two atoms are considered bonded if (radius of atom 1) + (radius of atom 2) + (tolerance) < (distance between atoms 1 and 2). Default value = 0.45, the value used by JMol and Cheon et al.
  • ldict (dict) – dictionary of bond lengths used in finding bonded atoms. Values from JMol are used as default
  • standardize – works with conventional standard structures if True. It is recommended to keep this as True.
Returns:

dimension of the largest cluster as a string. If there are ions or molecules it returns ‘intercalated ion/molecule’

Return type:

(str)

get_dimensionality_gorai(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 Quasi-2D 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 auto-detection 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_dimensionality_larsen(bonded_structure)[source]

Gets the dimensionality of a bonded structure.

The dimensionality of the structure is the highest dimensionality of all structure components. This method is very robust and can handle many tricky structures, regardless of structure type or improper connections due to periodic boundary conditions.

Requires a StructureGraph object as input. This can be generated using one of the NearNeighbor classes. For example, using the CrystalNN class:

bonded_structure = CrystalNN().get_bonded_structure(structure)

Based on the modified breadth-first-search algorithm described in:

  1. Larsem, M. Pandey, M. Strange, K. W. Jacobsen, 2018, arXiv:1808.02114
Parameters:bonded_structure (StructureGraph) – A structure with bonds, represented as a pymatgen structure graph. For example, generated using the CrystalNN.get_bonded_structure() method.
Returns:The dimensionality of the structure.
Return type:(int)
get_structure_components(bonded_structure, inc_orientation=False, inc_site_ids=False, inc_molecule_graph=False)[source]

Gets information on the components in a bonded structure.

Correctly determines the dimensionality of all structures, regardless of structure type or improper connections due to periodic boundary conditions.

Requires a StructureGraph object as input. This can be generated using one of the NearNeighbor classes. For example, using the CrystalNN class:

bonded_structure = CrystalNN().get_bonded_structure(structure)

Based on the modified breadth-first-search algorithm described in:

  1. Larsem, M. Pandey, M. Strange, K. W. Jacobsen, 2018, arXiv:1808.02114
Parameters:
  • bonded_structure (StructureGraph) – A structure with bonds, represented as a pymatgen structure graph. For example, generated using the CrystalNN.get_bonded_structure() method.
  • inc_orientation (bool, optional) – Whether to include the orientation of the structure component. For surfaces, the miller index is given, for one-dimensional structures, the direction of the chain is given.
  • inc_site_ids (bool, optional) – Whether to include the site indices of the sites in the structure component.
  • inc_molecule_graph (bool, optional) – Whether to include MoleculeGraph objects for zero-dimensional components.
Returns:

Information on the components in a structure as a list of dictionaries with the keys:

  • ”structure_graph”: A pymatgen StructureGraph object for the
    component.
  • ”dimensionality”: The dimensionality of the structure component as an
    int.
  • ”orientation”: If inc_orientation is True, the orientation of the
    component as a tuple. E.g. (1, 1, 1)
  • ”site_ids”: If inc_site_ids is True, the site indices of the
    sites in the component as a tuple.
  • ”molecule_graph”: If inc_molecule_graph is True, the site a
    MoleculeGraph object for zero-dimensional components.

Return type:

(list of dict)

zero_d_graph_to_molecule_graph(bonded_structure, graph)[source]

Converts a zero-dimensional networkx Graph object into a MoleculeGraph.

Implements a similar breadth-first search to that in calculate_dimensionality_of_site().

Parameters:
  • bonded_structure (StructureGraph) – A structure with bonds, represented as a pymatgen structure graph. For example, generated using the CrystalNN.get_bonded_structure() method.
  • graph (nx.Graph) – A networkx Graph object for the component of interest.
Returns:

A MoleculeGraph object of the component.

Return type:

(MoleculeGraph)