crystal_torture.Cluster

class crystal_torture.Cluster(nodes)

Bases: object

Cluster class: group of connected nodes within graph

grow_cluster(key=None, value=None)

Grow cluster by adding neighbours

Args:
key (str): label key to selectively choose nodes in cluster value : value for label to selectively choose nodes in cluster
is_neighbour(other_cluster)

Check if one cluster of nodes is connected to another

merge(other_cluster)

Merge two clusters into one

Args:
other_cluster (Cluster): cluster to be joined
return_index_node(index)
return_key_nodes(key, value)

Returns the nodes in a cluster corresponding to a particular label

Args:
key (str): Dictionary key for filtering nodes value : value held in dictionary for label key
Returns:
key_nodes (set(Node)): set of nodes in cluster for which (node.labels[key] == value)
return_uc_indices()

Returns the unit-cell indices of nodes in a cluster (i.e. reduces the full list of uc_indices included in the unit-cell and the halo to contain the indices only once)

Args: None

Returns:
uc_nodes (set(Int)): set of unit-cell indices for nodes in cluster
torture_fort()

Performs tortuosity analysis on nodes in cluster using BFS in Fortran90 and OpenMP: Significantly faster than the python version above for large systems. Calculates the integer number of node-node steps it requires to get from a node to its periodic image.

Args:
None
Returns:
None
Sets:
node.tortuosity (int): tortuosity for node self.tortuosity (int): average tortuosity for cluster
torture_py()

Performs tortuosity analysis on nodes in cluster in pure python using a BFS: Calculates the integer number of node-node steps it requires to get from a node to its periodic image.

Args:
None
Returns:
None
Sets:
node.tortuosity (int): tortuosity for node self.tortuosity (int): average tortuosity for cluster