mirror of
https://github.com/triqs/dft_tools
synced 2024-12-22 12:23:41 +01:00
Added some debug output to plotools.py
Added output of density and overlap matrices to plotools.py. If one defines a very large window (spanning all bands) one can compare this output with the one produced by 'debug_density_matrix()' in class ElectronicStructure. For a small window, the overlap gives an idea of symmetry-related degeneracies and of how strong the states are going to be renormalized by the orthogonalization routine.
This commit is contained in:
parent
54b9857aa5
commit
67b78c1499
@ -2,6 +2,8 @@
|
|||||||
import itertools as it
|
import itertools as it
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
np.set_printoptions(suppress=True)
|
||||||
|
|
||||||
# 'simplejson' is supposed to be faster than 'json' in stdlib.
|
# 'simplejson' is supposed to be faster than 'json' in stdlib.
|
||||||
try:
|
try:
|
||||||
import simplejson as json
|
import simplejson as json
|
||||||
@ -141,6 +143,8 @@ def select_bands(eigvals, emin, emax):
|
|||||||
ib += 1
|
ib += 1
|
||||||
ib2 = ib - 1
|
ib2 = ib - 1
|
||||||
|
|
||||||
|
assert ib1 <= ib2, "No bands inside the window for ik = %s"%(ik)
|
||||||
|
|
||||||
ib_win[ik, isp, 0] = ib1
|
ib_win[ik, isp, 0] = ib1
|
||||||
ib_win[ik, isp, 1] = ib2
|
ib_win[ik, isp, 1] = ib2
|
||||||
|
|
||||||
@ -379,6 +383,7 @@ class ProjectorShell:
|
|||||||
assert spin_diag, "spin_diag = False is not implemented"
|
assert spin_diag, "spin_diag = False is not implemented"
|
||||||
|
|
||||||
occ_mats = np.zeros((ns, nion, nlm, nlm), dtype=np.float64)
|
occ_mats = np.zeros((ns, nion, nlm, nlm), dtype=np.float64)
|
||||||
|
overlaps = np.zeros((ns, nion, nlm, nlm), dtype=np.float64)
|
||||||
|
|
||||||
kweights = el_struct.kmesh['kweights']
|
kweights = el_struct.kmesh['kweights']
|
||||||
occnums = el_struct.ferw
|
occnums = el_struct.ferw
|
||||||
@ -390,11 +395,13 @@ class ProjectorShell:
|
|||||||
proj_k = self.proj_win[isp, io, ik, ...]
|
proj_k = self.proj_win[isp, io, ik, ...]
|
||||||
occ_mats[isp, io, :, :] += np.dot(proj_k * occ[ib1:ib2],
|
occ_mats[isp, io, :, :] += np.dot(proj_k * occ[ib1:ib2],
|
||||||
proj_k.conj().T).real * weight
|
proj_k.conj().T).real * weight
|
||||||
|
overlaps[isp, io, :, :] += np.dot(proj_k,
|
||||||
|
proj_k.conj().T).real * weight
|
||||||
|
|
||||||
# if not symops is None:
|
# if not symops is None:
|
||||||
# occ_mats = symmetrize_matrix_set(occ_mats, symops, ions, perm_map)
|
# occ_mats = symmetrize_matrix_set(occ_mats, symops, ions, perm_map)
|
||||||
|
|
||||||
return occ_mats
|
return occ_mats, overlaps
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -430,6 +437,12 @@ def generate_plo(conf_pars, el_struct):
|
|||||||
pgroups = []
|
pgroups = []
|
||||||
for gr_par in conf_pars.groups:
|
for gr_par in conf_pars.groups:
|
||||||
pgroup = ProjectorGroup(gr_par, pshells, eigvals, el_struct.ferw)
|
pgroup = ProjectorGroup(gr_par, pshells, eigvals, el_struct.ferw)
|
||||||
|
print "Density matrix:"
|
||||||
|
dm, ov = pshells[pgroup.ishells[0]].density_matrix(el_struct)
|
||||||
|
print dm
|
||||||
|
print
|
||||||
|
print "Overlap:"
|
||||||
|
print ov
|
||||||
# pgroup.orthogonalize()
|
# pgroup.orthogonalize()
|
||||||
pgroups.append(pgroup)
|
pgroups.append(pgroup)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user