pymatgen.analysis.graphs module

class ConnectedSite(site, jimage, index, weight, dist)

Bases: tuple

Create new instance of ConnectedSite(site, jimage, index, weight, dist)

dist

Alias for field number 4

index

Alias for field number 2

jimage

Alias for field number 1

site

Alias for field number 0

weight

Alias for field number 3

exception MolGraphSplitError[source]

Bases: Exception

class MoleculeGraph(molecule, graph_data=None)[source]

Bases: monty.json.MSONable

This is a class for annotating a Molecule with bond information, stored in the form of a graph. A “bond” does not necessarily have to be a chemical bond, but can store any kind of information that connects two Sites.

If constructing this class manually, use the with_empty_graph method or with_local_env_strategy method (using an algorithm provided by the local_env module, such as O’Keeffe).

This class that contains connection information: relationships between sites represented by a Graph structure, and an associated structure object.

This class uses the NetworkX package to store and operate on the graph itself, but contains a lot of helper methods to make associating a graph with a given molecule easier.

Use cases for this include storing bonding information, NMR J-couplings, Heisenberg exchange parameters, etc.

Parameters:
  • molecule – Molecule object
  • graph_data – dict containing graph information in

dict format (not intended to be constructed manually, see as_dict method for format)

add_edge(from_index, to_index, weight=None, warn_duplicates=True, edge_properties=None)[source]

Add edge to graph.

Since physically a ‘bond’ (or other connection between sites) doesn’t have a direction, from_index, from_jimage can be swapped with to_index, to_jimage.

However, images will always always be shifted so that from_index < to_index and from_jimage becomes (0, 0, 0).

Parameters:
  • from_index – index of site connecting from
  • to_index – index of site connecting to
  • (float) (weight) – e.g. bond length
  • (bool) (warn_duplicates) – if True, will warn if

trying to add duplicate edges (duplicate edges will not be added in either case) :param edge_properties (dict): any other information to store on graph edges, similar to Structure’s site_properties :return:

alter_edge(from_index, to_index, new_weight=None, new_edge_properties=None)[source]

Alters either the weight or the edge_properties of an edge in the MoleculeGraph.

Parameters:
  • from_index – int
  • to_index – int
  • new_weight – alter_edge does not require

that weight be altered. As such, by default, this is None. If weight is to be changed, it should be a float. :param new_edge_properties: alter_edge does not require that edge_properties be altered. As such, by default, this is None. If any edge properties are to be changed, it should be a dictionary of edge properties to be changed. :return:

as_dict()[source]

As in :Class: pymatgen.core.Molecule except with using to_dict_of_dicts from NetworkX to store graph information.

break_edge(from_index, to_index, allow_reverse=False)[source]

Remove an edge from the MoleculeGraph

Parameters:
  • from_index – int
  • to_index – int
  • allow_reverse – If allow_reverse is True, then break_edge will

attempt to break both (from_index, to_index) and, failing that, will attempt to break (to_index, from_index). :return:

build_unique_fragments()[source]

Find all possible fragment combinations of the MoleculeGraphs (in other words, all connected induced subgraphs)

Returns:
diff(other, strict=True)[source]

Compares two MoleculeGraphs. Returns dict with keys ‘self’, ‘other’, ‘both’ with edges that are present in only one MoleculeGraph (‘self’ and ‘other’), and edges that are present in both.

The Jaccard distance is a simple measure of the dissimilarity between two MoleculeGraphs (ignoring edge weights), and is defined by 1 - (size of the intersection / size of the union) of the sets of edges. This is returned with key ‘dist’.

Important note: all node indices are in terms of the MoleculeGraph this method is called from, not the ‘other’ MoleculeGraph: there is no guarantee the node indices will be the same if the underlying Molecules are ordered differently.

Parameters:
  • other – MoleculeGraph
  • strict – if False, will compare bonds

from different Molecules, with node indices replaced by Specie strings, will not count number of occurrences of bonds :return:

draw_graph_to_file(filename='graph', diff=None, hide_unconnected_nodes=False, hide_image_edges=True, edge_colors=False, node_labels=False, weight_labels=False, image_labels=False, color_scheme='VESTA', keep_dot=False, algo='fdp')[source]

Draws graph using GraphViz.

