[Wien] compilation problems in the new pes module

Pavel Ondračka pavel.ondracka at email.cz
Tue Jul 10 16:54:32 CEST 2018


So after applying the suggested compilation fixes (+ the one
uninitialized variable fix suggested later) I started to test the pes
program. My testcase was simple anatase TiO2. The program finishes
fine, however the spectrum is strange (looks like the Ti3p peak is
almost invisible). So I run with valgrind to see if there are some
obvious errors.

--------------------

==16577== Conditional jump or move depends on uninitialised value(s)
==16577==    at 0x40DD43: read_database2_ (read_database2.f:26)
==16577==    by 0x402CE3: MAIN__ (pes.f:151)
==16577==    by 0x40176C: main (pes.f:3)
==16577==  Uninitialised value was created by a stack allocation
==16577==    at 0x40DC5A: read_database2_ (read_database2.f:1)

ios is used uninitialized at 
read_database2.f:26  do while (ios == 0)

-------------------

==22496== Conditional jump or move depends on uninitialised value(s)
==22496==    at 0x41054E: abs_smooth (SPLINE.f:170)
==22496==    by 0x41054E: setup_ (SPLINE.f:88)
==22496==    by 0x41099C: spline_ (SPLINE.f:15)
==22496==    by 0x40E791: read_database2_ (read_database2.f:111)
==22496==    by 0x402CE3: MAIN__ (pes.f:151)
==22496==    by 0x40176C: main (pes.f:3)
==22496==  Uninitialised value was created by a stack allocation
==22496==    at 0x410980: spline_ (SPLINE.f:1)

this is the delta_x variable first defined in SPLINE and passed down to
setup in
SPLINE.f:15    call  setup(delta_x,X,F,N,strt,stp,J,interpolation)
further down to abs_smooth at:
SPLINE.f:88          call abs_smooth(m4 - m3, delta_x, w1)
where it is finally used in:
SPLINE.f:170     if (x >= delta_x) then
without initialization

-------------------

==29640== Conditional jump or move depends on uninitialised value(s)
==29640==    at 0x40E3EA: unpolarized (read_database2.f:153)
==29640==    by 0x40E3EA: read_database2_ (read_database2.f:79)
==29640==    by 0x402CE3: MAIN__ (pes.f:151)
==29640==    by 0x40176C: main (pes.f:3)
==29640==  Uninitialised value was created by a stack allocation
==29640==    at 0x40DC5A: read_database2_ (read_database2.f:1)

This is the counter variable at 
read_database2.f:153    do I=1,counter
even though is should initialized at
read_database2.f:40               counter       = 0       
the line was not reached at this point, since it is guarded by several
ifs so it is possible that in some cases the variable can stay
uninitialized. Should ever the counter be 0 at the read_database2.f:153
line?

--------------------------

==22325== Conditional jump or move depends on uninitialised value(s)
==22325==    at 0x4801F7A0: __multf3 (in /usr/lib64/libgcc_s-8-
20180502.so.1)
==22325==    by 0x41251F: unpolarized_ (read_database2.f:155)
==22325==    by 0x412E4A: read_database2_ (read_database2.f:79)
==22325==    by 0x403414: MAIN__ (pes.f:151)
==22325==    by 0x40560A: main (pes.f:3)
==22325==  Uninitialised value was created by a stack allocation
==22325==    at 0x4125C9: read_database2_ (read_database2.f:1)

This is the unitialized beta variable. Obviously similar to the above
warning we somehow missed the initialization block starting at
read_database2.f:46 and ending at read_database2.f:56 and there are
more troubles ahead (another 1000+ valgrind warnings).

At this moment I stopped since I suspect something went wrong earlier
and there is no reason to debug codepaths which should probably never
be reached. It is possible that I messed something in the
initialization or my input files are not in order...


The complete output looks like this:

 ================================================
 Please enter the excitation energy (ev):
1486.6
 nat:           2
 mult:           2           4
 aname :Ti O 
 _______
 Valence orbitals according to periodic table data:
 Ti4s3d
 O 2s2p
 ___________
 opening           9 100k_7Rk_PBE.dos2ev
 opening          10 100k_7Rk_PBE.dos3ev
 ________________
 Valence Partial orbital found in case.DOS file:
 Ti4s  1   
 Ti3d  1   
 O 2s  2   
 O 2p  2   
 ____________________
 Enter database (default: 1)
 1  Total cross section & Asymmetry & Non-dipole parameters 100-10000
eV 
    (Trzhaskovskaya etal., Unpolarized & linearly polarized X-ray
source)
    Recommended option !
 2  Total cross section  10-1500eV 
    (Yeh & Lindau 1985; Unpolarized X-ray source)
 3  No cross sections (for testing renormalization) 
1
 ________________
 Enter Calulation Scheme (default: 1)
   1   Unpolarized X-ray source (general)
  
 Linearlly polarized X-ray source
   2   Dipole & NON Dipole - parallel
   3   Dipole              - perpendicular
   4   Dipole & NON Dipole - perpendicular
   5   LDAD
1
 __________________________________
Partial Orbital    Cross section
Ti4s                    0.54346D-01                
Ti3d                    0.54346D-01                
O 2s                    0.54346D-01                
O 2p                    0.54346D-01                
 ________________
 Continue with q_sphere?(Recommended)(Y/n)
y
Partial Orbital    Average q_sphere
Ti4s                 0.73799998D-01
Ti3d                 0.72439998D+00
O 2s                 0.87150002D+00
O 2p                 0.79375005D+00
 _____________________
  Optimize q_sphere?(Y/n)
n
            
 100k_7Rk_PBE.pes1-3  is ready!
            
Note: The following floating-point exceptions are signalling:
IEEE_UNDERFLOW_FLAG IEEE_DENORMAL
STOP pes end


The int file looks like this:
Title
 -5.50 0.002 1.500 0.03  # EMIN, DE, EMAX, Gauss-broadening(>de)
  17    N   0.000          # NUMBER OF DOS-CASES below, G/L/B
broadening (Ry)
    0    1   total        # atom, case=column in qtl-header, label
    1    1   Atom1 tot  
    1    2   Atom1 s
    1    3   Atom1 
    1    4   Atom1 
    1    5   Atom1 
    1    6   Atom1 
    1    7   Atom1 
    1    8   Atom1 
    1    9   Atom1 
    1    10   Atom1 
    2    1   Atom2 
    2    2   Atom2 
    2    3   Atom2
    2    4   Atom2
    2    5   Atom2
    2    6   Atom2

With the corresponding lines from qtl file:
 JATOM  1  MULT= 2  ISPLIT= 3  tot,s,p,pxy,pz,d,dz2,d(x2-
y2),d(yz+xz),dxy,                                                      
                                                                
 JATOM  2  MULT= 4  ISPLIT= 2  tot,s,p,px,py,pz,

So hopefully my input should be fine...
Any help will be appreciated.

Best regards
Pavel


More information about the Wien mailing list