pyspinw.util#
Generally helpful functions that don’t obviously live anywhere else in particular
Functions
|
Check for approximate equality of arrays that may or may not have the same shape |
|
Get the connected components of a graph specied by an adjacency matrix |
Show an example of making a matrix that does the triple product |
|
|
Check whether an array is diagonal |
|
Find sites that are contradictory in terms of magnetism |
|
Rotation matrix from (0,0,1) to the target vector direction |
|
Create a rotation matrix |
Find the matrix, M, such that for all vectors X, Y |
Classes
|
Histogramming method for finding nearest neighbour distances in lattices |
- class pyspinw.util.IncrementalPointHistogram(tolerance=1e-10)#
Bases:
Generic[T]Histogramming method for finding nearest neighbour distances in lattices
- add(distance, entry: T)#
Add an entry to the collection
- group_sizes()#
Size of each group
- groups()#
Groups in order of distance
- n_groups()#
Number of groups at different distances
- pyspinw.util.arraylike_equality(array_1: ArrayLike, array_2: ArrayLike, abs_tol=1e-08)#
Check for approximate equality of arrays that may or may not have the same shape
- pyspinw.util.connected_components(adjacency_matrix: ndarray) list[list[int]]#
Get the connected components of a graph specied by an adjacency matrix
- Parameters:
adjacency_matrix – n-by-n numpy array of dtype bool representing the adjacency matrix
- Returns:
list of subgraphs, themselves lists of indices for the adjacency matrix
- pyspinw.util.demo_triple_product_matrix()#
Show an example of making a matrix that does the triple product
- pyspinw.util.is_diagonal(m: ndarray)#
Check whether an array is diagonal
- pyspinw.util.problematic_sites(sites: list[Site], implied_sites: list[Site], site_to_implied_site: list[list[int]])#
Find sites that are contradictory in terms of magnetism
These sites have an image with same position but negated spin
- Parameters:
sites – Asymmetric cell sites
implied_sites – Sites inferred by symmetry
site_to_implied_site – mapping from site index to implied site index
- Returns:
Indices of sites with this problem
- pyspinw.util.rotation_from_z(target_vector)#
Rotation matrix from (0,0,1) to the target vector direction
- pyspinw.util.rotation_matrix(angle, axis)#
Create a rotation matrix
- pyspinw.util.triple_product_matrix(v: ndarray)#
Find the matrix, M, such that for all vectors X, Y
X^T M Y = V . (X x Y)