From 5dd3bdca67de103f1f07b2fb1804e5e8a4dd0290 Mon Sep 17 00:00:00 2001 From: paulatto Date: Thu, 12 Feb 2009 18:15:07 +0000 Subject: [PATCH] Realus fixed again (second derivative in first point is not first derivative in second point), actually it makes almost no difference. LP git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@5405 c92efa57-630b-4861-b058-cf58834340f0 --- PW/realus.f90 | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/PW/realus.f90 b/PW/realus.f90 index ab12e456a..575d1ac37 100644 --- a/PW/realus.f90 +++ b/PW/realus.f90 @@ -80,7 +80,7 @@ MODULE realus INTEGER :: idx0, idx, ir INTEGER :: i, j, k, ipol, lm, nb, mb, ijv, ilast REAL(DP) :: posi(3) - REAL(DP), ALLOCATABLE :: rl(:,:), rl2(:) + REAL(DP), ALLOCATABLE :: rl(:,:), rl2(:), d1y(:), d2y(:) REAL(DP), ALLOCATABLE :: tempspher(:,:), qtot(:,:,:), & xsp(:), ysp(:), wsp(:) REAL(DP) :: mbr, mbx, mby, mbz, dmbx, dmby, dmbz, aux @@ -396,16 +396,24 @@ MODULE realus CALL setqfcorrptfirst( upf(nt)%qfcoef(1:,l+1,nb,mb), & first, rgrid(nt)%r(1), upf(nt)%nqf, l ) ! - ! ... compute the second derivative in second point + ! ... compute the second derivative in first point ! CALL setqfcorrptsecond( upf(nt)%qfcoef(1:,l+1,nb,mb), & second, rgrid(nt)%r(1), upf(nt)%nqf, l ) ELSE - ALLOCATE( rl2(10) ) - CALL radial_gradient(ysp(1:10), rl2(1:10), rgrid(nt)%r, 10, 1) - first = rl2(1) - second = rl2(2) - DEALLOCATE( rl2 ) + ! + ! ... if we don't have the analitical coefficients, try to do + ! ... the same numerically (note that setting first=0.d0 and + ! ... second=0.d0 makes almost no difference) + ! + ALLOCATE( d1y(upf(nt)%kkbeta), d2y(upf(nt)%kkbeta) ) + CALL radial_gradient(ysp(1:upf(nt)%kkbeta), d1y, & + rgrid(nt)%r, upf(nt)%kkbeta, 1) + CALL radial_gradient(d1y, d2y, rgrid(nt)%r, upf(nt)%kkbeta, 1) + ! + first = d1y(1) ! first derivative in first point + second =d2y(1) ! second derivative in first point + DEALLOCATE( d1y, d2y ) ENDIF ! ! ... call spline