jensengroup / hydrogen-bond-correction-f3

Third-Generation Hydrogen-Bonding Corrections for Semiempirical QM Methods and Force Fields
pubs.acs.org/doi/abs/10.1021/ct100408b
GNU General Public License v2.0
1 stars 2 forks source link

different results with gfortran and ifort #1

Open hokru opened 7 years ago

hokru commented 7 years ago

Hi,

I have been using this very nice implementations of Martin's H+ for a while. Now I am interfacing this module to AMBER and I found that gfortran and ifort give different results for a large system (tests on dimers are all fine).

For this molecule big.xyz i get with gfortran v6.3 and v4.8: -58.493085 kcal/mol intel v15:-71.218593 kcal/mol

So far I noticed that different and a different amount of H-bonds are detected, but not why. I also tried ifort -fp-model precise, but no change.

Can someone reproduce my findings? And which result is correct?

charnley commented 7 years ago

Hi @hokru, That sounds very weird. I'm going to look into this, but my phd thesis is due this December, so the debug will have to wait until January when I'm done writing.

hokru commented 7 years ago

ok.

I looking into it a bit and found that there occurs a division by zero in the torsion function. I see torsions like i,j,k,l=12 12 12 22 which then leads to a distances of zero and division by it.

I am not able to quickly understand the loop structure to avoid these incorrect torsions, but escaping the division by zero using

   if(dist<1d-10) then
       cosa=0d0
     else
       cosa = zj1/dist
    endif

at least does not cause floating point exceptions.

There are also some equality statements with floats, but replacing them did not do anything i think. With the above hack I get at least equal results with gfortran and intel (the -71 kcal/mol one).