3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-07 06:33:48 +01:00

Improved output of the density matrix

This commit is contained in:
Oleg E. Peil 2015-12-09 11:55:29 +01:00
parent b02d13ebd8
commit 3e63c0f0f5

View File

@ -100,10 +100,13 @@ def generate_plo(conf_pars, el_struct):
print "Density matrix:" print "Density matrix:"
dm_all, ov_all = pshells[pgroup.ishells[0]].density_matrix(el_struct) dm_all, ov_all = pshells[pgroup.ishells[0]].density_matrix(el_struct)
nimp = 0.0 nimp = 0.0
for io, dm in enumerate(dm_all[0]): spin_fac = 2 if dm_all.shape[0] == 1 else 1
for io in xrange(dm_all.shape[1]):
print " Site %i"%(io + 1) print " Site %i"%(io + 1)
print 2 * dm dm = spin_fac * dm_all[:, io, : ,:].sum(0)
ndm = 2 * dm.trace() for row in dm:
print ''.join(map("{0:12.7f}".format, row))
ndm = dm.trace()
nimp += ndm nimp += ndm
print " trace: ", ndm print " trace: ", ndm
print print