Run-time error 65: floating invalid

Run-time error 65: floating invalid

Hi all,

I have encountered this error ("forrtl: error (65): floating invalid") when running a code in which I have defined a kind for real and integers number, through the intrinsic function selected_int/real_kind. I have put these two parameter in a module named "kinds".

When the code computes a mathematical operation, in particular calculates an exponential of a real number, it aborts the execution with that error message. I use the 64bit version of the ifort compiler (composer_xe_2013.1.117) and the following command for compiling:

ifort -g -check all -fpe0 -warn -traceback -debug extended *.f kind.f90 constants.f90 groupv_weighted_k.f90 -o Groupv.x

Obviously, if I set the option "-fpe" to an higher level (the default 3, for example), the error disappears but the output results are "NaN".

Here the lines where the error occurs and the variables declaration section:

        use kinds, only: dp, i4b

        use constants, only: pi, tpi, H_PLANCK_SI, K_BOLTZMANN_SI, BOHR_RADIUS_SI, &
                            K_BOLTZMANN_AU, K_BOLTZMANN_RY, eV_to_kelvin, ry_to_kelvin, &
                            RY_TO_THZ, RY_TO_CMM1, C_SI

        implicit none

        integer(kind=i4b) :: n, nband, nq,  i, j, k, m, l, nks, info, ntemp, nstep=5, nkp, ndisp
        integer, parameter :: cart=3
        real(dp), parameter :: a=4.2499983433897e0_dp,& ! lattice constant in Angstrom
                               vcell=1823.0452e0_dp,&     ! primitive cell volume in AU
                               CMM1_TO_THZ= 1.0e-10_dp*C_SI

        real(dp) :: qlsum, csum, temp(27), T, vcellq, f1, f2, omega, ktemp(3), Tstep, Tstart, Tend
        real(dp), allocatable :: der(:,:,:), qvec3d(:,:,:), omega3d(:,:,:), delta(:,:), gv(:,:),&
            norma(:), avcgv(:), specheat(:), wk(:), Ttemp(:)
        character(100) :: buffer, infile
        character(12) :: dummy_c
        character(6) :: dummy_c2

 
[...]

qlsum = qlsum + ( gv(i,j)*(omega3d(i,j,0))**2.e0_dp*Exp(f2*omega3d(i,j,0)/T) / &
              ( (Exp(f2*omega3d(i,j,0)/T)-1)**2.e0_dp*(T**2.e0_dp) ) )*wk(i)

 

Thanks,

Edoardo

5 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

You have a NaN being computed somewhere - it could be from a zerodivide or maybe from a previous calculation. You would have to show us a complete program that reproduces the problem (reduced to the minimum) for us to help further. Since you have a very complex expression on that assignment, you could try splitting it into a number of smaller assignments and expressions and see which one is responsible (when compiled with -fpe0.)

Steve - Intel Developer Support

Thanks Steve,

I forgot to add some lines of code, because clearly that assignment is inside two do-loops .I followed your last advice, and found which step of the loop produced the "NaN" (although I have not understood the reason yet); I finally managed to solve this. As I'm at beginner-intermediate level with Fortran, I thought that the cause was defining my kind for real and integer numbers.

Thanks again,

Edoardo

Very good - no, specifying kinds would not cause such a problem, and is good practice.

Steve - Intel Developer Support

Check for T==0.0

Replace Exp with a function you write, say myExp, that checks the argument for potential issues.

Note, if the second Exp (myExp) produces 1.0, then the 1.0 - 1 will produce a 0.0 for the denominator

Jim Dempsey

www.quickthreadprogramming.com

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!