Always save current estimate for rho during self-consistency.

In this way the code should always find the correct charge density
when restarting (please check!)


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@3234 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
giannozz 2006-06-30 15:07:17 +00:00
parent 74bfb87a42
commit 7f9e7f9dd2
2 changed files with 10 additions and 16 deletions

View File

@ -371,17 +371,11 @@ SUBROUTINE electrons()
!
descf = delta_escf()
!
! ... write the charge density to file
!
CALL write_rho( rhonew, nspin )
rho (:,:) = rhonew (:,:)
!
DEALLOCATE( rhonew )
!
ELSE
!
! ... write the self-consistent charge density to file
!
CALL write_rho( rho, nspin )
!
! ... convergence reached: store V(out)-V(in) in vnew ( used
! ... to correct the forces )
@ -396,9 +390,12 @@ SUBROUTINE electrons()
!
descf = 0.D0
!
DEALLOCATE (rhog)
!
END IF
!
! ... write the charge density to file
!
CALL write_rho( rho, nspin )
!
#if defined (EXX)
if (exx_is_active()) then
fock1 = exxenergy2()
@ -412,6 +409,8 @@ SUBROUTINE electrons()
!
END DO scf_step
!
DEALLOCATE (rhog)
!
! ... define the total local potential (external + scf)
!
CALL set_vrs( vrs, vltot, vr, nrxx, nspin, doublegrid )

View File

@ -21,14 +21,13 @@ SUBROUTINE punch( what )
USE wavefunctions_module, ONLY : evc, evc_nc
USE io_files, ONLY : prefix, iunpun, iunwfc, nwordwfc
USE noncollin_module, ONLY : noncolin
USE pw_restart, ONLY : pw_writefile, pw_readfile
USE pw_restart, ONLY : pw_writefile
USE a2F, ONLY : la2F, a2Fsave
!
IMPLICIT NONE
!
CHARACTER(LEN=*) :: what
LOGICAL :: exst
INTEGER :: ios
!
!
WRITE( UNIT = stdout, FMT = '(/,5X,"Writing output data file ",A)' ) &
@ -54,11 +53,7 @@ SUBROUTINE punch( what )
! ... with few k-points is followed by a non-self-consistent one with added
! ... k-points, whose weight is set to zero.
!
IF ( .NOT. lscf .AND. .NOT. lbands ) then
CALL sum_band()
ELSE
CALL pw_readfile( 'rho', ios )
ENDIF
IF ( .NOT. lscf .AND. .NOT. lbands ) CALL sum_band ( )
!
! ... Write: general variables (including dimensions of the arrays),
! ... atomic positions, forces, k-points, eigenvalues