3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-23 04:43:42 +01:00

Beautify check density imag part

This commit is contained in:
Manuel 2019-08-12 16:28:49 -04:00
parent ac1f55f3de
commit 46d9229722

View File

@ -1884,10 +1884,10 @@ class SumkDFT(object):
# collect data from mpi:
dens = mpi.all_reduce(mpi.world, dens, lambda x, y: x + y)
mpi.barrier()
import numpy as np
if np.abs(np.imag(dens)) > 1e-20:
mpi.report("Warning: Imaginary part in density will be ignored ({})".format(str(np.abs(np.imag(dens)))))
return np.real(dens)
if abs(dens.imag) > 1e-20:
mpi.report("Warning: Imaginary part in density will be ignored ({})".format(str(abs(dens.imag))))
return dens.real
def set_mu(self, mu):
r"""