fix final configuration reinit for exact exchange

exacti-exchange variables were not correctly initialized
when, at the end of variable-cell optimizations, a last check-computation
is done starting from the new cell vectors.
This commit is contained in:
Pietro Delugas 2018-09-11 16:30:26 +02:00
parent 0c463c3469
commit adc4b8e76f
3 changed files with 18 additions and 2 deletions

View File

@ -529,10 +529,14 @@ MODULE exx_base
REAL (dp) :: ft_(3), eps2 = 1.0d-5
!
nxxs = nr1x*nr2x*nr3x
IF(.not. allocated(rir)) ALLOCATE(rir(nxxs,nsym))
IF(.NOT. ALLOCATED(rir)) THEN
ALLOCATE(rir(nxxs,nsym))
ELSE IF ((SIZE(rir,1) .NE. nxxs) ) THEN
DEALLOCATE (rir)
ALLOCATE (rir(nxxs,nsym))
END IF
rir = 0
ispresent(1:nsym) = .false.
DO ikq =1,nkqs
isym = abs(index_sym(ikq))
IF (.not. ispresent(isym) ) THEN
@ -554,12 +558,14 @@ MODULE exx_base
ft_(2) = ft(2,isym)*nr2
ft_(3) = ft(3,isym)*nr3
ftau(:) = NINT(ft_(:))
IF ( abs (ft_(1) - ftau(1) ) / nr1 > eps2 .or. &
abs (ft_(2) - ftau(2) ) / nr2 > eps2 .or. &
abs (ft_(3) - ftau(3) ) / nr3 > eps2 ) THEN
CALL infomsg ('exx_set_symm',' EXX smooth grid is not compatible &
& with fractional translation: change ecutfock')
ENDIF
DO k = 1, nr3
DO j = 1, nr2
DO i = 1, nr1

View File

@ -276,6 +276,8 @@ SUBROUTINE reset_gvectors ( )
USE fft_base, ONLY : dfftp
USE fft_base, ONLY : dffts
USE control_flags, ONLY : lbfgs, lmd
USE funct, ONLY : dft_is_hybrid
USE exx_base, ONLY : exx_grid_init, exx_mp_init, exx_div_check
IMPLICIT NONE
!
WRITE( UNIT = stdout, FMT = 9110 )
@ -302,6 +304,12 @@ SUBROUTINE reset_gvectors ( )
dffts%nr1=0; dffts%nr2=0; dffts%nr3=0
!
CALL init_run()
IF ( dft_is_hybrid() ) THEN
CALL exx_grid_init(REINIT = .TRUE.)
CALL exx_mp_init()
CALL exx_div_check()
ENDIF
!
9110 FORMAT( /5X,'A final scf calculation at the relaxed structure.' )
9120 FORMAT( 5X,'The G-vectors are recalculated for the final unit cell'/ &

View File

@ -181,6 +181,7 @@ SUBROUTINE init_wfc ( ik )
USE mp_bands, ONLY : intra_bgrp_comm, inter_bgrp_comm, &
nbgrp, root_bgrp_id
USE mp, ONLY : mp_bcast
USE funct, ONLY : dft_is_hybrid, stop_exx
!
IMPLICIT NONE
!
@ -299,6 +300,7 @@ SUBROUTINE init_wfc ( ik )
!
! ... subspace diagonalization (calls Hpsi)
!
IF ( dft_is_hybrid() ) CALL stop_exx()
CALL start_clock( 'wfcinit:wfcrot' ); !write(*,*) 'start wfcinit:wfcrot' ; FLUSH(6)
CALL rotate_wfc ( npwx, ngk(ik), n_starting_wfc, gstart, nbnd, wfcatom, npol, okvan, evc, etatom )
CALL stop_clock( 'wfcinit:wfcrot' ); !write(*,*) 'stop wfcinit:wfcrot' ; FLUSH(6)