The networkx graph object itself can also be drawn with networkx’s in-built graph drawing methods, but note that this might give misleading results for multigraphs (edges are super-imposed on each other).

If visualization is difficult to interpret, hide_image_edges can help, especially in larger graphs.

Parameters:filename – filename to output, will detect filetype

from extension (any graphviz filetype supported, such as pdf or png) :param diff (StructureGraph): an additional graph to compare with, will color edges red that do not exist in diff and edges green that are in diff graph but not in the reference graph :param hide_unconnected_nodes: if True, hide unconnected nodes :param hide_image_edges: if True, do not draw edges that go through periodic boundaries :param edge_colors (bool): if True, use node colors to color edges :param node_labels (bool): if True, label nodes with species and site index :param weight_labels (bool): if True, label edges with weights :param image_labels (bool): if True, label edges with their periodic images (usually only used for debugging, edges to periodic images always appear as dashed lines) :param color_scheme (str): “VESTA” or “JMOL” :param keep_dot (bool): keep GraphViz .dot file for later visualization :param algo: any graphviz algo, “neato” (for simple graphs) or “fdp” (for more crowded graphs) usually give good outputs :return:

edge_weight_name

Name of the edge weight property of graph

Type:return
edge_weight_unit

Units of the edge weight property of graph

Type:return
find_rings(including=None)[source]

Find ring structures in the MoleculeGraph.

Parameters:including – list of site indices. If

including is not None, then find_rings will only return those rings including the specified sites. By default, this parameter is None, and all rings will be returned. :return: dict {index:cycle}. Each entry will be a ring (cycle, in graph theory terms) including the index found in the Molecule. If there is no cycle including an index, the value will be an empty list.

classmethod from_dict(d)[source]

As in :Class: pymatgen.core.Molecule except restoring graphs using from_dict_of_dicts from NetworkX to restore graph information.

get_connected_sites(n)[source]

Returns a named tuple of neighbors of site n: periodic_site, jimage, index, weight. Index is the index of the corresponding site in the original structure, weight can be None if not defined. :param n: index of Site in Molecule :param jimage: lattice vector of site :return: list of ConnectedSite tuples, sorted by closest first

get_coordination_of_site(n)[source]

Returns the number of neighbors of site n. In graph terms, simply returns degree of node corresponding to site n. :param n: index of site :return (int):

insert_node(i, species, coords, validate_proximity=False, site_properties=None, edges=None)[source]

A wrapper around Molecule.insert(), which also incorporates the new site into the MoleculeGraph.

Parameters:
  • i – Index at which to insert the new site
  • species – Species for the new site
  • coords – 3x1 array representing coordinates of the new site
  • validate_proximity – For Molecule.insert(); if True (default False), distance will be checked to ensure that site can be safely added.
  • site_properties – Site properties for Molecule
  • edges – List of dicts representing edges to be added to the MoleculeGraph. These edges must include the index of the new site i, and all indices used for these edges should reflect the MoleculeGraph AFTER the insertion, NOT before. Each dict should at least have a “to_index” and “from_index” key, and can also have a “weight” and a “properties” key.
Returns:

isomorphic_to(other)[source]

Checks if the graphs of two MoleculeGraphs are isomorphic to one another. In order to prevent problems with misdirected edges, both graphs are converted into undirected nx.Graph objects.

Parameters:other – MoleculeGraph object to be compared.
Returns:bool
name

Name of graph

Type:return
remove_nodes(indices)[source]

A wrapper for Molecule.remove_sites().

Parameters:indices – list of indices in the current Molecule (and graph) to be removed.
Returns:
replace_group(index, func_grp, strategy, bond_order=1, graph_dict=None, strategy_params=None, reorder=True, extend_structure=True)[source]

Builds off of Molecule.substitute and MoleculeGraph.substitute_group to replace a functional group in self.molecule with a functional group. This method also amends self.graph to incorporate the new functional group.

TODO: Figure out how to replace into a ring structure.

