MSpG%Num_aLat used uninitialized in CFML_From_CIF
I spent quite some time trying to create a python interface for you library. It ended segfaulting all the time and I though of a linking error because static linking worked fine.
However, after some code inspection, I think that the issue is code related instead.
I'm reading a mcif file and the code segfaults in
Cleanup_Symmetry_Operators at about line 620 ( added many print statements so I don't know exactly, but it's where the comment
!Second apply the lattice centring anti-translations is).
It turns out that the variable
MSpG%Num_aLat in CFML_From_CIF.f90 has MAX_INT value when compiled in my module while it's zero in static compilation. From a quick inspection of the code I do not see it being set anywhere when reading a mcif.
I fixed my problem changed lines around 460 to
if(num_alat > 0) then MSpG%MagType=4 if(allocated(MSpG%aLatt_trans)) deallocate(MSpG%aLatt_trans) allocate(MSpG%aLatt_trans(3,num_alat)) MSpG%aLatt_trans = aLat_tr(:,1:num_alat) MSpG%Num_aLat=num_alat else MSpG%Num_aLat=num_alat end if
Not sure it's correct but seems to work for the files I tried till now.