From 3e63c0f0f55cbaa977df0ab87a0669befb3bba35 Mon Sep 17 00:00:00 2001 From: "Oleg E. Peil" Date: Wed, 9 Dec 2015 11:55:29 +0100 Subject: [PATCH] Improved output of the density matrix --- python/converters/plovasp/plotools.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/converters/plovasp/plotools.py b/python/converters/plovasp/plotools.py index 6b941f99..b3e8970e 100644 --- a/python/converters/plovasp/plotools.py +++ b/python/converters/plovasp/plotools.py @@ -100,10 +100,13 @@ def generate_plo(conf_pars, el_struct): print "Density matrix:" dm_all, ov_all = pshells[pgroup.ishells[0]].density_matrix(el_struct) 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 2 * dm - ndm = 2 * dm.trace() + dm = spin_fac * dm_all[:, io, : ,:].sum(0) + for row in dm: + print ''.join(map("{0:12.7f}".format, row)) + ndm = dm.trace() nimp += ndm print " trace: ", ndm print