wannier-developers / wannier90

Official repository of the Wannier90 code
http://www.wannier.org
GNU General Public License v2.0
238 stars 140 forks source link

Issue with ws_distance #210

Closed giovannipizzi closed 5 years ago

giovannipizzi commented 6 years ago

We (@AntimoMarrazzo and me) have a problem with a specific input.

The code prints ERROR in hamiltonian_wigner_seitz: error in finding Wigner-Seitz points.

There are two issues here:

  1. following the code path, I think the routine is always called, also when use_ws_distance is False. Maybe we should skip that part, so that if an error occurs, at least the code does not stop when setting use_ws_distance=.false..
  2. I don't know why the code stops. I attach here the input tmp.win and the output with high-verbosity tmp.wout (rename the files removing .txt if you want to run again). There are many kpoints so it is hard to check "by eye". (it finds tot = 3524.00000000000, while the number of points in the mp_grid is 3528). We even tried to increase from a 2x2x2 supercell to a larger one and to change a bit one of the thresholds, but apparently this didn't work in the sense that tot is always equal to 3524 (but we should re-check to be sure).

Note: to reproduce without running the DFT calculation, you can just do the following changes:

@paulatz maybe you could help?

giovannipizzi commented 6 years ago

Maybe for debugging it can be useful to use this commit https://github.com/giovannipizzi/wannier90/commit/e8a9dc69707826f76e9095f9e5b2ae022cc7efad where I generalized a bit the parameters of the algorithm

gibertini commented 6 years ago

The issue seems to arise from the fact that when unit cells are very anisotropic (e.g. very stretched in one direction, as in this case) the original range of points among which the code searches for points inside the Wigner-Seitz cell was insufficient.

The range is now larger to comply with these cases and it's no longer hard coded, so that in case of need it can be further enlarged by changing the variable search_size in hamiltonian_wigner_seitz (see #216).

Concerning the problem that this issue arises also when use_ws_distance=.false.: this is due to the fact that hamiltonian_wigner_seitz is called always at the beginning to initialise the variable nrpts and thus allocate a few arrays. I think this can be avoided, and I will work on it.

giovannipizzi commented 5 years ago

Fixed in #216