@@ -1432,12 +1432,13 @@ def get_impurity_rdm(self, doprint=False):
14321432 rdm = np .ascontiguousarray (rdm )
14331433
14341434 return rdm
1435-
1436-
1435+
1436+
14371437#######################
14381438# DIMP #
14391439#######################
14401440
1441+
14411442def get_dimp (self , zeta = None , axis = None ):
14421443 """
14431444
@@ -1495,34 +1496,35 @@ def get_dimp(self, zeta=None, axis=None):
14951496 nfreq = np .shape (zeta )[0 ]
14961497
14971498 zeta = np .asfortranarray (zeta )
1498-
1499+
14991500 dimp = np .zeros ([nfreq ], dtype = complex , order = "F" )
15001501 ed_get_dimp (dimp , axisflag , zeta , nfreq , zetaflag )
1501-
1502+
15021503 dimp = np .ascontiguousarray (dimp )
1503-
1504+
15041505 return dimp
1505-
1506-
1506+
1507+
15071508#######################
15081509# 1BDM #
15091510#######################
15101511
1512+
15111513def get_denmat (self , ishape = 4 , doprint = False ):
15121514 """
1513-
1515+
15141516 This function returns the 1-body density matrix
1515-
1517+
15161518 :type ishape: int
15171519 :param ishape: the rank of the density matrix array. Possible values :code:`2,4` .
15181520
15191521 :type doprint: bool
15201522 :param doprint: flag to print the rdm.
1521-
1522- :return: the 1-body density matrix of shape :code:`(Nspin,Nspin,Ns,Ns)` or
1523+
1524+ :return: the 1-body density matrix of shape :code:`(Nspin,Nspin,Ns,Ns)` or
15231525 :code:`(Nspin Ns,Nspin Ns)` where :code:`Ns` is the total number of levels per spin.
1524- :rtype: np.array(dtype=complex)
1525-
1526+ :rtype: np.array(dtype=complex)
1527+
15261528 """
15271529
15281530 ed_get_denmat_n2 = self .library .ed_get_denmat_n2
@@ -1531,7 +1533,7 @@ def get_denmat(self, ishape=4, doprint=False):
15311533 ct .c_int , # printflag
15321534 ]
15331535 ed_get_denmat_n2 .restype = None
1534-
1536+
15351537 ed_get_denmat_n4 = self .library .ed_get_denmat_n4
15361538 ed_get_denmat_n2 .argtypes = [
15371539 np .ctypeslib .ndpointer (dtype = complex , ndim = 4 , flags = "F_CONTIGUOUS" ), # denmat
@@ -1540,33 +1542,32 @@ def get_denmat(self, ishape=4, doprint=False):
15401542 ed_get_denmat_n4 .restype = None
15411543
15421544 doprint = int (doprint )
1543-
1545+
15441546 if self .Nineq != 0 :
15451547 raise RuntimeError ("get_denmat not implemented for inequivalent sites yet." )
1546-
1547- aux_norb = ct .c_int .in_dll (self .library , "Norb" ).value
1548+
1549+ aux_norb = ct .c_int .in_dll (self .library , "Norb" ).value
15481550 aux_nspin = ct .c_int .in_dll (self .library , "Nspin" ).value
15491551 aux_nbath = ct .c_int .in_dll (self .library , "Nbath" ).value
1550-
1552+
15511553 bath_type = self .get_bath_type ()
1552-
1554+
15531555 if bath_type == 1 or bath_type > 3 :
15541556 Ns = (aux_nbath + 1 ) * aux_norb
15551557 elif bath_type == 2 :
15561558 Ns = aux_nbath + aux_norb
15571559 else :
1558- raise ValueError ("get_denmat: wrong bath type" )
1559-
1560+ raise ValueError ("get_denmat: wrong bath type" )
1561+
15601562 if ishape == 4 :
1561- denmat = np .zeros ([aux_nspin ,aux_nspin ,Ns ,Ns ], dtype = complex , order = "F" )
1562- ed_get_denmat_n4 (denmat ,doprint )
1563+ denmat = np .zeros ([aux_nspin , aux_nspin , Ns , Ns ], dtype = complex , order = "F" )
1564+ ed_get_denmat_n4 (denmat , doprint )
15631565 elif ishape == 2 :
1564- denmat = np .zeros ([aux_nspin * Ns ,aux_nspin * Ns ], dtype = complex , order = "F" )
1565- ed_get_denmat_n2 (denmat ,doprint )
1566+ denmat = np .zeros ([aux_nspin * Ns , aux_nspin * Ns ], dtype = complex , order = "F" )
1567+ ed_get_denmat_n2 (denmat , doprint )
15661568 else :
15671569 raise ValueError ("get_denmat: wrong ishape" )
15681570
1569-
15701571 denmat = np .ascontiguousarray (denmat )
1571-
1572+
15721573 return denmat
0 commit comments