mirror of
https://github.com/triqs/dft_tools
synced 2025-01-02 17:45:47 +01:00
Fixed 'nelect_window()' in ProjectorGroup
Method 'nelect_window()' now correctly takes into account a subset of bands selected by the energy window. Also, the number of electrons is now output to a '*.grX' file.
This commit is contained in:
parent
f89ea4c639
commit
d70dca3dd7
@ -178,6 +178,8 @@ class ProjectorGroup:
|
|||||||
shell = self.shells[ish]
|
shell = self.shells[ish]
|
||||||
shell.select_projectors(ib_win, nb_min, nb_max)
|
shell.select_projectors(ib_win, nb_min, nb_max)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# nelect_window
|
# nelect_window
|
||||||
@ -192,7 +194,9 @@ class ProjectorGroup:
|
|||||||
rspin = 2.0 if ns_band == 1 else 1.0
|
rspin = 2.0 if ns_band == 1 else 1.0
|
||||||
for isp in xrange(ns_band):
|
for isp in xrange(ns_band):
|
||||||
for ik in xrange(nk):
|
for ik in xrange(nk):
|
||||||
occ = el_struct.ferw[isp, ik, self.nb_min:self.nb_max+1]
|
ib1 = self.ib_win[ik, isp, 0]
|
||||||
|
ib2 = self.ib_win[ik, isp, 1]
|
||||||
|
occ = el_struct.ferw[isp, ik, ib1:ib2+1]
|
||||||
kwght = el_struct.kmesh['kweights'][ik]
|
kwght = el_struct.kmesh['kweights'][ik]
|
||||||
self.nelect += occ.sum() * kwght * rspin
|
self.nelect += occ.sum() * kwght * rspin
|
||||||
|
|
||||||
@ -521,6 +525,9 @@ def plo_output(conf_pars, el_struct, pshells, pgroups):
|
|||||||
head_dict['ewindow'] = (pgroup.emin, pgroup.emax)
|
head_dict['ewindow'] = (pgroup.emin, pgroup.emax)
|
||||||
head_dict['nb_max'] = pgroup.nb_max
|
head_dict['nb_max'] = pgroup.nb_max
|
||||||
|
|
||||||
|
# Number of electrons within the window
|
||||||
|
head_dict['nelect'] = pgroup.nelect_window(el_struct)
|
||||||
|
|
||||||
head_shells = []
|
head_shells = []
|
||||||
for ish in pgroup.ishells:
|
for ish in pgroup.ishells:
|
||||||
shell = pgroup.shells[ish]
|
shell = pgroup.shells[ish]
|
||||||
|
@ -5,6 +5,6 @@ import unittest
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
suite = unittest.TestLoader().discover('./')
|
suite = unittest.TestLoader().discover('./')
|
||||||
# unittest.TextTestRunner(verbosity=2, buffer=True).run(suite)
|
unittest.TextTestRunner(verbosity=2, buffer=True).run(suite)
|
||||||
unittest.TextTestRunner(verbosity=2, buffer=False).run(suite)
|
# unittest.TextTestRunner(verbosity=2, buffer=False).run(suite)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user