Parameters:
  • index – Index of atom to substitute.
  • func_grp

    Substituent molecule. There are three options:

    1. Providing an actual molecule as the input. The first atom must be a DummySpecie X, indicating the position of nearest neighbor. The second atom must be the next nearest atom. For example, for a methyl group substitution, func_grp should be X-CH3, where X is the first site and C is the second site. What the code will do is to remove the index site, and connect the nearest neighbor to the C atom in CH3. The X-C bond indicates the directionality to connect the atoms.
    2. A string name. The molecule will be obtained from the relevant template in func_groups.json.
    3. A MoleculeGraph object.
  • strategy – Class from pymatgen.analysis.local_env.
  • bond_order – A specified bond order to calculate the bond length between the attached functional group and the nearest neighbor site. Defaults to 1.
  • graph_dict – Dictionary representing the bonds of the functional group (format: {(u, v): props}, where props is a dictionary of properties, including weight. If None, then the algorithm will attempt to automatically determine bonds using one of a list of strategies defined in pymatgen.analysis.local_env.
  • strategy_params – dictionary of keyword arguments for strategy. If None, default parameters will be used.
  • reorder – bool, representing if graph nodes need to be reordered following the application of the local_env strategy
  • extend_structure – If True (default), then a large artificial box will be placed around the Molecule, because some strategies assume periodic boundary conditions.
Returns:

set_node_attributes()[source]

Replicates molecule site properties (specie, coords, etc.) in the MoleculeGraph.

Returns:
sort(key=None, reverse=False)[source]

Same as Molecule.sort(), also remaps nodes in graph. :param key: :param reverse: :return:

split_molecule_subgraphs(bonds, allow_reverse=False, alterations=None)[source]

Split MoleculeGraph into two or more MoleculeGraphs by breaking a set of bonds. This function uses MoleculeGraph.break_edge repeatedly to create disjoint graphs (two or more separate molecules). This function does not only alter the graph information, but also changes the underlying Moledules. If the bonds parameter does not include sufficient bonds to separate two molecule fragments, then this function will fail. Currently, this function naively assigns the charge of the total molecule to a single submolecule. A later effort will be to actually accurately assign charge. NOTE: This function does not modify the original MoleculeGraph. It creates a copy, modifies that, and returns two or more new MoleculeGraph objects.

Parameters:bonds – list of tuples (from_index, to_index)

representing bonds to be broken to split the MoleculeGraph. :param alterations: a dict {(from_index, to_index): alt}, where alt is a dictionary including weight and/or edge properties to be changed following the split. :param allow_reverse: If allow_reverse is True, then break_edge will attempt to break both (from_index, to_index) and, failing that, will attempt to break (to_index, from_index). :return: list of MoleculeGraphs

substitute_group(index, func_grp, strategy, bond_order=1, graph_dict=None, strategy_params=None, reorder=True, extend_structure=True)[source]

Builds off of Molecule.substitute to replace an atom in self.molecule with a functional group. This method also amends self.graph to incorporate the new functional group.

NOTE: using a MoleculeGraph will generally produce a different graph compared with using a Molecule or str (when not using graph_dict). This is because of the reordering that occurs when using some of the local_env strategies.

Parameters:
  • index – Index of atom to substitute.
  • func_grp

    Substituent molecule. There are three options:

    1. Providing an actual molecule as the input. The first atom must be a DummySpecie X, indicating the position of nearest neighbor. The second atom must be the next nearest atom. For example, for a methyl group substitution, func_grp should be X-CH3, where X is the first site and C is the second site. What the code will do is to remove the index site, and connect the nearest neighbor to the C atom in CH3. The X-C bond indicates the directionality to connect the atoms.
    2. A string name. The molecule will be obtained from the relevant template in func_groups.json.
    3. A MoleculeGraph object.
  • strategy – Class from pymatgen.analysis.local_env.
  • bond_order – A specified bond order to calculate the bond length between the attached functional group and the nearest neighbor site. Defaults to 1.
  • graph_dict – Dictionary representing the bonds of the functional group (format: {(u, v): props}, where props is a dictionary of properties, including weight. If None, then the algorithm will attempt to automatically determine bonds using one of a list of strategies defined in pymatgen.analysis.local_env.
  • strategy_params – dictionary of keyword arguments for strategy. If None, default parameters will be used.
  • reorder – bool, representing if graph nodes need to be reordered following the application of the local_env strategy
  • extend_structure – If True (default), then a large artificial box will be placed around the Molecule, because some strategies assume periodic boundary conditions.
Returns:

static with_edges(molecule, edges)[source]

Constructor for MoleculeGraph, using pre-existing or pre-defined edges with optional edge parameters.

Parameters:
  • molecule – Molecule object
  • edges – dict representing the bonds of the functional group (format: {(u, v): props}, where props is a dictionary of properties, including weight. Props should be None if no additional properties are to be specified.
Returns:

mg, a MoleculeGraph

classmethod with_empty_graph(molecule, name='bonds', edge_weight_name=None, edge_weight_units=None)[source]

Constructor for MoleculeGraph, returns a MoleculeGraph object with an empty graph (no edges, only nodes defined that correspond to Sites in Molecule).

Parameters:
  • (Molecule) (molecule) –
  • (str) (edge_weight_name) – name of graph, e.g. “bonds”
  • (str) – name of edge weights,

e.g. “bond_length” or “exchange_constant” :param edge_weight_units (str): name of edge weight units e.g. “Å” or “eV” :return (MoleculeGraph):

static with_local_env_strategy(molecule, strategy, reorder=True, extend_structure=True)[source]

Constructor for MoleculeGraph, using a strategy from :Class: pymatgen.analysis.local_env.

Parameters:
  • molecule – Molecule object
  • strategy – an instance of a :Class: pymatgen.analysis.local_env.NearNeighbors object
  • reorder – bool, representing if graph nodes need to be reordered following the application of the local_env strategy
  • extend_structure – If True (default), then a large artificial box will be placed around the Molecule, because some strategies assume periodic boundary conditions.
Returns:

mg, a MoleculeGraph

class StructureGraph(structure, graph_data=None)[source]

Bases: monty.json.MSONable

This is a class for annotating a Structure with bond information, stored in the form of a graph. A “bond” does not necessarily have to be a chemical bond, but can store any kind of information that connects two Sites.

If constructing this class manually, use the with_empty_graph method or with_local_env_strategy method (using an algorithm provided by the local_env module, such as O’Keeffe).

This class that contains connection information: relationships between sites represented by a Graph structure, and an associated structure object.

This class uses the NetworkX package to store and operate on the graph itself, but contains a lot of helper methods to make associating a graph with a given crystallographic structure easier.

Use cases for this include storing bonding information, NMR J-couplings, Heisenberg exchange parameters, etc.

For periodic graphs, class stores information on the graph edges of what lattice image the edge belongs to.

Parameters:
  • structure – a Structure object
  • graph_data – dict containing graph information in

dict format (not intended to be constructed manually, see as_dict method for format)

add_edge(from_index, to_index, from_jimage=(0, 0, 0), to_jimage=None, weight=None, warn_duplicates=True, edge_properties=None)[source]

Add edge to graph.

Since physically a ‘bond’ (or other connection between sites) doesn’t have a direction, from_index, from_jimage can be swapped with to_index, to_jimage.

However, images will always always be shifted so that from_index < to_index and from_jimage becomes (0, 0, 0).

Parameters:
  • from_index – index of site connecting from
  • to_index – index of site connecting to
  • (tuple of ints) (from_jimage) – lattice vector of periodic

image, e.g. (1, 0, 0) for periodic image in +x direction :param to_jimage (tuple of ints): lattice vector of image :param weight (float): e.g. bond length :param warn_duplicates (bool): if True, will warn if trying to add duplicate edges (duplicate edges will not be added in either case) :param edge_properties (dict): any other information to store on graph edges, similar to Structure’s site_properties :return:

alter_edge(from_index, to_index, to_jimage=None, new_weight=None, new_edge_properties=None)[source]

Alters either the weight or the edge_properties of an edge in the StructureGraph.

Parameters:
  • from_index – int
  • to_index – int
  • to_jimage – tuple
  • new_weight – alter_edge does not require

that weight be altered. As such, by default, this is None. If weight is to be changed, it should be a float. :param new_edge_properties: alter_edge does not require that edge_properties be altered. As such, by default, this is None. If any edge properties are to be changed, it should be a dictionary of edge properties to be changed. :return:

as_dict()[source]

As in :Class: pymatgen.core.Structure except with using to_dict_of_dicts from NetworkX to store graph information.

break_edge(from_index, to_index, to_jimage=None, allow_reverse=False)[source]

Remove an edge from the StructureGraph. If no image is given, this method will fail.

Parameters:
  • from_index – int
  • to_index – int
  • to_jimage – tuple
  • allow_reverse – If allow_reverse is True, then break_edge will

attempt to break both (from_index, to_index) and, failing that, will attempt to break (to_index, from_index). :return:

diff(other, strict=True)[source]

Compares two StructureGraphs. Returns dict with keys ‘self’, ‘other’, ‘both’ with edges that are present in only one StructureGraph (‘self’ and ‘other’), and edges that are present in both.

The Jaccard distance is a simple measure of the dissimilarity between two StructureGraphs (ignoring edge weights), and is defined by 1 - (size of the intersection / size of the union) of the sets of edges. This is returned with key ‘dist’.

Important note: all node indices are in terms of the StructureGraph this method is called from, not the ‘other’ StructureGraph: there is no guarantee the node indices will be the same if the underlying Structures are ordered differently.

Parameters:
  • other – StructureGraph
  • strict – if False, will compare bonds

from different Structures, with node indices replaced by Specie strings, will not count number of occurrences of bonds :return:

draw_graph_to_file(filename='graph', diff=None, hide_unconnected_nodes=False, hide_image_edges=True, edge_colors=False, node_labels=False, weight_labels=False, image_labels=False, color_scheme='VESTA', keep_dot=False, algo='fdp')[source]

Draws graph using GraphViz.

The networkx graph object itself can also be drawn with networkx’s in-built graph drawing methods, but note that this might give misleading results for multigraphs (edges are super-imposed on each other).

If visualization is difficult to interpret, hide_image_edges can help, especially in larger graphs.

Parameters:filename – filename to output, will detect filetype

from extension (any graphviz filetype supported, such as pdf or png) :param diff (StructureGraph): an additional graph to compare with, will color edges red that do not exist in diff and edges green that are in diff graph but not in the reference graph :param hide_unconnected_nodes: if True, hide unconnected nodes :param hide_image_edges: if True, do not draw edges that go through periodic boundaries :param edge_colors (bool): if True, use node colors to color edges :param node_labels (bool): if True, label nodes with species and site index :param weight_labels (bool): if True, label edges with weights :param image_labels (bool): if True, label edges with their periodic images (usually only used for debugging, edges to periodic images always appear as dashed lines) :param color_scheme (str): “VESTA” or “JMOL” :param keep_dot (bool): keep GraphViz .dot file for later visualization :param algo: any graphviz algo, “neato” (for simple graphs) or “fdp” (for more crowded graphs) usually give good outputs :return:

edge_weight_name

Name of the edge weight property of graph

Type:return
edge_weight_unit

Units of the edge weight property of graph

Type:return
classmethod from_dict(d)[source]

As in :Class: pymatgen.core.Structure except restoring graphs using from_dict_of_dicts from NetworkX to restore graph information.

get_connected_sites(n, jimage=(0, 0, 0))[source]

Returns a named tuple of neighbors of site n: periodic_site, jimage, index, weight. Index is the index of the corresponding site in the original structure, weight can be None if not defined. :param n: index of Site in Structure :param jimage: lattice vector of site :return: list of ConnectedSite tuples, sorted by closest first

get_coordination_of_site(n)[source]

Returns the number of neighbors of site n. In graph terms, simply returns degree of node corresponding to site n. :param n: index of site :return (int):

get_subgraphs_as_molecules(use_weights=False)[source]

Retrieve subgraphs as molecules, useful for extracting molecules from periodic crystals.

Will only return unique molecules, not any duplicates present in the crystal (a duplicate defined as an isomorphic subgraph).

Parameters:(bool) (use_weights) – If True, only treat subgraphs

as isomorphic if edges have the same weights. Typically, this means molecules will need to have the same bond lengths to be defined as duplicates, otherwise bond lengths can differ. This is a fairly robust approach, but will treat e.g. enantiomers as being duplicates.

Returns:list of unique Molecules in Structure
insert_node(i, species, coords, coords_are_cartesian=False, validate_proximity=False, site_properties=None, edges=None)[source]

A wrapper around Molecule.insert(), which also incorporates the new site into the MoleculeGraph.

Parameters:
  • i – Index at which to insert the new site
  • species – Species for the new site
  • coords – 3x1 array representing coordinates of the new site
  • coords_are_cartesian – Whether coordinates are cartesian. Defaults to False.
  • validate_proximity – For Molecule.insert(); if True (default False), distance will be checked to ensure that site can be safely added.
  • site_properties – Site properties for Molecule
  • edges – List of dicts representing edges to be added to the MoleculeGraph. These edges must include the index of the new site i, and all indices used for these edges should reflect the MoleculeGraph AFTER the insertion, NOT before. Each dict should at least have a “to_index” and “from_index” key, and can also have a “weight” and a “properties” key.
Returns:

name

Name of graph

Type:return
remove_nodes(indices)[source]

A wrapper for Molecule.remove_sites().

Parameters:indices – list of indices in the current Molecule (and graph) to be removed.
Returns:
set_node_attributes()[source]

Gives each node a “specie” and a “coords” attribute, updated with the current species and coordinates.

Returns:
sort(key=None, reverse=False)[source]

Same as Structure.sort(), also remaps nodes in graph. :param key: :param reverse: :return:

substitute_group(index, func_grp, strategy, bond_order=1, graph_dict=None, strategy_params=None)[source]

Builds off of Structure.substitute to replace an atom in self.structure with a functional group. This method also amends self.graph to incorporate the new functional group.

NOTE: Care must be taken to ensure that the functional group that is substituted will not place atoms to close to each other, or violate the dimensions of the Lattice.

Parameters:
  • index – Index of atom to substitute.
  • func_grp

    Substituent molecule. There are two options:

    1. Providing an actual Molecule as the input. The first atom must be a DummySpecie X, indicating the position of nearest neighbor. The second atom must be the next nearest atom. For example, for a methyl group substitution, func_grp should be X-CH3, where X is the first site and C is the second site. What the code will do is to remove the index site, and connect the nearest neighbor to the C atom in CH3. The X-C bond indicates the directionality to connect the atoms.
    2. A string name. The molecule will be obtained from the relevant template in func_groups.json.
  • strategy – Class from pymatgen.analysis.local_env.
  • bond_order – A specified bond order to calculate the bond length between the attached functional group and the nearest neighbor site. Defaults to 1.
  • graph_dict – Dictionary representing the bonds of the functional group (format: {(u, v): props}, where props is a dictionary of properties, including weight. If None, then the algorithm will attempt to automatically determine bonds using one of a list of strategies defined in pymatgen.analysis.local_env.
  • strategy_params – dictionary of keyword arguments for strategy. If None, default parameters will be used.
Returns:

types_and_weights_of_connections

Extract a dictionary summarizing the types and weights of edges in the graph.

Returns:A dictionary with keys specifying the

species involved in a connection in alphabetical order (e.g. string ‘Fe-O’) and values which are a list of weights for those connections (e.g. bond lengths).

types_of_coordination_environments(anonymous=False)[source]

Extract information on the different co-ordination environments present in the graph.

Parameters:anonymous – if anonymous, will replace specie names

with A, B, C, etc. :return: a list of co-ordination environments, e.g. [‘Mo-S(6)’, ‘S-Mo(3)’]

weight_statistics

Extract a statistical summary of edge weights present in the graph.

Returns:A dict with an ‘all_weights’ list, ‘minimum’,

‘maximum’, ‘median’, ‘mean’, ‘std_dev’

static with_edges(structure, edges)[source]

Constructor for MoleculeGraph, using pre-existing or pre-defined edges with optional edge parameters.

Parameters:
  • molecule – Molecule object
  • edges – dict representing the bonds of the functional group (format: {(from_index, to_index, from_image, to_image): props}, where props is a dictionary of properties, including weight. Props should be None if no additional properties are to be specified.
Returns:

sg, a StructureGraph

classmethod with_empty_graph(structure, name='bonds', edge_weight_name=None, edge_weight_units=None)[source]

Constructor for StructureGraph, returns a StructureGraph object with an empty graph (no edges, only nodes defined that correspond to Sites in Structure).

Parameters:
  • (Structure) (structure) –
  • (str) (edge_weight_name) – name of graph, e.g. “bonds”
  • (str) – name of edge weights,

e.g. “bond_length” or “exchange_constant” :param edge_weight_units (str): name of edge weight units e.g. “Å” or “eV” :return (StructureGraph):

static with_local_env_strategy(structure, strategy)[source]

Constructor for StructureGraph, using a strategy from :Class: pymatgen.analysis.local_env.

Parameters:
  • structure – Structure object
  • strategy – an instance of a :Class: pymatgen.analysis.local_env.NearNeighbors object
Returns: