[Wien] Bug in join_vectorfiles (x joinvec): truncates case.energy* and case.vector* when case.klist has fewer k-points than case.klist_band_N
Jaroslav Hamrle
hamrle at karlov.mff.cuni.cz
Sun Aug 9 19:56:03 CEST 2026
Dear colleagues,
I'd like to report a bug in join_vectorfiles.f (SRC_trig, used by x
joinvec) and suggest a fix.
*Symptom*: When using case.klist_band which are run in parallel
calculations (-p), for example
$ x lapw1 -up -band -p
$ x lapw1 -dn -band -p
the outgoing parallel energy and vector files are written to
case.energyup_1, case.energyup_2, etc
case.vectorup_1, case.vector_2, etc
When attempting to joinvec them
$ x joinvec -up
the resulting
case.energyup
case.vectorup
can be silently partly truncated and not containing all k-points.
This truncation happens when number of k-points in the individual
parallel case.klist_band_N is larger than in main case.klist
For example, in my calculation, the case.klist has 641 kpoints, and each
case.klist_band_N has 1024 k-points. But due to the bug in
join_vectorfiles.f, only k-points between 1-641 from each
case.klist_band_N were added. Namely, the resulting case.energyup have
kpoints only in ranges 1-641, 1025-1665, 2049-2689, 3073-3713.
*
Suggested fix of join_vectorfile.f *: the "do" loop summing over
k-points already has a correct EOF handler (end=101, etc.) for detecting
the true end of each file. The read number of k-points, nkpoints,
included in the "do" loop is hence redundant and, in this particular
scenario, wrong. I changed the three "do jk=1,nkpoints" loops (energy,
energydum, and vector joining) to unbounded "do" loops. Now, those "do"
loops terminate solely via the existing "end=" labels.
Note, the variable containing number of k-points,
nkpoints = count_kmesh_klist(unit_klist)
is unused now, and can be deleted. But I left it in the program for a
minimal patch.
Finally, I attach the patch (join_vectorfiles.patch, for
$WIENROOT/SRC_trig, tested against WIEN2k 24.1), together with patch
description and suggested new version of join_vectorfiles.f.
Patch can be applied as:
patch -b join_vectorfiles.f join_vectorfiles.patch
then recompile via siteconfig (Select program --> trig).
With my best regards,
Jaroslav Hamrle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://zeus.theochem.tuwien.ac.at/pipermail/wien/attachments/20260809/2fa5414c/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: join_vectorfiles.patch
Type: text/x-patch
Size: 228 bytes
Desc: not available
URL: <http://zeus.theochem.tuwien.ac.at/pipermail/wien/attachments/20260809/2fa5414c/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: join_vectorfiles.f
Type: text/x-fortran
Size: 7134 bytes
Desc: not available
URL: <http://zeus.theochem.tuwien.ac.at/pipermail/wien/attachments/20260809/2fa5414c/attachment-0001.f>
-------------- next part --------------
- Place join_vectorfiles.patch into $WIENROOT/SRC_trig
- Apply the patch with: patch -b join_vectorfiles.f join_vectorfiles.patch
- Recompile: In ./siteconfig -> R Compile/Recompile -> S Select program -> trig
Description: Fixes join_vectorfiles (x joinvec) truncating energy/vector files
when case.klist has fewer k-points than the actual parallel run
Reference: <mailing-list message URL once posted>
More information about the Wien
mailing list