From 1fa2376a99743f0fe00aaa054ff24c742b93fd48 Mon Sep 17 00:00:00 2001 From: mmerkel Date: Fri, 30 Oct 2020 18:58:57 +0100 Subject: [PATCH] sum_k.calc_mu exposes dichotomy parameter max_loops Default behavior unchanged --- python/triqs_dft_tools/sumk_dft.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/triqs_dft_tools/sumk_dft.py b/python/triqs_dft_tools/sumk_dft.py index 5e427528..97a198c2 100644 --- a/python/triqs_dft_tools/sumk_dft.py +++ b/python/triqs_dft_tools/sumk_dft.py @@ -1939,7 +1939,7 @@ class SumkDFT(object): """ self.chemical_potential = mu - def calc_mu(self, precision=0.01, iw_or_w='iw', broadening=None, delta=0.5): + def calc_mu(self, precision=0.01, iw_or_w='iw', broadening=None, delta=0.5, max_loops=100): r""" Searches for the chemical potential that gives the DFT total charge. A simple bisection method is used. @@ -1955,6 +1955,8 @@ class SumkDFT(object): Imaginary shift for the axis along which the real-axis GF is calculated. If not provided, broadening will be set to double of the distance between mesh points in 'mesh'. Only relevant for real-frequency GF. + max_loops : int, optional + Number of dichotomy loops maximally performed. Returns ------- @@ -1969,7 +1971,7 @@ class SumkDFT(object): self.chemical_potential = dichotomy.dichotomy(function=F, x_init=self.chemical_potential, y_value=density, - precision_on_y=precision, delta_x=delta, max_loops=100, + precision_on_y=precision, delta_x=delta, max_loops=max_loops, x_name="Chemical Potential", y_name="Total Density", verbosity=3)[0]