Commit 5e525b1e authored by paulatto's avatar paulatto

Fixed possible source of troubles where d3 would add non-lineat core...

Fixed possible source of troubles where d3 would add non-lineat core correction to fildrho and fild0rho file but never remove it. This caused the calculation to produce wrong results if the same fildrho file was used more then once. Now the core correction is added to a separate file.




git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@8722 c92efa57-630b-4861-b058-cf58834340f0
parent 17b6d87e
......@@ -32,7 +32,9 @@ subroutine drho_cc (iflag)
if (.not.nlcc_any) return
if (iflag.eq. - 1) then
scalef = - 1.d0
iudrho = iudrho-1000
iud0rho=iud0rho-1000
RETURN
else
scalef = 1.d0
end if
......
......@@ -34,11 +34,13 @@ SUBROUTINE drho_drc (iudrho_x, u_x, xq_x, drc_x, scalef)
!input: the transformation modes patterns
!input: contain the rhoc (without structu
INTEGER :: ipert, na, mu, nt, ig, errcode
INTEGER :: ipert, na, mu, nt, ig, errcode, iudrho_tmp
REAL (DP) :: gtau
COMPLEX (DP) :: guexp
COMPLEX (DP), ALLOCATABLE :: drhoc (:), drhov (:), uact (:)
iudrho_tmp = iudrho_x
iudrho_x = iudrho_tmp+1000 ! this must be already opened, see openfild3
ALLOCATE (drhoc( dfftp%nnr))
ALLOCATE (drhov( dfftp%nnr))
......@@ -69,7 +71,7 @@ SUBROUTINE drho_drc (iudrho_x, u_x, xq_x, drc_x, scalef)
ENDDO
CALL invfft ('Dense', drhoc, dfftp)
CALL davcio_drho2 (drhov, lrdrho, iudrho_x, ipert, - 1)
CALL davcio_drho2 (drhov, lrdrho, iudrho_tmp, ipert, - 1)
drhov(:) = drhov(:) + scalef * drhoc(:)
CALL davcio_drho2 (drhov, lrdrho, iudrho_x, ipert, + 1)
ENDDO
......
......@@ -107,6 +107,7 @@ SUBROUTINE openfild3
if ( lgamma) tmp_dir=TRIM(tmp_dir)//'_ph0/'
!
CALL diropn (iudrho, filint, lrdrho, exst)
IF(nlcc_any) CALL diropn (iudrho+1000, trim(filint)//"_cc", lrdrho, exst)
!
tmp_dir=tmp_dir_save
! FIXME END
......@@ -117,6 +118,7 @@ SUBROUTINE openfild3
IF (.NOT.lgamma) THEN
filint = TRIM(fild0rho) !//".u"
CALL diropn (iud0rho, filint, lrdrho, exst)
IF(nlcc_any) CALL diropn (iud0rho+1000, trim(filint)//"_cc", lrdrho, exst)
ENDIF
!
END IF
......
......@@ -36,6 +36,10 @@ SUBROUTINE stop_d3 (flag)
!
CLOSE (unit = iudrho, status = 'keep')
IF (.NOT.lgamma) CLOSE (unit = iud0rho, status = 'keep')
IF(nlcc_any) THEN
CLOSE (unit = iudrho+1000, status = 'keep')
IF (.NOT.lgamma) CLOSE (unit = iud0rho+1000, status = 'keep')
ENDIF
!
END IF
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment