crystal_torture.graph.Graph

class crystal_torture.graph.Graph(clusters: set[Cluster], structure: Structure | None = None)[source]

Bases: object

Graph class: group of disconnected clusters making up full graph.

property minimal_clusters: list[minimal_Cluster]

Get minimal clusters.

Returns:

List of minimal cluster objects.

Raises:

ValueError – If minimal_clusters is not set until graph.torture() or graph.torture_py() have been called.

output_clusters(fmt: str, periodic: bool | None = None) None[source]

Output the unique unit cell clusters from the graph.

Parameters:
  • fmt – Output format for pymatgen structures set up from clusters.

  • periodic – Whether to output only periodic clusters.

Outputs:

CLUS_*.{fmt}: A cluster structure file for each cluster in the graph.

return_frac_percolating() float[source]

Calculate the fraction of nodes in the graph that are in a periodic cluster.

Returns:

nodes in graph in periodic clusters / total number of nodes.

Return type:

Fraction

return_periodic_structure(fmt: str) Structure[source]

Gather all periodic clusters in the graph as a single pymatgen Structure.

Parameters:

fmt – Output format for pymatgen structure set up from cluster.

Returns:

Structure object containing all periodic clusters.

set_minimal_clusters() None[source]

Access to the information on unique unit cell clusters.

Cycles through the halo clusters, gets a set unique cluster sites and sets up minimal_Cluster object to store and access the data.

Sets:

self.min_clusters: A list of minimal_Cluster objects for unit cell in graph.

set_site_tortuosity() None[source]

Set a dict containing the site by site tortuosity for sites in the graph unit cell.

torture() None[source]

Torture the graph and set node tortuosity for UC nodes in cluster.

This only tortures UC nodes in each cluster, but the graph contains a halo of clusters.

torture_py() None[source]

Torture the graph and set node tortuosity for UC nodes in cluster.

This only tortures UC nodes in each cluster, but the graph contains a halo of clusters. Uses pure Python implementation.