Merge branch 'wfcinit_gpu' into 'develop'

atomic_wfc_gpu shouldn't be called when natomwfc is zero

See merge request QEF/q-e!1410
This commit is contained in:
giannozz 2021-05-06 17:45:15 +00:00
commit d38b6d54a4
2 changed files with 20 additions and 20 deletions

View File

@ -1,4 +1,4 @@
!
!
! Copyright (C) 2001-2020 Quantum ESPRESSO group
! This file is distributed under the terms of the
! GNU General Public License. See the file `License'
@ -39,7 +39,7 @@ SUBROUTINE wfcinit()
!
IMPLICIT NONE
!
INTEGER :: ik, ierr, exst_sum
INTEGER :: ik, ierr, exst_sum
LOGICAL :: exst, exst_mem, exst_file, opnd_file, twfcollect_file
CHARACTER (LEN=256) :: dirname
TYPE ( output_type ) :: output_obj
@ -67,12 +67,12 @@ SUBROUTINE wfcinit()
CALL mp_sum (exst_sum, intra_image_comm)
!
! Check whether wavefunctions are collected (info in xml file)
dirname = restart_dir ( )
dirname = restart_dir ( )
IF (ionode) CALL qexsd_readschema ( xmlfile(), ierr, output_obj )
CALL mp_bcast(ierr, ionode_id, intra_image_comm)
IF ( ierr <= 0 ) THEN
! xml file is valid
IF (ionode) twfcollect_file = output_obj%band_structure%wf_collected
IF (ionode) twfcollect_file = output_obj%band_structure%wf_collected
CALL mp_bcast(twfcollect_file, ionode_id, intra_image_comm)
CALL qes_reset ( output_obj )
ELSE
@ -91,7 +91,7 @@ SUBROUTINE wfcinit()
!
WRITE( stdout, '(5X,"Cannot read wfcs: file not found")' )
IF (exst_file) THEN
CALL close_buffer(iunwfc, 'delete')
CALL close_buffer(iunwfc, 'delete')
CALL open_buffer(iunwfc,'wfc', nwordwfc, io_level, exst_mem, exst_file)
END IF
starting_wfc = 'atomic+random'
@ -145,7 +145,7 @@ SUBROUTINE wfcinit()
END IF
!
! ... exit here if starting from file or for non-scf calculations.
! ... In the latter case the starting wavefunctions are not
! ... In the latter case the starting wavefunctions are not
! ... calculated here but just before diagonalization (to reduce I/O)
!
IF ( ( .NOT. lscf .AND. .NOT. lelfield ) .OR. TRIM(starting_wfc) == 'file' ) THEN
@ -258,7 +258,7 @@ SUBROUTINE init_wfc ( ik )
!
ALLOCATE( wfcatom( npwx, npol, n_starting_wfc ) )
!
IF ( starting_wfc(1:6) == 'atomic' ) THEN
IF ( n_starting_atomic_wfc > 0 ) THEN
!
CALL start_clock( 'wfcinit:atomic' ); !write(*,*) 'start wfcinit:atomic' ; FLUSH(6)
CALL atomic_wfc( ik, wfcatom )
@ -280,7 +280,7 @@ SUBROUTINE init_wfc ( ik )
arg = tpi * randy()
!
wfcatom(ig,ipol,ibnd) = wfcatom(ig,ipol,ibnd) * &
( 1.0_DP + 0.05_DP * CMPLX( rr*COS(arg), rr*SIN(arg) ,kind=DP) )
( 1.0_DP + 0.05_DP * CMPLX( rr*COS(arg), rr*SIN(arg) ,kind=DP) )
!
END DO
!
@ -298,7 +298,7 @@ SUBROUTINE init_wfc ( ik )
DO ibnd = n_starting_atomic_wfc + 1, n_starting_wfc
!
DO ipol = 1, npol
!
!
wfcatom(:,ipol,ibnd) = (0.0_dp, 0.0_dp)
!
DO ig = 1, ngk(ik)
@ -316,7 +316,7 @@ SUBROUTINE init_wfc ( ik )
END DO
!
END DO
! when band parallelization is active, the first band group distributes
! the wfcs to the others making sure all bgrp have the same starting wfc
! FIXME: maybe this should be done once evc are computed, not here?
@ -336,13 +336,13 @@ SUBROUTINE init_wfc ( ik )
! ... by setting lelfield = .false. one prevents the calculation of
! ... electric enthalpy in the Hamiltonian (cannot be calculated
! ... at this stage: wavefunctions at previous step are missing)
!
!
lelfield_save = lelfield
lelfield = .FALSE.
!
! ... subspace diagonalization (calls Hpsi)
!
IF ( xclib_dft_is('hybrid') ) CALL stop_exx()
IF ( xclib_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 using_evc(1) ! rotate_wfc (..., evc, etatom) -> evc : out (not specified)

View File

@ -39,7 +39,7 @@ SUBROUTINE wfcinit_gpu()
!
IMPLICIT NONE
!
INTEGER :: ik, ierr, exst_sum
INTEGER :: ik, ierr, exst_sum
LOGICAL :: exst, exst_mem, exst_file, opnd_file, twfcollect_file
CHARACTER (LEN=256) :: dirname
TYPE ( output_type ) :: output_obj
@ -67,12 +67,12 @@ SUBROUTINE wfcinit_gpu()
CALL mp_sum (exst_sum, intra_image_comm)
!
! Check whether wavefunctions are collected (info in xml file)
dirname = restart_dir ( )
dirname = restart_dir ( )
IF (ionode) CALL qexsd_readschema ( xmlfile(), ierr, output_obj )
CALL mp_bcast(ierr, ionode_id, intra_image_comm)
IF ( ierr <= 0 ) THEN
! xml file is valid
IF (ionode) twfcollect_file = output_obj%band_structure%wf_collected
IF (ionode) twfcollect_file = output_obj%band_structure%wf_collected
CALL mp_bcast(twfcollect_file, ionode_id, intra_image_comm)
CALL qes_reset ( output_obj )
ELSE
@ -91,7 +91,7 @@ SUBROUTINE wfcinit_gpu()
!
WRITE( stdout, '(5X,"Cannot read wfcs: file not found")' )
IF (exst_file) THEN
CALL close_buffer(iunwfc, 'delete')
CALL close_buffer(iunwfc, 'delete')
CALL open_buffer(iunwfc,'wfc', nwordwfc, io_level, exst_mem, exst_file)
END IF
starting_wfc = 'atomic+random'
@ -145,7 +145,7 @@ SUBROUTINE wfcinit_gpu()
END IF
!
! ... exit here if starting from file or for non-scf calculations.
! ... In the latter case the starting wavefunctions are not
! ... In the latter case the starting wavefunctions are not
! ... calculated here but just before diagonalization (to reduce I/O)
!
IF ( ( .NOT. lscf .AND. .NOT. lelfield ) .OR. TRIM(starting_wfc) == 'file' ) THEN
@ -270,7 +270,7 @@ SUBROUTINE init_wfc_gpu ( ik )
ALLOCATE( wfcatom_d( npwx, npol, n_starting_wfc ) )
ALLOCATE(randy_d(2 * n_starting_wfc * npol * ngk(ik)))
!
IF ( starting_wfc(1:6) == 'atomic' ) THEN
IF ( n_starting_atomic_wfc > 0 ) THEN
!
CALL start_clock_gpu( 'wfcinit:atomic' ); !write(*,*) 'start wfcinit:atomic' ; FLUSH(6)
CALL atomic_wfc_gpu( ik, wfcatom_d )
@ -367,13 +367,13 @@ SUBROUTINE init_wfc_gpu ( ik )
! ... by setting lelfield = .false. one prevents the calculation of
! ... electric enthalpy in the Hamiltonian (cannot be calculated
! ... at this stage: wavefunctions at previous step are missing)
!
!
lelfield_save = lelfield
lelfield = .FALSE.
!
! ... subspace diagonalization (calls Hpsi)
!
IF ( xclib_dft_is('hybrid') ) CALL stop_exx()
IF ( xclib_dft_is('hybrid') ) CALL stop_exx()
CALL start_clock_gpu( 'wfcinit:wfcrot' ); !write(*,*) 'start wfcinit:wfcrot' ; FLUSH(6)
CALL using_evc_d(2) ! rotate_wfc_gpu (..., evc_d, etatom_d) -> evc : out (not specified)
CALL rotate_wfc_gpu ( npwx, ngk(ik), n_starting_wfc, gstart, nbnd, wfcatom_d, npol, okvan, evc_d, etatom_d )