Skip to content

Commit 665a5dd

Browse files
committed
Bugfix
Some obvious ones
1 parent 3530491 commit 665a5dd

2 files changed

Lines changed: 17 additions & 19 deletions

File tree

src/edipack2py/func_aux_funx.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,14 @@ def get_ed_mode(self):
367367

368368

369369
# set phonons displacement and coupling
370-
def set_phonon_coefficients(self,disp=None,coupling=None):
370+
def set_phonon_coefficients(self, displacement=None, coupling=None):
371371
"""
372372
373373
This function sets new values for the phonon displacement field
374374
and the electron-phonon coupling matrix
375375
376-
:type disp: float
377-
:param disp: phonon displacement field
376+
:type displacement: float
377+
:param displacement: phonon displacement field
378378
379379
:type coupling: np.array(float)
380380
:param coupling: electron-phonon coupling matrix of shape ( :code:`Norb` ) or ( :code:`Norb`, :code:`Norb` )
@@ -385,21 +385,23 @@ def set_phonon_coefficients(self,disp=None,coupling=None):
385385
set_a_ph.argtypes = [np.ctypeslib.ndpointer(dtype=float, ndim=1, flags="F_CONTIGUOUS")]
386386
set_a_ph.restype = None
387387

388-
set_g_ph = self.library.ed_setG_ph
388+
set_g_ph = self.library.ed_set_G_ph
389389
set_g_ph.argtypes = [np.ctypeslib.ndpointer(dtype=float, ndim=2, flags="F_CONTIGUOUS")]
390390
set_g_ph.restype = None
391391

392392
aux_norb = ct.c_int.in_dll(self.library, "Norb").value
393393

394-
if disp==None and coupling==None:
394+
if displacement==None and coupling==None:
395395
raise RuntimeError("set_phonon_coefficients: provide at least either disp or coupling")
396396

397-
if disp != None:
398-
set_a_ph(np.array([disp]))
397+
if displacement != None:
398+
set_a_ph(np.array([displacement],order="F"))
399+
399400
if coupling != None:
400401
if np.shape(copuling) == (aux_norb,):
401402
coupling = np.array(np.diag(coupling),order="F")
402403
elif np.shape(copuling) != (aux_norb,aux_norb):
403404
raise ValueError("set_phonon_coefficients: coupling shape is (Norb) or (Norb,Norb)")
404405
set_g_ph(coupling)
405-
406+
407+
return

src/edipack2py/func_io.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ def get_dimp(self, zeta=None, axis=None):
14911491
elif axis == "r":
14921492
axisflag = 1
14931493
else:
1494-
raise ValueError("axis can only be m, r or t")
1494+
raise ValueError("axis can only be 'm' or 'r'")
14951495
nfreq = np.shape(zeta)[0]
14961496

14971497
zeta = np.asfortranarray(zeta)
@@ -1539,10 +1539,7 @@ def get_denmat(self, ishape=4, doprint=False):
15391539
]
15401540
ed_get_denmat_n4.restype = None
15411541

1542-
if doprint:
1543-
doprintflag=1
1544-
else:
1545-
doprintflag=0
1542+
doprint = int(doprint)
15461543

15471544
if self.Nineq != 0:
15481545
raise RuntimeError("get_denmat not implemented for inequivalent sites yet.")
@@ -1553,24 +1550,23 @@ def get_denmat(self, ishape=4, doprint=False):
15531550

15541551
bath_type = self.get_bath_type()
15551552

1556-
if bath_type == 1 or bath_type == 3:
1553+
if bath_type == 1 or bath_type > 3:
15571554
Ns = (aux_nbath + 1) * aux_norb
15581555
elif bath_type == 2:
15591556
Ns = aux_nbath + aux_norb
15601557
else:
1561-
raise ValueError("get_denmat: wrong bath type")
1562-
1558+
raise ValueError("get_denmat: wrong bath type")
15631559

15641560
if ishape == 4:
15651561
denmat = np.zeros([aux_nspin,aux_nspin,Ns,Ns], dtype=complex, order="F")
1566-
ed_get_denmat_n4(denmat,doprintflag)
1562+
ed_get_denmat_n4(denmat,doprint)
15671563
elif ishape == 2:
15681564
denmat = np.zeros([aux_nspin*Ns,aux_nspin*Ns], dtype=complex, order="F")
1569-
ed_get_denmat_n2(denmat,doprintflag)
1565+
ed_get_denmat_n2(denmat,doprint)
15701566
else:
15711567
raise ValueError("get_denmat: wrong ishape")
15721568

15731569

15741570
denmat = np.ascontiguousarray(denmat)
15751571

1576-
return dimp
1572+
return denmat

0 commit comments

Comments
 (0)