grogupy.utilities module
- grogupy.utilities.RotM(theta, u, eps=1e-10)[source]
Definition of rotation matrix with angle theta around direction u.
- Args:
- thetafloat
The angle of rotation
- unp.array_like
The rotation axis
- epsfloat, optional
Cutoff for small elements in the resulting matrix. Defaults to 1e-10
- Returns:
- np.array_like
The rotation matrix
- grogupy.utilities.RotMa2b(a, b, eps=1e-10)[source]
Definition of rotation matrix rotating unit vector a to unit vector b.
Function returns array R such that R @ a = b holds.
- Args:
- anp.array_like
First vector
- bnp.array_like
Second vector
- epsfloat, optional
Cutoff for small elements in the resulting matrix. Defaults to 1e-10
- Returns:
- np.array_like
The rotation matrix with the above property
- grogupy.utilities.commutator(a, b)[source]
Shorthand for commutator.
Commutator of two matrices in the mathematical sense.
- Args:
- anp.array_like
The first matrix
- bnp.array_like
The second matrix
- Returns:
- np.array_like
The commutator of a and b
- grogupy.utilities.crossM(u)[source]
Definition for the cross-product matrix.
It acts as a cross product with vector u.
- Args:
- ulist or np.array_like
The second vector in the cross product
- Returns:
- np.array_like
The matrix that represents teh cross product with a vector
- grogupy.utilities.hsk(H, ss, sc_off, k=(0, 0, 0))[source]
Speed up Hk and Sk generation.
Calculates the Hamiltonian and the Overlap matrix at a given k point. It is faster that the sisl version.
- Args:
- Hnp.array_like
Hamiltonian in spin box form
- ssnp.array_like
Overlap matrix in spin box form
- sc_offlist
supercell indexes of the Hamiltonian
- ktuple, optional
The k point where the matrices are set up. Defaults to (0, 0, 0)
- Returns:
- np.array_like
Hamiltonian at the given k point
- np.array_like
Overlap matrix at the given k point
- grogupy.utilities.int_de_ke(traced, we)[source]
It numerically integrates the traced matrix.
It is a wrapper from numpy.trapz and it contains the relevant constants to calculate the energy integral from equation 93 or 96.
- Args:
- tracednp.array_like
The trace of a matrix or a matrix product
- wefloat
The weight of a point on the contour
- Returns:
- float
The energy calculated from the integral formula
- grogupy.utilities.make_contour(emin=-20, emax=0.0, enum=42, p=150)[source]
A more sophisticated contour generator.
Calculates the parameters for the complex contour integral. It uses the Legendre-Gauss quadrature method. It returns a class that contains the information for the contour integral.
- Args:
- eminint, optional
Energy minimum of the contour. Defaults to -20
- emaxfloat, optional
Energy maximum of the contour. Defaults to 0.0, so the Fermi level
- enumint, optional
Number of sample points along the contour. Defaults to 42
- pint, optional
Shape parameter that describes the distribution of the sample points. Defaults to 150
- Returns:
- ccont
Contains all the information for the contour integral
- grogupy.utilities.make_kset(dirs='xyz', NUMK=20)[source]
Simple k-grid generator to sample the Brillouin zone.
Depending on the value of the dirs argument k sampling in 1,2 or 3 dimensions is generated. If dirs argument does not contain either of x, y or z a kset of a single k-pont at the origin is returned. The total number of k points is the NUMK**(dimensions)
- Args:
- dirsstr, optional
Directions of the k points in the Brillouin zone. They are the three lattice vectors. Defaults to “xyz”
- NUMKint, optional
The number of k points in a direction. Defaults to 20
- Returns:
- np.array_like
An array of k points that uniformly sample the Brillouin zone in the given directions