It seems the BrillouinZone interpolation doesn't work well if the MeshProduct defined as the same as (k,iw)
I first found this when I use TPRF with function lattice_dyson_g0_wk(). Therefore I checked the different order of k and iw for mesh product, and the behevious when interpolation over k-point.
From my side, the BrillouinZone interpolation of meshed GF only works if I use MeshProduct(k_mesh,iw_mesh)
Steps to Reproduce
Error case
If I run the following code,
from triqs.lattice import BravaisLattice, BrillouinZone
from triqs.gf import Gf, MeshProduct, MeshBrZone, MeshImFreq
import numpy as np
from math import cos, pi
beta = 2 # Inverse temperature
t = 1.0 # Hopping (unit of energy)
mu = 0 # Chemical potential
def eps(k):
return -2t (cos(k[0]) + cos(k[1]))
BL = BravaisLattice([(1,0,0), (0,1,0)]) # Two unit vectors in R3
BZ = BrillouinZone(BL)
n_k denotes the number of k-points for each dimension
File /opt/triqs/lib/python3.11/site-packages/triqs/gf/gf.py:421, in Gf.call(self, args)
419 def call(self, args) :
420 assert self._c_proxy, " no proxy"
--> 421 return self._c_proxy(*args)
TypeError: CallProxyNone.call() takes 2 positional arguments but 3 were given
2. Worked case
If I run, instead of above code,
```python
iw_mesh = MeshImFreq(beta=beta, S='Fermion', n_iw=128)
k_iw_mesh = MeshProduct(iw_mesh,k_mesh)
G = Gf(mesh=k_iw_mesh, target_shape=[])
for iw, k in G.mesh:
G[iw,k] = 1/(iw + mu - eps(k))
G(2,(0.1,0.1,0))
The returned value is normal
[and so on...]
Expected behavior: These two mesh define should gave identical value for BZ interpolation
Actual behavior: When the mesh defined as (iw,k), the interpolation doesn't work at all.
Versions
Please provide the version of the TRIQS library that you used.
You are using the TRIQS library version 3.1.1
You are using the git hash 3c27b35ffbdf0309989e85883344b91c39a98567
Hi All,
It seems the BrillouinZone interpolation doesn't work well if the MeshProduct defined as the same as (k,iw)
I first found this when I use TPRF with function
lattice_dyson_g0_wk()
. Therefore I checked the different order ofk
andiw
for mesh product, and the behevious when interpolation over k-point. From my side, the BrillouinZone interpolation of meshed GF only works if I useMeshProduct(k_mesh,iw_mesh)
Steps to Reproduce
beta = 2 # Inverse temperature t = 1.0 # Hopping (unit of energy) mu = 0 # Chemical potential
def eps(k): return -2t (cos(k[0]) + cos(k[1]))
BL = BravaisLattice([(1,0,0), (0,1,0)]) # Two unit vectors in R3 BZ = BrillouinZone(BL)
n_k denotes the number of k-points for each dimension
n_k = 3 k_mesh = MeshBrZone(bz=BZ, n_k=n_k)
iw_mesh = MeshImFreq(beta=beta, S='Fermion', n_iw=128) k_iw_mesh = MeshProduct(iw_mesh,k_mesh)
G = Gf(mesh=k_iw_mesh, target_shape=[])
for iw, k in G.mesh: G[iw,k] = 1/(iw + mu - eps(k))
G(2,(0.1,0.1,0))
TypeError Traceback (most recent call last) Cell In[17], line 1 ----> 1 G(2,(0.1,0.1,0))
File /opt/triqs/lib/python3.11/site-packages/triqs/gf/gf.py:421, in Gf.call(self, args) 419 def call(self, args) : 420 assert self._c_proxy, " no proxy" --> 421 return self._c_proxy(*args)
TypeError: CallProxyNone.call() takes 2 positional arguments but 3 were given
The returned value is normal
Expected behavior: These two mesh define should gave identical value for BZ interpolation
Actual behavior: When the mesh defined as (iw,k), the interpolation doesn't work at all.
Versions
Please provide the version of the TRIQS library that you used.
I'm running on MacOS 13.2.1
Additional Information
I attached the following files for reproducing the problem: example_error.txt example_normal.txt
Is there any workaround since I'm using the function
lattice_dyson_g0_wk()
from TPRF?Thanks for your help. Best regards.
Weiyi