Possible bug in positron Doppler calculation with bandpp > 1 in ABINIT 10.8.3

Hello,

I would like to report a possible bug in the positron Doppler calculation (posdoppler = 1) when bandpp > 1.

A similar issue was previously reported in the topic “Positron Doppler calculation fails”. In that discussion, using ABINIT 9.6.2, the calculation crashed when bandpp > 1, while bandpp = 1 allowed the Doppler calculation to proceed.

ABINIT_bug_forum.tgz (503.6 KB)

I have reproduced a very similar problem with ABINIT 10.8.3.

I compiled ABINIT 10.8.3 with Intel oneAPI 2025.1 using the following runtime-check options:

-g -O3 -xHOST -check all,noarg_temp_created,nocontiguous,nooutput_conversion -traceback -extend-source -nofpscomp

The calculation was run with 1024 MPI processes, with:

np_spkpt 128
npfft 8
npband 1

With the original ABINIT 10.8.3 source and bandpp = 50, the Doppler calculation stops with:

forrtl: severe (151): allocatable array is already allocated
...
posdoppler    2548    m_positron.F90

When I changed only bandpp = 50 to bandpp = 1, using the same original source code, the calculation completed successfully.

The corresponding files are included in:

abinit10.8.3_bandpp50/
abinit10.8.3_bandpp1/

The error appears to be related to the allocation of

gammastate_c(iatom)%value

inside the ibpp_pos loop in m_positron.F90:

do ibpp_pos=1,bandpp
  ...
  ABI_MALLOC(gammastate_c(iatom)%value,(lmncmax(itypat)))
  ...
end do

My understanding is that, when bandpp > 1, gammastate_c(iatom)%value is allocated during the first iteration and is then allocated again during the following iteration without being deallocated first. This would explain the severe (151) error. With bandpp = 1, the loop is executed only once, so the second allocation attempt does not occur.

To test this hypothesis, I modified the allocation as follows:

if(.not.allocated(gammastate_c(iatom)%value)) then
  ABI_MALLOC(gammastate_c(iatom)%value,(lmncmax(itypat)))
end if

After recompiling ABINIT 10.8.3 with this modification, the same calculation with bandpp = 50 completed successfully.

The corresponding files and the patch are included in:

abinit10.8.3_bugfixed_bandpp50/
m_positron_bandpp_fix.patch

I also compared the results from the original code with bandpp = 1 and the modified code with bandpp = 50.

Positron lifetime:
bandpp = 1, original : 98.4952682 ps
bandpp = 50, modified: 98.4952700 ps

Annihilation rate:
bandpp = 1, original : 10.1527720 ns^-1
bandpp = 50, modified: 10.1527718 ns^-1

The values agree to approximately the 10^-8 level in relative terms for this test case.

Could you please confirm whether this is a bug in the posdoppler implementation for bandpp > 1, and whether this allocation check is an appropriate fix?

Thank you very much.

Dear KEITA,

Thanks for the investigation.

Your fix seems correct. At worst, adding an If allocated check around the ALLOCATE can’t hurt.
We’ll submit this in the development version

Marc

Dear Marc,

Thank you very much for confirming the issue and for including the fix in the development version.

I appreciate your help.

Best regards,
Keita