mirror of
https://github.com/triqs/dft_tools
synced 2024-12-21 11:53:41 +01:00
Fixed a bug in the calculation of the total energy
In the calculation of the Hamiltonian correction to the total energy the arrays were not always aligned if the number of bands varied inside the energy window.
This commit is contained in:
parent
6d1891a99a
commit
e5bb2d1b80
@ -1233,8 +1233,9 @@ class SumkDFT:
|
||||
dens[bname] += self.bz_weights[ik] * G_latt_iw[bname].total_density()
|
||||
if dm_type == 'vasp':
|
||||
# In 'vasp'-mode subtract the DFT density matrix
|
||||
diag_inds = numpy.diag_indices(self.n_orbitals[ik, ntoi[bname]])
|
||||
deltaN[bname][ik][diag_inds] -= dens_mat_dft[bname][ik]
|
||||
nb = self.n_orbitals[ik, ntoi[bname]]
|
||||
diag_inds = numpy.diag_indices(nb)
|
||||
deltaN[bname][ik][diag_inds] -= dens_mat_dft[bname][ik][:nb]
|
||||
dens[bname] -= self.bz_weights[ik] * dens_mat_dft[bname][ik].sum().real
|
||||
isp = ntoi[bname]
|
||||
b1, b2 = self.band_window[isp][ik, :2]
|
||||
|
Loading…
Reference in New Issue
Block a user