mirror of https://gitlab.com/QEF/q-e.git
Merge branch 'phdiagopt' into 'develop'
Add diagonalization option to ph.x See merge request QEF/q-e!554
This commit is contained in:
commit
4744776b1b
|
@ -71,7 +71,7 @@ SUBROUTINE hp_run_nscf (do_band)
|
|||
CALL fft_type_allocate ( dfftp, at, bg, gcutm, intra_bgrp_comm, nyfft=nyfft )
|
||||
CALL fft_type_allocate ( dffts, at, bg, gcutms, intra_bgrp_comm, nyfft=nyfft)
|
||||
!
|
||||
CALL setup_nscf ( .FALSE., xq, .FALSE. )
|
||||
CALL setup_nscf ( .FALSE., xq, .FALSE., 0)
|
||||
!
|
||||
CALL init_run()
|
||||
!
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
! or http://www.gnu.org/copyleft/gpl.txt .
|
||||
!
|
||||
!----------------------------------------------------------------------------
|
||||
SUBROUTINE setup_nscf ( newgrid, xq, elph_mat )
|
||||
SUBROUTINE setup_nscf ( newgrid, xq, elph_mat, isolveph )
|
||||
!----------------------------------------------------------------------------
|
||||
!
|
||||
! ... This routine initializes variables for the non-scf calculations at k
|
||||
|
@ -53,6 +53,7 @@ SUBROUTINE setup_nscf ( newgrid, xq, elph_mat )
|
|||
REAL (DP), INTENT(IN) :: xq(3)
|
||||
LOGICAL, INTENT (IN) :: newgrid
|
||||
LOGICAL, INTENT (IN) :: elph_mat ! used to be passed through a module.
|
||||
INTEGER, INTENT (IN) :: isolveph ! if present, use this diagonalization method
|
||||
!
|
||||
REAL (DP), ALLOCATABLE :: rtau (:,:,:)
|
||||
LOGICAL :: magnetic_sym, sym(48)
|
||||
|
@ -67,8 +68,14 @@ SUBROUTINE setup_nscf ( newgrid, xq, elph_mat )
|
|||
!
|
||||
! ... variables for iterative diagonalization
|
||||
! ... Davdson: isolve=0, david=4 ; CG: isolve=1, david=1
|
||||
isolve = 0
|
||||
david = 4
|
||||
isolve = isolveph
|
||||
IF (isolveph == 0) THEN
|
||||
david = 4
|
||||
ELSE IF (isolveph == 1) THEN
|
||||
david = 1
|
||||
ELSE
|
||||
call errore('setup_nscf','erroneous value for diagonalization method (isolveph). Should be 0 (david) or 1 (cg)',1)
|
||||
END IF
|
||||
nbndx = david*nbnd
|
||||
max_cg_iter=20
|
||||
natomwfc = n_atom_wfc( nat, ityp, noncolin )
|
||||
|
|
|
@ -414,6 +414,25 @@ input_description -distribution {Quantum Espresso} -package PWscf -program ph.x
|
|||
}
|
||||
}
|
||||
|
||||
var diagonalization -type CHARACTER {
|
||||
default { 'david' }
|
||||
options {
|
||||
info {
|
||||
Diagonalization method for the non-SCF calculations.
|
||||
}
|
||||
opt -val 'david' {
|
||||
Davidson iterative diagonalization with overlap matrix
|
||||
(default). Fast, may in some rare cases fail.
|
||||
}
|
||||
|
||||
opt -val 'cg' {
|
||||
Conjugate-gradient-like band-by-band diagonalization.
|
||||
Slower than 'david' but uses less memory and is
|
||||
(a little bit) more robust.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var read_dns_bare -type LOGICAL {
|
||||
default { .false. }
|
||||
info {
|
||||
|
|
|
@ -22,7 +22,8 @@ subroutine bcast_ph_input ( )
|
|||
niter_ph, lnoloc, alpha_mix, tr2_ph, recover, &
|
||||
ldisp, reduce_io, zue, zeu, epsil, trans, &
|
||||
ldiag, lqdir, search_sym, electron_phonon, &
|
||||
qplot, only_init, only_wfc, low_directory_check
|
||||
qplot, only_init, only_wfc, low_directory_check, &
|
||||
isolveph
|
||||
USE gamma_gamma, ONLY : asr
|
||||
USE disp, ONLY : nq1, nq2, nq3
|
||||
USE partial, ONLY : nat_todo
|
||||
|
@ -96,6 +97,7 @@ subroutine bcast_ph_input ( )
|
|||
CALL mp_bcast( k2, meta_ionode_id, world_comm )
|
||||
CALL mp_bcast( k3, meta_ionode_id, world_comm )
|
||||
CALL mp_bcast( low_directory_check, meta_ionode_id, world_comm )
|
||||
CALL mp_bcast( isolveph, meta_ionode_id, world_comm )
|
||||
CALL mp_bcast( elph_nbnd_min, meta_ionode_id, world_comm )
|
||||
CALL mp_bcast( elph_nbnd_max, meta_ionode_id, world_comm )
|
||||
CALL mp_bcast( el_ph_ngauss, meta_ionode_id, world_comm )
|
||||
|
|
|
@ -214,8 +214,9 @@ MODULE control_ph
|
|||
CHARACTER(LEN=10) :: where_rec='no_recover'! where the ph run recovered
|
||||
CHARACTER(LEN=12) :: electron_phonon
|
||||
CHARACTER(LEN=256) :: flmixdpot, tmp_dir_ph, tmp_dir_phq
|
||||
INTEGER :: rec_code=-1000, &! code for recover
|
||||
rec_code_read=-1000 ! code for recover. Not changed during the run
|
||||
INTEGER :: rec_code=-1000, & ! code for recover
|
||||
rec_code_read=-1000,& ! code for recover. Not changed during the run
|
||||
isolveph = 0 ! diagonalization method used in the nscf calcs
|
||||
LOGICAL :: lgamma_gamma,&! if .TRUE. this is a q=0 computation with k=0 only
|
||||
convt, &! if .TRUE. the phonon has converged
|
||||
epsil, &! if .TRUE. computes dielec. const and eff. charges
|
||||
|
|
|
@ -43,7 +43,7 @@ SUBROUTINE phq_readin()
|
|||
ext_recover, ext_restart, u_from_file, ldiag, &
|
||||
search_sym, lqdir, electron_phonon, tmp_dir_phq, &
|
||||
rec_code_read, qplot, only_init, only_wfc, &
|
||||
low_directory_check
|
||||
low_directory_check, isolveph
|
||||
|
||||
USE save_ph, ONLY : tmp_dir_save, save_ph_input_variables
|
||||
USE gamma_gamma, ONLY : asr
|
||||
|
@ -105,6 +105,7 @@ SUBROUTINE phq_readin()
|
|||
REAL(DP), ALLOCATABLE :: xqaux(:,:)
|
||||
INTEGER, ALLOCATABLE :: wqaux(:)
|
||||
INTEGER :: nqaux, iq
|
||||
CHARACTER(len=80) :: diagonalization='david'
|
||||
!
|
||||
NAMELIST / INPUTPH / tr2_ph, amass, alpha_mix, niter_ph, nmix_ph, &
|
||||
nat_todo, verbosity, iverbosity, outdir, epsil, &
|
||||
|
@ -119,7 +120,7 @@ SUBROUTINE phq_readin()
|
|||
elph_nbnd_min, elph_nbnd_max, el_ph_ngauss, &
|
||||
el_ph_nsigma, el_ph_sigma, electron_phonon, &
|
||||
q_in_band_form, q2d, qplot, low_directory_check, &
|
||||
lshift_q, read_dns_bare, d2ns_type
|
||||
lshift_q, read_dns_bare, d2ns_type, diagonalization
|
||||
|
||||
! tr2_ph : convergence threshold
|
||||
! amass : atomic masses
|
||||
|
@ -193,6 +194,7 @@ SUBROUTINE phq_readin()
|
|||
! d2ns_type='diag': if okvan=.true. the matrix is calculated retaining only
|
||||
! for <\beta_J|\phi_I> products where for J==I.
|
||||
! d2ns_type='dmmp': same as 'diag', but also assuming a m <=> m'.
|
||||
! diagonalization : diagonalization method used in the nscf calc
|
||||
!
|
||||
! Note: meta_ionode is a single processor that reads the input
|
||||
! (ionode is also a single processor but per image)
|
||||
|
@ -338,6 +340,16 @@ SUBROUTINE phq_readin()
|
|||
ELSE IF ( ABS(ios) /= 0 ) THEN
|
||||
CALL errore( 'phq_readin', 'reading inputph namelist', ABS( ios ) )
|
||||
END IF
|
||||
! diagonalization option
|
||||
SELECT CASE(TRIM(diagonalization))
|
||||
CASE ('david','davidson')
|
||||
isolveph = 0
|
||||
CASE ('cg')
|
||||
isolveph = 1
|
||||
CASE DEFAULT
|
||||
CALL errore('phq_readin','diagonalization '//trim(diagonalization)//' not implemented',1)
|
||||
END SELECT
|
||||
|
||||
!
|
||||
! ... broadcast all input variables
|
||||
!
|
||||
|
|
|
@ -13,7 +13,7 @@ SUBROUTINE run_nscf(do_band, iq)
|
|||
! ... phonon code.
|
||||
!
|
||||
!
|
||||
USE control_flags, ONLY : conv_ions
|
||||
USE control_flags, ONLY : conv_ions, isolve
|
||||
USE basis, ONLY : starting_wfc, starting_pot, startingconfig
|
||||
USE io_files, ONLY : prefix, tmp_dir, wfc_dir, seqopn
|
||||
USE lsda_mod, ONLY : nspin
|
||||
|
@ -29,7 +29,7 @@ SUBROUTINE run_nscf(do_band, iq)
|
|||
USE disp, ONLY : lgamma_iq
|
||||
USE control_ph, ONLY : reduce_io, recover, tmp_dir_phq, &
|
||||
ext_restart, bands_computed, newgrid, qplot, &
|
||||
only_wfc
|
||||
only_wfc, isolveph
|
||||
USE io_global, ONLY : stdout
|
||||
USE save_ph, ONLY : tmp_dir_save
|
||||
!
|
||||
|
@ -98,7 +98,7 @@ SUBROUTINE run_nscf(do_band, iq)
|
|||
CALL fft_type_allocate ( dfftp, at, bg, gcutm, intra_bgrp_comm, nyfft=nyfft )
|
||||
CALL fft_type_allocate ( dffts, at, bg, gcutms, intra_bgrp_comm, nyfft=nyfft)
|
||||
!
|
||||
CALL setup_nscf ( newgrid, xq, elph_mat )
|
||||
CALL setup_nscf ( newgrid, xq, elph_mat, isolveph )
|
||||
!
|
||||
CALL init_run()
|
||||
!
|
||||
|
|
Loading…
Reference in New Issue