3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-21 20:03:41 +01:00

Added a spin factor to density matrix in 'elstruct.py'

This commit is contained in:
Oleg E. Peil 2015-12-01 11:18:44 +01:00
parent 3620784798
commit 921bba0c1a

View File

@ -89,6 +89,9 @@ class ElectronicStructure:
nions = len(ions)
norb = nproj / nions
# Spin factor
sp_fac = 2.0 if ns == 1 and not self.nc_flag else 1.0
den_mat = np.zeros((ns, nproj, nproj), dtype=np.float64)
overlap = np.zeros((ns, nproj, nproj), dtype=np.float64)
# ov_min = np.ones((ns, nproj, nproj), dtype=np.float64) * 100.0
@ -97,7 +100,7 @@ class ElectronicStructure:
for ik in xrange(nk):
kweight = self.kmesh['kweights'][ik]
occ = self.ferw[ispin, ik, :]
den_mat[ispin, :, :] += np.dot(plo[:, ispin, ik, :] * occ, plo[:, ispin, ik, :].T.conj()).real * kweight
den_mat[ispin, :, :] += np.dot(plo[:, ispin, ik, :] * occ, plo[:, ispin, ik, :].T.conj()).real * kweight * sp_fac
ov = np.dot(plo[:, ispin, ik, :], plo[:, ispin, ik, :].T.conj()).real
overlap[ispin, :, :] += ov * kweight
# ov_max = np.maximum(ov, ov_max)