Skip to content

Commit

Permalink
fix MAE.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mailhexu committed Jun 4, 2024
1 parent 2e7430a commit d29c9eb
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions TB2J/abacus/MAE.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from TB2J.mathutils.rotate_spin import rotate_Matrix_from_z_to_axis
from TB2J.kpoints import monkhorst_pack
from TB2J.mathutils.fermi import fermi
from TB2J.mathutils.kR_convert import k_to_R, R_to_k
from TB2J.mathutils.kR_convert import R_to_k
from scipy.linalg import eigh
from copy import deepcopy
from scipy.spatial.transform import Rotation
Expand Down Expand Up @@ -159,17 +159,18 @@ def get_band_energy_from_rho(self, axis):
Hk_xc = rotate_Matrix_from_z_to_axis(self.Hk_xc_ref[ik], axis)
Hk_soc = self.Hk_soc_ref[ik]
Htot = Hk_xc + Hk_soc * self.model.soc_lambda
Sk = self.Sk_ref[ik]
# Sk = self.Sk_ref[ik]
# evals, evecs = eigh(Htot, Sk)
# rho2= np.einsum("ib, b, jb -> ij", evecs, fermi(evals, self.model.efermi, width=0.05), evecs.conj())
if ik == 0 and False:
print(f"{evecs[:4,0:4].real=}")
print(f"{evals[:4]=}")
print(f"{Hk_xc[:4,0:4].real=}")
print(f"{Htot[:4,0:4].real=}")
print(f"{Sk[:4,0:4].real=}")
print(f"{rho[:4,0:4].real=}")
print(f"{rho2[:4,0:4].real=}")
pass
# print(f"{evecs[:4,0:4].real=}")
# print(f"{evals[:4]=}")
# print(f"{Hk_xc[:4,0:4].real=}")
# print(f"{Htot[:4,0:4].real=}")
# print(f"{Sk[:4,0:4].real=}")
# print(f"{rho[:4,0:4].real=}")
# print(f"{rho2[:4,0:4].real=}")
# eband1 = np.sum(evals * fermi(evals, self.model.efermi, width=0.05))
# eband2 = np.trace(Htot @ rho2).real
# eband3 = np.trace(Htot @ rho).real
Expand All @@ -181,14 +182,14 @@ def get_band_energy_from_rho(self, axis):
def get_band_energy_vs_angles(
self,
thetas,
phis,
psis,
):
es = []
# es2 = []
# e,rho = self.model.get_band_energy(dm=True)
# self.calc_ref()
thetas = np.linspace(*angle_range, npoints)
for i, theta, phi in thetas:
# thetas = np.linspace(*angle_range, npoints)
for i, theta, phi in enumerate(zip(thetas, psis)):
axis = spherical_to_cartesian(theta, phi)
self.model.rotate_HR_xc(axis)
# self.get_band_energy2()
Expand Down

0 comments on commit d29c9eb

Please sign in to comment.