Bug in .xyz file processing

There is a bug in processing .xyz files with the xyzfile command. The symptoms are exhibited in the ground state forum, in the thread titled
“Error message: Found token: YPAT in the input file”

This seemed strange to me since the only xyz example in the tests is v6/t10, and this runs correctly. Further exploration shows that the bug occurs when the .xyz file name is too short. If the name is of the form aaaa.xyx the string before the .xyz must be at least 3 characters long, i.e. a.xyz or aa.xyz will cause the crash.

You can exhibit the bug with test v6/t10 by renaming the xyz file to e.g. 10.xyz, and making the corresponding change to the .abi file,

Abinit version 10.2.7 compiled from source on OpenSuse, using gfortran 7.5.0.

Ian

It turns out that the situation is even weirder. The program does not seem to need an extension of .xyz, for a xyz file, any filename is accepted if the data in the file conforms to the xyz format.

This bug occurs only when the total length of the filename is 4,5 or 6 characters. (I have tested the example of test v6/10 with xyz filenames from 1 to 16 characters. Possibly the bug might recur with still longer filenames.)

Ian

Hi Ian,

thanks for the bug report. I have a potential fix (need to make sure I don’t break everything else). Could you try it as well?

At the end of subroutine incomprs, in file src/42_parser/m_parser.F90 add the following

“”"
! remove trailing characters left from the recursive string shifts
string(length:stringlen)=blank

end subroutine incomprs
“”"

recompile and try it out. If you confirm, I will push this to v10.4 which should come out in the next month or so.

Best

Matthieu

Hi Matthieu,

That seems to have fixed the problem. I re-compiled with the suggested addition, and ran several trials, both ones that had previously failed, and ones that had succeeded.

With this revision, all of them succeeded.

Ian