Dear Mohit,
I see the formula you are mentioning using the matsubara frequencies.
To use that expression, you need to use imaginary energies.
The steps are;
Sites1=[lat(5,j) for j in range(W)] # the sites where to mount lead 2
Sites2=[lat(6,j) for j in range(W)] # the sites where to mount lead 3
mount_vlead(sys, Sites1, 4) # number of orbitals =4. Here we mount lead number 2
mount_vlead(sys, Sites2, 4) # number of orbitals =4. Here we mount lead number 3
syst=sys.finalized()
G12=greens_function(syst, energy=-1.8*1j, in_leads=[3],out_leads=[2], check_hermiticity=False).data
G21=greens_function(syst, ,energy=-1.8*1j, in_leads=[2],out_leads=[3], check_hermiticity=False).data
H12=syst.hamiltonian_submatrix(to_sites=Sites1, from_sites=Sites2)
H21=syst.hamiltonian_submatrix(to_sites=Sites2, from_sites=Sites1)
Notices that, we had to use "check_hermiticity=False" because for these complex energies, the system is not hermitian
Trace(np.dot(H21, G12)-np.dot(H12,G21) )) # check if the order is correct.
I hope this helps.
Adel