topo_metrics.topology#

Classes#

RingsResults

Topology

A class detailing the topology of a network, based on nodes and edges.

Node

A representation of a node in a network.

Functions#

get_all_node_frac_coords(...)

Return the fractional coordinates of all nodes in the network.

Module Contents#

class topo_metrics.topology.RingsResults[source]#

Bases: NamedTuple

depth: int[source]#

The depth to which the rings were searcher for.

rings_are_strong: bool[source]#

Whether the rings were filtered to strong rings only.

ring_size_count: topo_metrics.rings.RingSizeCounts[source]#

The number of rings of a given size, of shape (**, 2) where the first column indicates the ring size, and the second indicates the number of rings of that size.

clusters: list[topo_metrics.clusters.Cluster][source]#

Each node can be characterised in terms of the rings in which it participates. This can be summarised using common metrics such as Vertex Symbols.

class topo_metrics.topology.Topology[source]#

A class detailing the topology of a network, based on nodes and edges.

nodes: list[Node][source]#
edges: numpy.typing.NDArray[numpy.int_][source]#
lattice: pymatgen.core.lattice.Lattice | None = None[source]#
properties: dict[Hashable, Any][source]#
classmethod from_ase(ase_atoms: ase.Atoms, cutoff: float = 0.0, pair_cutoffs: dict[tuple[str, str], float] | None = None, remove_types: Iterable[Any] | None = None, remove_degree2: bool = False) Topology[source]#

Creates a Topology object from an ASE Atoms object.

Parameters:

ase_atoms – The ASE Atoms object representing the structure.

Return type:

A Topology object representing the network as nodes and edges.

classmethod from_cgd(filename: pathlib.Path | str) Topology[source]#

Parses and loads a CGD file with an adjacency matrix.

Parameters:

filename – The path to the CGD file.

Return type:

A Topology object representing the network as nodes and edges.

Parses and loads a conflink file.

Parameters:
  • filename – The path to the conflink file.

  • node_type – The type to assign to all nodes in the topology.

Return type:

A Topology object representing the network as nodes and edges.

classmethod from_lammps_data(filename: pathlib.Path | str, *, atom_style: str = 'atomic', units: str = 'metal', sort_by_id: bool = True, prefer_bonds: bool = True, cutoff: float = 0.0, pair_cutoffs: dict[tuple[str, str], float] | None = None, contract_neighborlist: bool = False, remove_types: Iterable[Any] | None = None, remove_degree2: bool = False, omit_node_types: bool = False) Topology[source]#

Create a Topology from a LAMMPS data file.

If the file contains a Bonds section, bonds are used as the edge list, and periodic image shifts are inferred assuming MIC. Otherwise edges are inferred by cutoff.

get_rings(depth: int = 12) list[topo_metrics.ring_geometry.RingGeometry][source]#

Computes or retrieves unique rings in the network.

Parameters:

depth – The maximum depth to search for rings.

Notes

  • In the previous implementation, this method returned the clusters of rings at each node. This is obtained instead via the get_clusters method. This method now returns all unique rings in the network as RingGeometry objects.

get_clusters(depth: int = 12, strong: bool = False) RingsResults[source]#

Computes or retrieves ring statistics for the network.

Parameters:
  • depth – The maximum depth to search for rings.

  • strong – Whether to filter the rings to strong rings only.

Return type:

A dictionary containing the ring statistics.

get_topological_genome() str[source]#

Returns a the topology code for the framework.

Notes

  • The topological genome is a finite series of numbers that is provably unique for each net.

  • It can be comptued in polynomial time with respect to the size of the net.

get_coordination_sequences(max_shell: int = 10, node_ids: Iterable[int] | int | None = None) numpy.typing.NDArray[numpy.int_][source]#

Return coordination sequences for specified nodes.

Parameters:
  • max_shell – The maximum shell to compute coordination sequences to.

  • node_ids – The node IDs for which to compute coordination sequences. If None, coordination sequences for all nodes are returned.

property cartesian_coordinates: numpy.typing.NDArray[numpy.floating][source]#

Return the Cartesian positions of all nodes in the network.

property fractional_coordinates: numpy.typing.NDArray[numpy.floating][source]#

Return the fractional positions of all nodes in the network.

class topo_metrics.topology.Node[source]#

A representation of a node in a network.

node_id: int[source]#
node_type: str | None = 'Si'[source]#
frac_coord: numpy.typing.NDArray[numpy.floating] | None = None[source]#
cart_coord: numpy.typing.NDArray[numpy.floating] | None = None[source]#
is_shifted: bool = False[source]#
apply_image_shift(lattice: pymatgen.core.lattice.Lattice, image_shift: numpy.typing.NDArray[numpy.int_]) Node[source]#

Apply the image shift to this node and return a new Node object.

Parameters:
  • lattice – The lattice object for the network.

  • image_shift – The shift vector to apply to the node coordinates.

Return type:

A new Node object with the shifted coordinates.

topo_metrics.topology.get_all_node_frac_coords(nodes: list[Node]) numpy.typing.NDArray[numpy.floating][source]#

Return the fractional coordinates of all nodes in the network.