Skip to content

Commit

Permalink
Use the new interface in test and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
j-otsuki committed May 7, 2018
1 parent 92897ab commit 19eab2a
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 24 deletions.
3 changes: 2 additions & 1 deletion example/2band.atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@
# G^{(2)}(i\omega;i\nu,i\nu') #
###############################

G2_iw = ed.G2_iw_legacy( index1=('up',0), index2=('dn',0), index3=('dn',1), index4=('up',1), **common_g2_params )
# G2_iw = ed.G2_iw_legacy( index1=('up',0), index2=('dn',0), index3=('dn',1), index4=('up',1), **common_g2_params )
G2_iw = ed.G2_iw_freq_box( vec_four_indices=[(('up',0), ('dn',0), ('dn',1), ('up',1)),], **common_g2_params )[0]
print type(G2_iw)
print G2_iw.shape

Expand Down
3 changes: 2 additions & 1 deletion example/slater.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@
# G^{(2)}(i\omega;i\nu,i\nu') #
###############################

G2_iw = ed.G2_iw_legacy( index1=('up',0), index2=('dn',0), index3=('dn',1), index4=('up',1), **common_g2_params )
# G2_iw = ed.G2_iw_legacy( index1=('up',0), index2=('dn',0), index3=('dn',1), index4=('up',1), **common_g2_params )
G2_iw = ed.G2_iw_freq_box( vec_four_indices=[(('up',0), ('dn',0), ('dn',1), ('up',1)),], **common_g2_params )[0]

if mpi.is_master_node():
print type(G2_iw)
Expand Down
36 changes: 27 additions & 9 deletions test/python/anderson_g2_matsubara.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,33 @@
'n_b' : g2_n_wb, }


# Compute G^{(2),ph}(i\omega;i\nu,i\nu'), AABB block order
G2_iw_ph_uuuu = ed.G2_iw_legacy( index1=('up',0), index2=('up',0), index3=('up',0), index4=('up',0), **common_g2_params )
G2_iw_ph_dddd = ed.G2_iw_legacy( index1=('dn',0), index2=('dn',0), index3=('dn',0), index4=('dn',0), **common_g2_params )
G2_iw_ph_uudd = ed.G2_iw_legacy( index1=('up',0), index2=('up',0), index3=('dn',0), index4=('dn',0), **common_g2_params )
G2_iw_ph_dduu = ed.G2_iw_legacy( index1=('dn',0), index2=('dn',0), index3=('up',0), index4=('up',0), **common_g2_params )

# Compute G^{(2),ph}(i\omega;i\nu,i\nu'), ABBA block order
G2_iw_ph_uddu = ed.G2_iw_legacy( index1=('up',0), index2=('dn',0), index3=('dn',0), index4=('up',0), **common_g2_params )
G2_iw_ph_duud = ed.G2_iw_legacy( index1=('dn',0), index2=('up',0), index3=('up',0), index4=('dn',0), **common_g2_params )
# # Compute G^{(2),ph}(i\omega;i\nu,i\nu'), AABB block order
# G2_iw_ph_uuuu = ed.G2_iw_legacy( index1=('up',0), index2=('up',0), index3=('up',0), index4=('up',0), **common_g2_params )
# G2_iw_ph_dddd = ed.G2_iw_legacy( index1=('dn',0), index2=('dn',0), index3=('dn',0), index4=('dn',0), **common_g2_params )
# G2_iw_ph_uudd = ed.G2_iw_legacy( index1=('up',0), index2=('up',0), index3=('dn',0), index4=('dn',0), **common_g2_params )
# G2_iw_ph_dduu = ed.G2_iw_legacy( index1=('dn',0), index2=('dn',0), index3=('up',0), index4=('up',0), **common_g2_params )
#
# # Compute G^{(2),ph}(i\omega;i\nu,i\nu'), ABBA block order
# G2_iw_ph_uddu = ed.G2_iw_legacy( index1=('up',0), index2=('dn',0), index3=('dn',0), index4=('up',0), **common_g2_params )
# G2_iw_ph_duud = ed.G2_iw_legacy( index1=('dn',0), index2=('up',0), index3=('up',0), index4=('dn',0), **common_g2_params )


four_indices = []
four_indices.append( (('up',0), ('up',0), ('up',0), ('up',0)) ) # uuuu
four_indices.append( (('dn',0), ('dn',0), ('dn',0), ('dn',0)) ) # dddd
four_indices.append( (('up',0), ('up',0), ('dn',0), ('dn',0)) ) # uudd
four_indices.append( (('dn',0), ('dn',0), ('up',0), ('up',0)) ) # dduu
four_indices.append( (('up',0), ('dn',0), ('dn',0), ('up',0)) ) # uddu
four_indices.append( (('dn',0), ('up',0), ('up',0), ('dn',0)) ) # duud

G2_iw_ph = ed.G2_iw_freq_box( vec_four_indices=four_indices, **common_g2_params )
G2_iw_ph_uuuu = G2_iw_ph[0]
G2_iw_ph_dddd = G2_iw_ph[1]
G2_iw_ph_uudd = G2_iw_ph[2]
G2_iw_ph_dduu = G2_iw_ph[3]
G2_iw_ph_uddu = G2_iw_ph[4]
G2_iw_ph_duud = G2_iw_ph[5]


