TRIQS / tprf

TPRF: The Two-Particle Response Function tool box for TRIQS
https://triqs.github.io/tprf
Other
14 stars 12 forks source link

How to solve AttributeError: 'TBLattice' object has no attribute 'on_mesh_brillouin_zone' #31

Open xfzhang-phys opened 2 years ago

xfzhang-phys commented 2 years ago

I'm trying to reproduce the tutorial: "Solving the linearized Eliashberg equation in the random phase approximation limit",and got the following error:


AttributeError Traceback (most recent call last) Input In [17], in <cell line: 6>() 3 square_lattice = create_square_lattice(norb=1, t=1.0) 5 nk = 32 ----> 6 ek = square_lattice.on_mesh_brillouin_zone(n_k=(nk, nk, 1)) 8 from triqs.gf import MeshImFreq 9 from triqs_tprf.lattice import lattice_dyson_g0_wk

AttributeError: 'TBLattice' object has no attribute 'on_mesh_brillouin_zone'

Both triqs and triqs_tprf version are 3.1.0, I installed them by anaconda.

Solving lthe inearized Eliashberg equation in the RPA limit.py.txt

Stefan-Dienst commented 2 years ago

Hi,

thanks for pointing this out. The method on_mesh_brillouin_zone is an old one which does not work anymore, since the triqs.lattice python API changed. You must now first create a kmesh and then use the fourier method of the TBLattice class. The following code snippet should work

from triqs_tprf.tight_binding import create_square_lattice
square_lattice = create_square_lattice(norb=1, t=1.0)

nk = 32
dim = 2

kmesh = square_lattice.get_kmesh(n_k=[nk] * dim + [1] * (3 - dim))
e_k = square_lattice.fourier(kmesh)

or checkout the tests which use this function to create a dispersion relation.

Feel free to open a PR if you got the notebook running, as I don't have any TRIQS environment setup at the moment.