Supercell matrix#

Utility functions to enumerate supercell matrices.

get_three_factors(n)[source]#

Enumerate all three-factor decompositions of an integer.

Note

Do not use this to factorize a large integer with many allowed factors!

Parameters:

n (int) – The integer to factorize.

Returns:

All three-factor decompositions of the input integer.

Return type:

list of tuples of int

is_duplicate_sc(m1, m2, prim)[source]#

Check whether two super-cell matrices are symmetrically identical.

Parameters:
  • m1 (3*3 ArrayLike of int) – Supercell matrices to compare.

  • m2 (3*3 ArrayLike of int) – Supercell matrices to compare.

  • prim (Structure) – Primitive cell object.

Returns:

Whether the two super-cell matrices are symmetrically equivalent.

Return type:

bool

is_proper_sc(sc_matrix, lat, max_cond=8, min_angle=30)[source]#

Assess the quality of a given supercell matrix.

If too skewed or too slender, this matrix will be dropped because it typically causes poor DFT convergence.

Parameters:
  • sc_matrix (3 * 3 ArrayLike) – Supercell matrix

  • lat (Lattice) – Lattice of the primitive cell

  • max_cond (float) – optional Maximum conditional number allowed in the supercell lattice matrix. This is to avoid overly imbalance in the lengths of three lattice vectors. By default, set to 8.

  • min_angle (float) – optional Minimum allowed angle of the supercell lattice. By default, set to 30 degrees to prevent over-skewing.

Returns:

Whether the super-cell matrix is proper to be used in structure enumeration.

Return type:

bool