mirror of https://gitlab.com/QEF/q-e.git
exx_maxstep + restart with exx
This commit is contained in:
parent
c26da09475
commit
f2230cb8f8
|
@ -174,6 +174,7 @@ MODULE control_flags
|
|||
!
|
||||
INTEGER, PUBLIC :: &
|
||||
ngm0, &! used in mix_rho
|
||||
nexxiter, &! the maximum number of outer iteration (exx)
|
||||
niter, &! the maximum number of iteration
|
||||
nmix, &! the number of iteration kept in the history
|
||||
imix ! the type of mixing (0=plain,1=TF,2=local-TF)
|
||||
|
|
|
@ -719,6 +719,9 @@ MODULE input_parameters
|
|||
!! Maximum number of iterations for orthonormalization
|
||||
!! usually between 20 and 300.
|
||||
|
||||
INTEGER :: exx_maxstep = 1000
|
||||
!! maximum number of steps in the outer loop of electronic minimization
|
||||
!! when exx is active (hybrid functionals).
|
||||
INTEGER :: electron_maxstep = 1000
|
||||
!! maximum number of steps in electronic minimization.
|
||||
!! This parameter applies only when using 'cg' electronic or
|
||||
|
@ -1041,7 +1044,7 @@ MODULE input_parameters
|
|||
!! CP: \(1 \text{a.u. of time} = 2.4189\cdot 10^{-17} s\), PW: twice that much.
|
||||
|
||||
NAMELIST / electrons / emass, emass_cutoff, orthogonalization, &
|
||||
electron_maxstep, scf_must_converge, ortho_eps, ortho_max, electron_dynamics, &
|
||||
exx_maxstep, electron_maxstep, scf_must_converge, ortho_eps, ortho_max, electron_dynamics, &
|
||||
electron_damping, electron_velocities, electron_temperature, &
|
||||
ekincw, fnosee, ampre, grease, &
|
||||
diis_size, diis_nreset, diis_hcut, &
|
||||
|
|
|
@ -2124,7 +2124,7 @@ MODULE qes_init_module
|
|||
!
|
||||
!
|
||||
SUBROUTINE qes_init_electron_control(obj, tagname, diagonalization, mixing_mode, mixing_beta,&
|
||||
conv_thr, mixing_ndim, max_nstep, tq_smoothing, tbeta_smoothing,&
|
||||
conv_thr, mixing_ndim, exx_nstep, max_nstep, tq_smoothing, tbeta_smoothing,&
|
||||
diago_thr_init, diago_full_acc, real_space_q, real_space_beta,&
|
||||
diago_cg_maxiter, diago_ppcg_maxiter, diago_david_ndim,&
|
||||
diago_rmm_ndim, diago_gs_nblock, diago_rmm_conv)
|
||||
|
@ -2138,6 +2138,7 @@ MODULE qes_init_module
|
|||
REAL(DP),INTENT(IN) :: mixing_beta
|
||||
REAL(DP),INTENT(IN) :: conv_thr
|
||||
INTEGER,INTENT(IN) :: mixing_ndim
|
||||
INTEGER,INTENT(IN) :: exx_nstep
|
||||
INTEGER,INTENT(IN) :: max_nstep
|
||||
LOGICAL,OPTIONAL,INTENT(IN) :: real_space_q
|
||||
LOGICAL,OPTIONAL,INTENT(IN) :: real_space_beta
|
||||
|
@ -2161,6 +2162,7 @@ MODULE qes_init_module
|
|||
obj%mixing_beta = mixing_beta
|
||||
obj%conv_thr = conv_thr
|
||||
obj%mixing_ndim = mixing_ndim
|
||||
obj%exx_nstep = exx_nstep
|
||||
obj%max_nstep = max_nstep
|
||||
IF ( PRESENT(real_space_q)) THEN
|
||||
obj%real_space_q_ispresent = .TRUE.
|
||||
|
@ -5019,4 +5021,4 @@ MODULE qes_init_module
|
|||
END SUBROUTINE qes_init_rismlaue
|
||||
!
|
||||
!
|
||||
END MODULE qes_init_module
|
||||
END MODULE qes_init_module
|
||||
|
|
|
@ -773,6 +773,7 @@ MODULE qes_types_module
|
|||
REAL(DP) :: mixing_beta
|
||||
REAL(DP) :: conv_thr
|
||||
INTEGER :: mixing_ndim
|
||||
INTEGER :: exx_nstep
|
||||
INTEGER :: max_nstep
|
||||
LOGICAL :: real_space_q_ispresent = .FALSE.
|
||||
LOGICAL :: real_space_q
|
||||
|
@ -2019,4 +2020,4 @@ MODULE qes_types_module
|
|||
END TYPE espresso_type
|
||||
!
|
||||
!
|
||||
END MODULE qes_types_module
|
||||
END MODULE qes_types_module
|
||||
|
|
|
@ -223,7 +223,7 @@ MODULE qexsd_input
|
|||
END SUBROUTINE qexsd_init_basis
|
||||
!-------------------------------------------------------------------------------------------
|
||||
SUBROUTINE qexsd_init_electron_control( obj,diagonalization,mixing_mode,mixing_beta,&
|
||||
conv_thr, mixing_ndim, max_nstep, tqr, real_space, &
|
||||
conv_thr, mixing_ndim, exx_nstep, max_nstep, tqr, real_space, &
|
||||
tq_smoothing, tbeta_smoothing, &
|
||||
diago_thr_init, diago_full_acc, &
|
||||
diago_cg_maxiter, diago_ppcg_maxiter, diago_david_ndim, &
|
||||
|
@ -235,7 +235,7 @@ MODULE qexsd_input
|
|||
TYPE(electron_control_type) :: obj
|
||||
CHARACTER(LEN=*),INTENT(IN) :: diagonalization,mixing_mode
|
||||
REAL(DP),INTENT(IN) :: mixing_beta, conv_thr, diago_thr_init
|
||||
INTEGER,INTENT(IN) :: mixing_ndim,max_nstep, diago_cg_maxiter, &
|
||||
INTEGER,INTENT(IN) :: mixing_ndim,exx_nstep, max_nstep, diago_cg_maxiter, &
|
||||
diago_ppcg_maxiter, diago_david_ndim, &
|
||||
|
||||
diago_rmm_ndim, diago_gs_nblock
|
||||
|
@ -246,7 +246,7 @@ MODULE qexsd_input
|
|||
!
|
||||
CALL qes_init (obj,TAGNAME, DIAGONALIZATION=diagonalization,&
|
||||
MIXING_MODE=mixing_mode,MIXING_BETA=mixing_beta,&
|
||||
CONV_THR=conv_thr,MIXING_NDIM=mixing_ndim,MAX_NSTEP=max_nstep,&
|
||||
CONV_THR=conv_thr,MIXING_NDIM=mixing_ndim,EXX_NSTEP=exx_nstep,MAX_NSTEP=max_nstep,&
|
||||
TQ_SMOOTHING= tq_smoothing, TBETA_SMOOTHING = tbeta_smoothing,&
|
||||
REAL_SPACE_Q=tqr, REAL_SPACE_BETA = real_space, DIAGO_THR_INIT=diago_thr_init,&
|
||||
DIAGO_FULL_ACC=diago_full_acc,DIAGO_CG_MAXITER=diago_cg_maxiter, &
|
||||
|
|
|
@ -355,6 +355,7 @@ MODULE read_namelists_module
|
|||
ortho_eps = 1.E-9_DP
|
||||
ortho_max = 300
|
||||
electron_maxstep = 100
|
||||
exx_maxstep = 100
|
||||
scf_must_converge = .true.
|
||||
!
|
||||
! ... ( 'sd' | 'cg' | 'damp' | 'verlet' | 'none' | 'diis' | 'cp-bo' )
|
||||
|
@ -1109,6 +1110,7 @@ MODULE read_namelists_module
|
|||
CALL mp_bcast( emass_cutoff, ionode_id, intra_image_comm )
|
||||
CALL mp_bcast( orthogonalization, ionode_id, intra_image_comm )
|
||||
CALL mp_bcast( electron_maxstep, ionode_id, intra_image_comm )
|
||||
CALL mp_bcast( exx_maxstep, ionode_id, intra_image_comm )
|
||||
CALL mp_bcast( scf_must_converge, ionode_id, intra_image_comm )
|
||||
CALL mp_bcast( ortho_eps, ionode_id, intra_image_comm )
|
||||
CALL mp_bcast( ortho_max, ionode_id, intra_image_comm )
|
||||
|
|
|
@ -29,7 +29,7 @@ SUBROUTINE electrons()
|
|||
USE tsvdw_module, ONLY : EtsvdW
|
||||
USE scf, ONLY : rho, rho_core, rhog_core, v, vltot, vrs, &
|
||||
kedtau, vnew
|
||||
USE control_flags, ONLY : tr2, niter, conv_elec, restart, lmd, &
|
||||
USE control_flags, ONLY : tr2, nexxiter, conv_elec, restart, lmd, &
|
||||
do_makov_payne, sic
|
||||
USE sic_mod, ONLY : sic_energy, occ_f2fn, occ_fn2f, save_rhon, sic_first
|
||||
USE io_files, ONLY : iunres, seqopn
|
||||
|
@ -39,8 +39,9 @@ SUBROUTINE electrons()
|
|||
USE klist, ONLY : nks
|
||||
USE uspp, ONLY : okvan
|
||||
USE exx, ONLY : aceinit,exxinit, exxenergy2, exxbuff, &
|
||||
fock0, fock1, fock2, fock3, dexx, use_ace, local_thr
|
||||
USE xc_lib, ONLY : xclib_dft_is, exx_is_active
|
||||
fock0, fock1, fock2, fock3, dexx, use_ace, local_thr, &
|
||||
domat
|
||||
USE xc_lib, ONLY : xclib_dft_is, exx_is_active, stop_exx
|
||||
USE control_flags, ONLY : adapt_thr, tr2_init, tr2_multi, gamma_only
|
||||
!
|
||||
USE paw_variables, ONLY : okpaw, ddd_paw, total_core_energy, only_paw
|
||||
|
@ -110,7 +111,7 @@ SUBROUTINE electrons()
|
|||
READ (iunres, *, iostat=ios) iter, tr2, dexx
|
||||
IF ( ios /= 0 ) THEN
|
||||
iter = 0
|
||||
ELSE IF ( iter < 0 .OR. iter > niter ) THEN
|
||||
ELSE IF ( iter < 0 .OR. iter > nexxiter ) THEN
|
||||
iter = 0
|
||||
ELSE
|
||||
READ (iunres, *) exxen, fock0, fock1, fock2
|
||||
|
@ -125,6 +126,9 @@ SUBROUTINE electrons()
|
|||
! ... if restarting here, exx was already active
|
||||
! ... initialize stuff for exx
|
||||
first = .false.
|
||||
!civn see non-scf comment about this
|
||||
Call stop_exx()
|
||||
!
|
||||
CALL exxinit(DoLoc)
|
||||
IF( DoLoc.and.gamma_only) THEN
|
||||
CALL localize_orbitals( )
|
||||
|
@ -135,7 +139,10 @@ SUBROUTINE electrons()
|
|||
CALL seqopn (iunres, 'restart_exx', 'unformatted', exst)
|
||||
IF (exst) READ (iunres, iostat=ios) exxbuff
|
||||
IF (ios /= 0) WRITE(stdout,'(5x,"Error in EXX restart!")')
|
||||
IF (use_ace) CALL aceinit ( DoLoc )
|
||||
!civn
|
||||
!IF (use_ace) CALL aceinit ( DoLoc )
|
||||
domat = .false.
|
||||
!
|
||||
!
|
||||
CALL v_of_rho( rho, rho_core, rhog_core, &
|
||||
ehart, etxc, vtxc, eth, etotefield, charge, v)
|
||||
|
@ -170,7 +177,7 @@ SUBROUTINE electrons()
|
|||
sic_first = .false.
|
||||
END IF
|
||||
!
|
||||
DO idum=1,niter
|
||||
DO idum=1,nexxiter
|
||||
!
|
||||
iter = iter + 1
|
||||
!
|
||||
|
@ -336,11 +343,12 @@ SUBROUTINE electrons()
|
|||
!
|
||||
WRITE( stdout,'(/5x,"EXX: now go back to refine exchange calculation")')
|
||||
!
|
||||
IF ( check_stop_now() ) THEN
|
||||
IF ( check_stop_now() .or. (iter.ge.nexxiter) ) THEN
|
||||
CALL using_et(0)
|
||||
WRITE(stdout,'(5x,"Calculation (EXX) stopped after iteration #", &
|
||||
& i6)') iter
|
||||
conv_elec=.FALSE.
|
||||
IF(iter.ge.nexxiter) conv_elec=.TRUE. ! it will print ace and wfc files for restart
|
||||
CALL seqopn (iunres, 'restart_e', 'formatted', exst)
|
||||
WRITE (iunres, *) iter, tr2, dexx
|
||||
WRITE (iunres, *) exxen, fock0, fock1, fock2
|
||||
|
|
|
@ -163,7 +163,7 @@ SUBROUTINE iosys()
|
|||
USE control_flags, ONLY : isolve, max_cg_iter, max_ppcg_iter, david, &
|
||||
rmm_ndim, rmm_conv, gs_nblock, rmm_with_davidson, &
|
||||
tr2, imix, gamma_only, &
|
||||
nmix, iverbosity, smallmem, niter, &
|
||||
nmix, iverbosity, smallmem, nexxiter, niter, &
|
||||
io_level, ethr, lscf, lbfgs, lmd, &
|
||||
lbands, lconstrain, restart, &
|
||||
llondon, ldftd3, do_makov_payne, lxdm, &
|
||||
|
@ -281,7 +281,7 @@ SUBROUTINE iosys()
|
|||
!
|
||||
! ... ELECTRONS namelist
|
||||
!
|
||||
USE input_parameters, ONLY : electron_maxstep, mixing_mode, mixing_beta, &
|
||||
USE input_parameters, ONLY : exx_maxstep, electron_maxstep, mixing_mode, mixing_beta, &
|
||||
mixing_ndim, mixing_fixed_ns, conv_thr, &
|
||||
tqr, tq_smoothing, tbeta_smoothing, &
|
||||
diago_thr_init, &
|
||||
|
@ -1058,6 +1058,7 @@ SUBROUTINE iosys()
|
|||
!
|
||||
ethr = diago_thr_init
|
||||
tr2 = conv_thr
|
||||
nexxiter = exx_maxstep
|
||||
niter = electron_maxstep
|
||||
adapt_thr = adaptive_thr
|
||||
tr2_init = conv_thr_init
|
||||
|
|
|
@ -27,7 +27,6 @@ SUBROUTINE non_scf( )
|
|||
!
|
||||
USE wavefunctions_gpum, ONLY : using_evc
|
||||
USE wvfct_gpum, ONLY : using_et
|
||||
!civn
|
||||
USE exx, ONLY : exxinit, aceinit, use_ace
|
||||
USE scf, ONLY : rho, rho_core, rhog_core, v, vltot, vrs, kedtau
|
||||
USE ener, ONLY : ehart, etxc, vtxc, epaw
|
||||
|
@ -39,7 +38,6 @@ SUBROUTINE non_scf( )
|
|||
USE gvecs, ONLY : doublegrid
|
||||
USE ions_base, ONLY : nat
|
||||
USE xc_lib, ONLY : stop_exx, xclib_dft_is
|
||||
!
|
||||
!
|
||||
IMPLICIT NONE
|
||||
!
|
||||
|
@ -48,10 +46,9 @@ SUBROUTINE non_scf( )
|
|||
INTEGER :: iter, i, dr2 = 0.0_dp
|
||||
REAL(dp):: ef_scf, ef_scf_up, ef_scf_dw
|
||||
REAL(DP), EXTERNAL :: get_clock
|
||||
!civn
|
||||
REAL(DP) :: charge
|
||||
REAL(DP) :: etot_cmp_paw(nat,2,2)
|
||||
!
|
||||
|
||||
CALL using_evc(0) ! This may not be needed. save buffer is intent(in)
|
||||
!
|
||||
!
|
||||
|
@ -149,7 +146,6 @@ SUBROUTINE non_scf( )
|
|||
RETURN
|
||||
ENDIF
|
||||
!
|
||||
!civn
|
||||
! ... for exact exchange case update the ACE projector with the actual number of bands
|
||||
!
|
||||
IF(xclib_dft_is('hybrid')) THEN
|
||||
|
@ -194,7 +190,6 @@ SUBROUTINE non_scf( )
|
|||
IF ( lberry ) CALL c_phase()
|
||||
IF ( lorbm ) CALL orbm_kubo()
|
||||
END IF
|
||||
!
|
||||
!
|
||||
CALL stop_clock( 'electrons' )
|
||||
!
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
ip_nr3 => nr3, ip_nr1s => nr1s, ip_nr2s => nr2s,ip_nr3s => nr3s, ip_nr1b=>nr1b, &
|
||||
ip_nr2b=>nr2b, ip_nr3b => nr3b, &
|
||||
ip_diagonalization=>diagonalization, mixing_mode, mixing_beta, &
|
||||
mixing_ndim, tqr, tq_smoothing, tbeta_smoothing, electron_maxstep, &
|
||||
mixing_ndim, tqr, tq_smoothing, tbeta_smoothing, exx_maxstep, electron_maxstep, &
|
||||
diago_thr_init, diago_full_acc, &
|
||||
diago_cg_maxiter, diago_ppcg_maxiter, diago_david_ndim, &
|
||||
diago_rmm_ndim, diago_rmm_conv, diago_gs_nblock, &
|
||||
|
@ -465,7 +465,8 @@
|
|||
diagonalization = ip_diagonalization
|
||||
END IF
|
||||
CALL qexsd_init_electron_control(obj%electron_control, diagonalization, mixing_mode, mixing_beta, conv_thr/e2, &
|
||||
mixing_ndim, electron_maxstep, tqr, real_space, tq_smoothing, tbeta_smoothing, diago_thr_init, &
|
||||
mixing_ndim, exx_maxstep, electron_maxstep, tqr, real_space, tq_smoothing, &
|
||||
tbeta_smoothing, diago_thr_init, &
|
||||
diago_full_acc, diago_cg_maxiter, diago_ppcg_maxiter, diago_david_ndim, &
|
||||
diago_rmm_ndim, diago_rmm_conv, diago_gs_nblock)
|
||||
!--------------------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -14,7 +14,7 @@ SUBROUTINE aceinit0()
|
|||
!
|
||||
USE io_global, ONLY : stdout
|
||||
USE klist, ONLY : nks, nkstot
|
||||
USE control_flags, ONLY : lscf
|
||||
USE control_flags, ONLY : lscf, restart
|
||||
USE io_files, ONLY : restart_dir
|
||||
USE wvfct, ONLY : nbnd
|
||||
USE pw_restart_new, ONLY : read_collected_wfc
|
||||
|
@ -31,7 +31,7 @@ SUBROUTINE aceinit0()
|
|||
!
|
||||
CALL start_clock( 'aceinit0' )
|
||||
!
|
||||
IF(lscf) THEN
|
||||
IF(lscf.and..not.restart) THEN
|
||||
!
|
||||
WRITE( stdout, '(5X,"EXX: ACE will be initialized later")' )
|
||||
!
|
||||
|
|
Loading…
Reference in New Issue