mirror of
https://github.com/triqs/dft_tools
synced 2024-12-23 12:55:17 +01:00
Ignore imaginary part of the density when calculating mu
This commit is contained in:
parent
810b315c92
commit
f695ccac7a
@ -667,7 +667,7 @@ class SumkDFT(object):
|
|||||||
return Sigma_out
|
return Sigma_out
|
||||||
|
|
||||||
def extract_G_loc(self, mu=None, iw_or_w='iw', with_Sigma=True, with_dc=True, broadening=None,
|
def extract_G_loc(self, mu=None, iw_or_w='iw', with_Sigma=True, with_dc=True, broadening=None,
|
||||||
transform_to_solver_blocks=True):
|
transform_to_solver_blocks=True, show_warnings=True):
|
||||||
r"""
|
r"""
|
||||||
Extracts the local downfolded Green function by the Brillouin-zone integration of the lattice Green's function.
|
Extracts the local downfolded Green function by the Brillouin-zone integration of the lattice Green's function.
|
||||||
|
|
||||||
@ -686,6 +686,9 @@ class SumkDFT(object):
|
|||||||
transform_to_solver_blocks : bool, optional
|
transform_to_solver_blocks : bool, optional
|
||||||
If True (default), the returned G_loc will be transformed to the block structure ``gf_struct_solver``,
|
If True (default), the returned G_loc will be transformed to the block structure ``gf_struct_solver``,
|
||||||
else it will be in ``gf_struct_sumk``.
|
else it will be in ``gf_struct_sumk``.
|
||||||
|
show_warnings : bool, optional
|
||||||
|
Displays warning messages during transformation
|
||||||
|
(Only effective if transform_to_solver_blocks = True
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
@ -753,11 +756,11 @@ class SumkDFT(object):
|
|||||||
icrsh, gf, direction='toLocal')
|
icrsh, gf, direction='toLocal')
|
||||||
|
|
||||||
if transform_to_solver_blocks:
|
if transform_to_solver_blocks:
|
||||||
return self.transform_to_solver_blocks(G_loc)
|
return self.transform_to_solver_blocks(G_loc, show_warnings=show_warnings)
|
||||||
|
|
||||||
return G_loc
|
return G_loc
|
||||||
|
|
||||||
def transform_to_solver_blocks(self, G_loc, G_out=None):
|
def transform_to_solver_blocks(self, G_loc, G_out=None, show_warnings = True):
|
||||||
""" transform G_loc from sumk to solver space
|
""" transform G_loc from sumk to solver space
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
@ -794,7 +797,8 @@ class SumkDFT(object):
|
|||||||
ish_from=self.inequiv_to_corr[ish],
|
ish_from=self.inequiv_to_corr[ish],
|
||||||
ish_to=ish,
|
ish_to=ish,
|
||||||
space_from='sumk',
|
space_from='sumk',
|
||||||
G_out=G_out[ish])
|
G_out=G_out[ish],
|
||||||
|
show_warnings = show_warnings)
|
||||||
|
|
||||||
# return only the inequivalent shells:
|
# return only the inequivalent shells:
|
||||||
return G_out
|
return G_out
|
||||||
@ -1808,8 +1812,10 @@ class SumkDFT(object):
|
|||||||
# collect data from mpi:
|
# collect data from mpi:
|
||||||
dens = mpi.all_reduce(mpi.world, dens, lambda x, y: x + y)
|
dens = mpi.all_reduce(mpi.world, dens, lambda x, y: x + y)
|
||||||
mpi.barrier()
|
mpi.barrier()
|
||||||
|
import numpy as np
|
||||||
return dens
|
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)
|
||||||
|
|
||||||
def set_mu(self, mu):
|
def set_mu(self, mu):
|
||||||
r"""
|
r"""
|
||||||
|
Loading…
Reference in New Issue
Block a user