wannier-developers / wannier90

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

Fixed bug in writing checkpoint file in parallel mode #500

Closed sjhong6230 closed 3 months ago

sjhong6230 commented 5 months ago

While computing various quantities using wannier90.x and WannierBerri, I reported the following issue.

https://github.com/wannier-berri/wannier-berri/issues/325#issue-2262487002

With more tests, I found out this also happens for postw90.x. Also, it happens only for parallel executions.

When I inspected the code, I noticed a bug in the write_chkpt subroutine in the wannier_prog.f90 file. Since common_data%u_matrix and common_data%u_opt are global, they should not be reduced by MPI routines.

Fixing this point gives consistent results with Wannier90-3.1.0. I also suspect the reason for the above issue is the same.

The reason that this bug was not reported in tests is that the checkpoint files were generated from previous versions.

This bug needs an immediate fix and this PR should be considered urgent.

sjhong6230 commented 5 months ago

Comment on test-suite: To prevent such bugs, I recommend adding test sets that uses wannier90.x and postw90.x consecutively.

JeromeCCP9 commented 3 months ago

Much appreciated, Seung-Ju! J.