11# ---
22# jupyter:
33# jupytext:
4- # cell_metadata_filter: -all
4+ # cell_metadata_filter: cell_depth,title, -all
55# custom_cell_magics: kql
66# text_representation:
77# extension: .py
1919import scipy as sc
2020import scipy .optimize
2121from warnings import warn
22- import pylibsparseir as sparse_ir
22+ import sparse_ir
2323# %matplotlib inline
2424import matplotlib .pyplot as plt
2525
@@ -142,8 +142,6 @@ def __init__(self, mesh, U, n, sigma_init=0, sfc_tol=1e-4,
142142 self .grit_calc ()
143143 self .ckio_calc ()
144144
145-
146- #%%%%%%%%%%% Loop solving instance
147145 def solve (self ):
148146 """ FLEXSolver.solve() executes FLEX loop until convergence """
149147 # check whether U < U_crit! Otherwise, U needs to be renormalized.
@@ -180,8 +178,6 @@ def loop(self):
180178 self .grit_calc ()
181179 self .ckio_calc ()
182180
183-
184- #%%%%%%%%%%% U renormalization loop instance
185181 def U_renormalization (self ):
186182 """ Loop for renormalizing U if Stoner enhancement U*max{chi0} >= 1. """
187183 print ('WARNING: U is too large and the spin susceptibility denominator will diverge/turn unphysical!' )
@@ -211,8 +207,6 @@ def U_renormalization(self):
211207 break
212208 print ('Leaving U renormalization...' )
213209
214-
215- #%%%%%%%%%%% Calculation steps
216210 def gkio_calc (self , mu ):
217211 """ calculate Green function G(iw,k) """
218212 self .gkio = (self .mesh .iwn_f_ - (self .mesh .ek_ - mu ) - self .sigma )** (- 1 )
@@ -257,8 +251,6 @@ def sigma_calc(self):
257251 sigma = self .mesh .r_to_k (sigma )
258252 self .sigma = self .mesh .tau_to_wn ('F' , sigma )
259253
260-
261- #%%%%%%%%%%% Setting chemical potential mu
262254 def calc_electron_density (self , mu ):
263255 """ Calculate electron density from Green function """
264256 self .gkio_calc (mu )
@@ -278,6 +270,7 @@ def mu_calc(self):
278270
279271 self .mu = sc .optimize .brentq (f , np .amax (self .mesh .ek )* 3 , np .amin (self .mesh .ek )* 3 )
280272
273+
281274# %%
282275# initialize calculation
283276IR_basis_set = sparse_ir .FiniteTempBasisSet (beta , wmax , eps = IR_tol )
@@ -369,7 +362,6 @@ def solve(self):
369362 if abs (self .lam - lam_old ) < self .sfc_tol :
370363 break
371364
372- #%%%%%%%%%%% Calculation steps
373365 def V_singlet_calc (self ):
374366 """ Set up interaction in real space and imaginary time """
375367
@@ -389,6 +381,8 @@ def frit_calc(self):
389381 frit = self .mesh .k_to_r (self .fkio )
390382 self .frit = self .mesh .wn_to_tau ('F' , frit )
391383
384+ # %%%%%%%%%%% Calculation steps
385+
392386
393387# %%
394388gap_solver = LinearizedGapSolver (solver , maxiter = maxiter , sfc_tol = sfc_tol )
@@ -435,7 +429,7 @@ def frit_calc(self):
435429plt .show ()
436430
437431# %%
438- #%%%%%%%%%%%%%%% Parameter settings
432+ # %%%%%%%%%%%%%%% Parameter settings
439433print ('Initialization...' )
440434# system parameters
441435t = 1 # hopping amplitude
@@ -468,7 +462,7 @@ def frit_calc(self):
468462chiSmax_T = np .empty ((len (T_values )))
469463
470464
471- #%%%%%%%%%%%%%%% Calculation for different T values
465+ # %%%%%%%%%%%%%%% Calculation for different T values
472466for T_it , T in enumerate (T_values ):
473467 print ("Now: T = {}" .format (T ))
474468 beta = 1 / T
@@ -494,8 +488,7 @@ def frit_calc(self):
494488 if T == 0.03 :
495489 chi_s_plt = np .real (solver .chi_spin )[mesh .iw0_b ].reshape (mesh .nk1 ,mesh .nk2 )
496490
497- # %%
498- #%%%%%%%%%%%%%%%% Plot results in a combined figure
491+ # %%%%%%%%%%%%%%%% Plot results in a combined figure
499492import matplotlib .gridspec as gridspec
500493
501494fig = plt .figure (figsize = (10 ,4 ),constrained_layout = True )
0 commit comments