Multiplicity seems to get wrongly deallocated
Investigating the failure of Job #271534, I found that simulation The Hubbard model on a bilayer square latter in the projective algorithm on an M1 Mac produces a runtime error on some, but not all cases.
I narrowed the issue down to the line
Prog/Predefined_Hop_mod.F90:105: if( associated(this(1)%Multiplicity) ) deallocate(this(1)%Multiplicity)
in Subroutine Predefined_hoppings_clear
.
Turning Hopping_Matrix_Type%Multiplicity
into an allocatable and changing the line to
if( allocated(this(1)%Multiplicity) ) deallocate(this(1)%Multiplicity)
solves the problem. I'm not seeing a reason why Hopping_Matrix_Type%Multiplicity
should be a pointer, so I suggest the above changes. If Hopping_Matrix_Type%Multiplicity
is a pointer for some specific reason, we will have to find a safer way for freeing the memory.