# Compute G^{(2),pp}(i\omega;i\nu,i\nu'), AABB block order
# G2_iw_inu_inup_pp_AABB = ed.G2_iw_inu_inup(channel = "PP",
Expand Down
50 changes: 37 additions & 13 deletions test/python/wick.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,43 @@
'n_f' : g2_n_wf,
'n_b' : g2_n_wb, }

G2_ph_uuuu = ed.G2_iw_legacy( index1=('up',0), index2=('up',0), index3=('up',0), index4=('up',0), **common_g2_params )
G2_ph_dddd = ed.G2_iw_legacy( index1=('dn',0), index2=('dn',0), index3=('dn',0), index4=('dn',0), **common_g2_params )
G2_ph_uudd = ed.G2_iw_legacy( index1=('up',0), index2=('up',0), index3=('dn',0), index4=('dn',0), **common_g2_params )
G2_ph_dduu = ed.G2_iw_legacy( index1=('dn',0), index2=('dn',0), index3=('up',0), index4=('up',0), **common_g2_params )
G2_ph_uddu = ed.G2_iw_legacy( index1=('up',0), index2=('dn',0), index3=('dn',0), index4=('up',0), **common_g2_params )
G2_ph_duud = ed.G2_iw_legacy( index1=('dn',0), index2=('up',0), index3=('up',0), index4=('dn',0), **common_g2_params )

G2_ph_uuuu_wick = G2_ph_uuuu.copy()
G2_ph_dddd_wick = G2_ph_dddd.copy()
G2_ph_uudd_wick = G2_ph_uudd.copy()
G2_ph_dduu_wick = G2_ph_dduu.copy()
G2_ph_uddu_wick = G2_ph_uddu.copy()
G2_ph_duud_wick = G2_ph_duud.copy()
# G2_ph_uuuu = ed.G2_iw_legacy( index1=('up',0), index2=('up',0), index3=('up',0), index4=('up',0), **common_g2_params )
# G2_ph_dddd = ed.G2_iw_legacy( index1=('dn',0), index2=('dn',0), index3=('dn',0), index4=('dn',0), **common_g2_params )
# G2_ph_uudd = ed.G2_iw_legacy( index1=('up',0), index2=('up',0), index3=('dn',0), index4=('dn',0), **common_g2_params )
# G2_ph_dduu = ed.G2_iw_legacy( index1=('dn',0), index2=('dn',0), index3=('up',0), index4=('up',0), **common_g2_params )
# G2_ph_uddu = ed.G2_iw_legacy( index1=('up',0), index2=('dn',0), index3=('dn',0), index4=('up',0), **common_g2_params )
# G2_ph_duud = ed.G2_iw_legacy( index1=('dn',0), index2=('up',0), index3=('up',0), index4=('dn',0), **common_g2_params )

four_indices = []
four_indices.append( (('up',0), ('up',0), ('up',0), ('up',0)) ) # uuuu
four_indices.append( (('dn',0), ('dn',0), ('dn',0), ('dn',0)) ) # dddd
four_indices.append( (('up',0), ('up',0), ('dn',0), ('dn',0)) ) # uudd
four_indices.append( (('dn',0), ('dn',0), ('up',0), ('up',0)) ) # dduu
four_indices.append( (('up',0), ('dn',0), ('dn',0), ('up',0)) ) # uddu
four_indices.append( (('dn',0), ('up',0), ('up',0), ('dn',0)) ) # duud

G2_ph = ed.G2_iw_freq_box( vec_four_indices=four_indices, **common_g2_params )
G2_ph_uuuu = G2_ph[0]
G2_ph_dddd = G2_ph[1]
G2_ph_uudd = G2_ph[2]
G2_ph_dduu = G2_ph[3]
G2_ph_uddu = G2_ph[4]
G2_ph_duud = G2_ph[5]

# G2_ph_uuuu_wick = G2_ph_uuuu.copy()
# G2_ph_dddd_wick = G2_ph_dddd.copy()
# G2_ph_uudd_wick = G2_ph_uudd.copy()
# G2_ph_dduu_wick = G2_ph_dduu.copy()
# G2_ph_uddu_wick = G2_ph_uddu.copy()
# G2_ph_duud_wick = G2_ph_duud.copy()

g2_shape = (g2_n_wb, 2*g2_n_wf, 2*g2_n_wf)
G2_ph_uuuu_wick = np.zeros(g2_shape, dtype=np.complex)
G2_ph_dddd_wick = np.zeros(g2_shape, dtype=np.complex)
G2_ph_dduu_wick = np.zeros(g2_shape, dtype=np.complex)
G2_ph_uudd_wick = np.zeros(g2_shape, dtype=np.complex)
G2_ph_uddu_wick = np.zeros(g2_shape, dtype=np.complex)
G2_ph_duud_wick = np.zeros(g2_shape, dtype=np.complex)

G = lambda s, i: G_iw[s].data[i + n_iw, 0, 0]

Expand Down

0 comments on commit 19eab2a

Please sign in to comment.