From 5f4e65c5ebf3f88c4901e4c8533e85d4b33fa2e3 Mon Sep 17 00:00:00 2001
From: Paolo Giannozzi
Date: Fri, 1 Nov 2019 21:53:41 +0100
Subject: [PATCH 1/3] projwfc: wfcs are longer read in collected format,
re-written in distributed one. Routine read_collected_to evc deleted; routine
read_file replaced by a wrapper that has exactly the same functionalities as
before. Routine projwave in projwfc.x, using serial diagonalization, deleted:
can be replaced in all cases by the version using parallel linear algebra.
Files make.depend updated.
---
PP/src/make.depend | 1 +
PP/src/projwfc.f90 | 250 +++-----------------------------------
PW/src/make.depend | 7 ++
PW/src/pw_restart_new.f90 | 167 ++++++++++++-------------
PW/src/read_file_new.f90 | 97 +++++++++------
PW/src/wfcinit.f90 | 15 ++-
6 files changed, 183 insertions(+), 354 deletions(-)
diff --git a/PP/src/make.depend b/PP/src/make.depend
index a009ef55c..f36b34402 100644
--- a/PP/src/make.depend
+++ b/PP/src/make.depend
@@ -523,6 +523,7 @@ projwfc.o : ../../Modules/run_info.o
projwfc.o : ../../Modules/uspp.o
projwfc.o : ../../Modules/wavefunctions.o
projwfc.o : ../../PW/src/atomic_wfc_mod.o
+projwfc.o : ../../PW/src/pw_restart_new.o
projwfc.o : ../../PW/src/pwcom.o
projwfc.o : ../../PW/src/start_k.o
projwfc.o : ../../PW/src/symm_base.o
diff --git a/PP/src/projwfc.f90 b/PP/src/projwfc.f90
index 73ecb9f8c..0559177e0 100644
--- a/PP/src/projwfc.f90
+++ b/PP/src/projwfc.f90
@@ -50,7 +50,7 @@ PROGRAM do_projwfc
REAL (DP), allocatable :: xk_collect(:,:)
REAL (DP) :: Emin, Emax, DeltaE, degauss1, ef_0
INTEGER :: nks2, ngauss1, ios
- LOGICAL :: lwrite_overlaps, lbinary_data
+ LOGICAL :: lwrite_overlaps, lbinary_data, wfc_is_collected
LOGICAL :: lsym, kresolveddos, tdosinboxes, plotboxes, pawproj
INTEGER, PARAMETER :: N_MAX_BOXES = 999
INTEGER :: n_proj_boxes, irmin(3,N_MAX_BOXES), irmax(3,N_MAX_BOXES)
@@ -139,7 +139,9 @@ PROGRAM do_projwfc
!
! Now allocate space for pwscf variables, read and check them.
!
- CALL read_file ( )
+ CALL read_file_new ( wfc_is_collected )
+ IF ( .NOT. wfc_is_collected ) &
+ CALL errore ('projwfc','wavefunctions not available?!?',1)
!
IF(lgww) CALL get_et_from_gww ( nbnd, et )
!
@@ -153,10 +155,6 @@ PROGRAM do_projwfc
END IF
IF ( lforcet .AND. tdosinboxes ) CALL errore ('projwfc','incompatible options',3)
!
- ! More initializations
- !
- CALL openfil_pp ( )
- !
! Tetrahedron method
!
IF ( ltetra ) THEN
@@ -218,7 +216,7 @@ PROGRAM do_projwfc
IF ( lforcet .OR. noncolin ) THEN
CALL projwave_nc(filproj, lsym, lwrite_overlaps, lbinary_data,ef_0)
ELSE
- CALL pprojwave (filproj, lsym, lwrite_overlaps, lbinary_data )
+ CALL projwave (filproj, lsym, lwrite_overlaps, lbinary_data )
ENDIF
ENDIF
!
@@ -393,219 +391,6 @@ SUBROUTINE write_lowdin ( filproj, nat, lmax_wfc, nspin, charges, charges_lm )
END SUBROUTINE
!
!-----------------------------------------------------------------------
-SUBROUTINE projwave( filproj, lsym, lwrite_ovp, lbinary )
- !-----------------------------------------------------------------------
- !
- USE io_global, ONLY : stdout, ionode
- USE ions_base, ONLY : zv, tau, nat, ntyp => nsp, ityp, atm
- USE basis, ONLY : natomwfc, swfcatom
- USE fft_base, ONLY : dfftp
- USE klist, ONLY : xk, nks, nkstot, nelec, ngk, igk_k
- USE lsda_mod, ONLY : nspin
- USE wvfct, ONLY : npwx, nbnd, et
- USE uspp, ONLY : nkb, vkb
- USE becmod, ONLY : bec_type, becp, calbec, allocate_bec_type, deallocate_bec_type
- USE io_files, ONLY : prefix, tmp_dir, nwordwfc, iunwfc
- USE control_flags, ONLY: gamma_only
- USE wavefunctions, ONLY: evc
- !
- USE projections
- !
- IMPLICIT NONE
- !
- CHARACTER (len=*) :: filproj
- LOGICAL :: lwrite_ovp, lbinary
- INTEGER :: npw, ik, ibnd, i, j, k, na, nb, nt, isym, n, m, l, nwfc,&
- lmax_wfc, is
- REAL(DP), ALLOCATABLE :: e (:)
- COMPLEX(DP), ALLOCATABLE :: wfcatom (:,:), proj0(:,:)
- ! Some workspace for gamma-point calculation ...
- REAL (DP), ALLOCATABLE :: rproj0(:,:)
- COMPLEX(DP), ALLOCATABLE :: overlap(:,:), work(:,:)
- REAL (DP), ALLOCATABLE ::roverlap(:,:)
- !
- INTEGER :: nksinit, nkslast
- LOGICAL :: lsym
- LOGICAL :: freeswfcatom
- !
- !
- IF ( natomwfc <= 0 ) CALL errore &
- ('projwave', 'Cannot project on zero atomic wavefunctions!', 1)
- WRITE( stdout, '(/5x,"Calling projwave .... ")')
- IF ( gamma_only ) &
- WRITE( stdout, '(5x,"gamma-point specific algorithms are used")')
- !
- ! fill structure nlmchi
- !
- CALL fill_nlmchi ( natomwfc, nwfc, lmax_wfc )
- !
- ALLOCATE( proj (natomwfc, nbnd, nkstot) )
- !
- ALLOCATE( proj_aux (natomwfc, nbnd, nkstot) )
- !
- IF ( lwrite_ovp ) THEN
- ALLOCATE( ovps_aux(natomwfc, natomwfc, nkstot) )
- ELSE
- ALLOCATE( ovps_aux(1,1,1) )
- ENDIF
- ovps_aux = (0.d0, 0.d0)
- !
- IF (.not. ALLOCATED(swfcatom)) THEN
- ALLOCATE(swfcatom (npwx , natomwfc ) )
- freeswfcatom = .true.
- ELSE
- freeswfcatom = .false.
- ENDIF
- ALLOCATE(wfcatom (npwx, natomwfc) )
- ALLOCATE(e (natomwfc) )
- !
- ALLOCATE(overlap (natomwfc, natomwfc) )
- overlap= (0.d0,0.d0)
- IF ( gamma_only ) THEN
- ALLOCATE(roverlap (natomwfc, natomwfc) )
- roverlap= 0.d0
- ENDIF
- !
- ! loop on k points
- !
- DO ik = 1, nks
-
- npw = ngk(ik)
- CALL davcio (evc, 2*nwordwfc, iunwfc, ik, - 1)
-
- CALL atomic_wfc (ik, wfcatom)
-
- CALL allocate_bec_type (nkb, natomwfc, becp )
- !
- CALL init_us_2 (npw, igk_k(1,ik), xk (1, ik), vkb)
- CALL calbec ( npw, vkb, wfcatom, becp)
- CALL s_psi (npwx, npw, natomwfc, wfcatom, swfcatom)
- !
- CALL deallocate_bec_type (becp)
- !
- ! wfcatom = |phi_i> , swfcatom = \hat S |phi_i>
- ! calculate overlap matrix O_ij =
- !
- IF ( gamma_only ) THEN
- CALL calbec ( npw, wfcatom, swfcatom, roverlap )
- overlap(:,:)=cmplx(roverlap(:,:),0.0_dp, kind=dp)
- ! TEMP: diagonalization routine for real matrix should be used instead
- ELSE
- CALL calbec ( npw, wfcatom, swfcatom, overlap )
- ENDIF
- !
- ! save the overlap matrix
- !
- IF ( lwrite_ovp ) THEN
- !
- ovps_aux(1:natomwfc,1:natomwfc,ik) = overlap(1:natomwfc,1:natomwfc)
- !
- ENDIF
- !
- ! calculate O^{-1/2}
- !
- ALLOCATE(work (natomwfc, natomwfc) )
- CALL cdiagh (natomwfc, overlap, natomwfc, e, work)
- DO i = 1, natomwfc
- e (i) = 1.d0 / dsqrt (e (i) )
- ENDDO
- DO i = 1, natomwfc
- DO j = i, natomwfc
- overlap (i, j) = (0.d0, 0.d0)
- DO k = 1, natomwfc
- overlap (i, j) = overlap (i, j) + e (k) * work (j, k) * conjg (work (i, k) )
- ENDDO
- IF (j /= i) overlap (j, i) = conjg (overlap (i, j))
- ENDDO
- ENDDO
- DEALLOCATE (work)
- !
- ! calculate wfcatom = O^{-1/2} \hat S | phi>
- !
- IF ( gamma_only ) THEN
- roverlap(:,:)=REAL(overlap(:,:),DP)
- ! TEMP: diagonalization routine for real matrix should be used instead
- CALL DGEMM ('n', 't', 2*npw, natomwfc, natomwfc, 1.d0 , &
- swfcatom, 2*npwx, roverlap, natomwfc, 0.d0, wfcatom, 2*npwx)
- ELSE
- CALL ZGEMM ('n', 't', npw, natomwfc, natomwfc, (1.d0, 0.d0) , &
- swfcatom, npwx, overlap, natomwfc, (0.d0, 0.d0), wfcatom, npwx)
- ENDIF
- !
- ! make the projection ,
- ! symmetrize the projections if required
- !
- IF ( gamma_only ) THEN
- !
- ALLOCATE( rproj0(natomwfc,nbnd) )
- CALL calbec ( npw, wfcatom, evc, rproj0)
- proj_aux(:,:,ik) = cmplx( rproj0(:,:), 0.0_dp, kind=dp )
- IF (lsym) THEN
- CALL sym_proj_g (rproj0, proj(:,:,ik))
- ELSE
- proj(:,:,ik)=abs(rproj0(:,:))**2
- ENDIF
- DEALLOCATE (rproj0)
- !
- ELSE
- !
- ALLOCATE( proj0(natomwfc,nbnd) )
- CALL calbec ( npw, wfcatom, evc, proj0)
- proj_aux(:,:,ik) = proj0(:,:)
- IF (lsym) THEN
- CALL sym_proj_k (proj0, proj(:,:,ik))
- ELSE
- proj(:,:,ik)=abs(proj0(:,:))**2
- ENDIF
- DEALLOCATE (proj0)
- !
- ENDIF
- ! on k-points
- ENDDO
- !
- DEALLOCATE (e)
- DEALLOCATE (wfcatom)
- IF (freeswfcatom) DEALLOCATE (swfcatom)
- IF ( gamma_only ) THEN
- DEALLOCATE (roverlap)
- ENDIF
- DEALLOCATE (overlap)
- !
- ! vectors et and proj are distributed across the pools
- ! collect data for all k-points to the first pool
- !
- CALL poolrecover (et, nbnd, nkstot, nks)
- CALL poolrecover (proj, nbnd * natomwfc, nkstot, nks)
- !
- CALL poolrecover (proj_aux, 2 * nbnd * natomwfc, nkstot, nks)
- IF ( lwrite_ovp ) THEN
- CALL poolrecover (ovps_aux, 2 * natomwfc * natomwfc, nkstot, nks)
- ENDIF
- !
- IF ( ionode ) THEN
- !
- ! write on the file filproj
- !
- CALL write_proj_file ( filproj, proj )
- !
- ! write projections to file using iotk
- !
- CALL write_proj_iotk( "atomic_proj", lbinary, proj_aux, lwrite_ovp, &
- ovps_aux )
- !
- DEALLOCATE( proj_aux, ovps_aux )
- !
- ! write to standard output
- !
- CALL write_proj( lmax_wfc, filproj, proj )
- !
- ENDIF
- !
- RETURN
- !
-END SUBROUTINE projwave
-!
-!-----------------------------------------------------------------------
SUBROUTINE sym_proj_g (rproj0, proj_out)
!-----------------------------------------------------------------------
!
@@ -1129,7 +914,8 @@ SUBROUTINE projwave_nc(filproj, lsym, lwrite_ovp, lbinary, ef_0 )
USE uspp, ONLY: nkb, vkb
USE uspp_param, ONLY: upf
USE becmod, ONLY: bec_type, becp, calbec, allocate_bec_type, deallocate_bec_type
- USE io_files, ONLY: prefix, nwordwfc, iunwfc
+ USE io_files, ONLY : restart_dir
+ USE pw_restart_new,ONLY : read_this_wfc
USE wavefunctions, ONLY: evc
USE mp, ONLY : mp_sum
USE mp_pools, ONLY : inter_pool_comm, intra_pool_comm
@@ -1215,7 +1001,7 @@ SUBROUTINE projwave_nc(filproj, lsym, lwrite_ovp, lbinary, ef_0 )
swfcatom= (0.d0,0.d0)
npw = ngk(ik)
- CALL davcio (evc, 2*nwordwfc, iunwfc, ik, - 1)
+ CALL read_this_wfc ( restart_dir() , ik, evc )
!---- AlexS
! To project on real harmonics, not on spinors.
@@ -1425,7 +1211,8 @@ SUBROUTINE projwave_paw( filproj)
USE uspp, ONLY: nkb, vkb
USE uspp_param, ONLY : upf
USE becmod, ONLY: bec_type, becp, calbec, allocate_bec_type, deallocate_bec_type
- USE io_files, ONLY: prefix, nwordwfc, iunwfc
+ USE io_files, ONLY : restart_dir
+ USE pw_restart_new,ONLY : read_this_wfc
USE wavefunctions, ONLY: evc
!
USE projections
@@ -1489,7 +1276,7 @@ SUBROUTINE projwave_paw( filproj)
! loop on k points
!
DO ik = 1, nks
- CALL davcio (evc, 2*nwordwfc, iunwfc, ik, - 1)
+ CALL read_this_wfc ( restart_dir() , ik, evc )
npw = ngk(ik)
CALL init_us_2 (npw, igk_k(1,ik), xk (1, ik), vkb)
@@ -1785,7 +1572,7 @@ END SUBROUTINE write_proj_file
! projwave with distributed matrixes
!
!-----------------------------------------------------------------------
-SUBROUTINE pprojwave( filproj, lsym, lwrite_ovp, lbinary )
+SUBROUTINE projwave( filproj, lsym, lwrite_ovp, lbinary )
!-----------------------------------------------------------------------
!
USE io_global, ONLY : stdout, ionode
@@ -1797,9 +1584,10 @@ SUBROUTINE pprojwave( filproj, lsym, lwrite_ovp, lbinary )
USE wvfct, ONLY : npwx, nbnd, et
USE uspp, ONLY : nkb, vkb
USE becmod, ONLY : bec_type, becp, calbec, allocate_bec_type, deallocate_bec_type
- USE io_files, ONLY : prefix, tmp_dir, nwordwfc, iunwfc
- USE control_flags, ONLY: gamma_only
- USE wavefunctions, ONLY: evc
+ USE io_files, ONLY : prefix, restart_dir, tmp_dir
+ USE control_flags, ONLY : gamma_only
+ USE pw_restart_new,ONLY : read_this_wfc
+ USE wavefunctions, ONLY : evc
!
USE projections
!
@@ -1875,7 +1663,7 @@ SUBROUTINE pprojwave( filproj, lsym, lwrite_ovp, lbinary )
! Open file as temporary storage
!
iunaux = find_free_unit()
- auxname = TRIM(tmp_dir) // TRIM(ADJUSTL(prefix)) // '.AUX' // TRIM(nd_nmbr)
+ auxname = TRIM( restart_dir() ) // 'AUX' // TRIM(nd_nmbr)
OPEN( unit=iunaux, file=trim(auxname), status='unknown', form='unformatted')
!
ALLOCATE( desc_ip( np_ortho(1), np_ortho(2) ) )
@@ -1902,7 +1690,7 @@ SUBROUTINE pprojwave( filproj, lsym, lwrite_ovp, lbinary )
DO ik = 1, nks
!
npw = ngk(ik)
- CALL davcio (evc, 2*nwordwfc, iunwfc, ik, - 1)
+ CALL read_this_wfc ( restart_dir() , ik, evc )
CALL atomic_wfc (ik, wfcatom)
@@ -2378,5 +2166,5 @@ CONTAINS
END SUBROUTINE wf_times_roverlap
!
-END SUBROUTINE pprojwave
+END SUBROUTINE projwave
!
diff --git a/PW/src/make.depend b/PW/src/make.depend
index 6c0e5924f..a1f705fca 100644
--- a/PW/src/make.depend
+++ b/PW/src/make.depend
@@ -1573,10 +1573,13 @@ read_conf_from_file.o : ../../Modules/io_files.o
read_conf_from_file.o : ../../Modules/io_global.o
read_conf_from_file.o : ../../Modules/ions_base.o
read_conf_from_file.o : ../../Modules/kind.o
+read_conf_from_file.o : ../../Modules/mp_images.o
+read_conf_from_file.o : ../../Modules/qes_bcast_module.o
read_conf_from_file.o : ../../Modules/qes_libs_module.o
read_conf_from_file.o : ../../Modules/qes_types_module.o
read_conf_from_file.o : ../../Modules/qexsd.o
read_conf_from_file.o : ../../Modules/qexsd_copy.o
+read_conf_from_file.o : ../../UtilXlib/mp.o
read_file_new.o : ../../Modules/cell_base.o
read_file_new.o : ../../Modules/constants.o
read_file_new.o : ../../Modules/control_flags.o
@@ -1604,6 +1607,7 @@ read_file_new.o : ../../Modules/recvec.o
read_file_new.o : ../../Modules/recvec_subs.o
read_file_new.o : ../../Modules/tsvdw.o
read_file_new.o : ../../Modules/uspp.o
+read_file_new.o : ../../Modules/wavefunctions.o
read_file_new.o : ../../UtilXlib/mp.o
read_file_new.o : Coul_cut_2D.o
read_file_new.o : atomic_wfc_mod.o
@@ -1821,6 +1825,7 @@ setup.o : ../../Modules/io_global.o
setup.o : ../../Modules/ions_base.o
setup.o : ../../Modules/kind.o
setup.o : ../../Modules/mp_bands.o
+setup.o : ../../Modules/mp_images.o
setup.o : ../../Modules/mp_pools.o
setup.o : ../../Modules/noncol.o
setup.o : ../../Modules/parameters.o
@@ -1831,6 +1836,7 @@ setup.o : ../../Modules/qexsd.o
setup.o : ../../Modules/qexsd_copy.o
setup.o : ../../Modules/recvec.o
setup.o : ../../Modules/uspp.o
+setup.o : ../../UtilXlib/mp.o
setup.o : atomic_wfc_mod.o
setup.o : bp_mod.o
setup.o : extfield.o
@@ -2270,6 +2276,7 @@ wfcinit.o : ../../Modules/io_files.o
wfcinit.o : ../../Modules/io_global.o
wfcinit.o : ../../Modules/kind.o
wfcinit.o : ../../Modules/mp_bands.o
+wfcinit.o : ../../Modules/mp_images.o
wfcinit.o : ../../Modules/noncol.o
wfcinit.o : ../../Modules/qes_libs_module.o
wfcinit.o : ../../Modules/qes_types_module.o
diff --git a/PW/src/pw_restart_new.f90 b/PW/src/pw_restart_new.f90
index 505fcab51..6cd9426c0 100644
--- a/PW/src/pw_restart_new.f90
+++ b/PW/src/pw_restart_new.f90
@@ -37,7 +37,8 @@ MODULE pw_restart_new
!
CHARACTER(LEN=6), EXTERNAL :: int_to_char
PRIVATE
- PUBLIC :: pw_write_schema, pw_write_binaries, read_collected_to_evc
+ PUBLIC :: pw_write_schema, pw_write_binaries
+ PUBLIC :: read_this_wfc
!
CONTAINS
!------------------------------------------------------------------------
@@ -366,6 +367,10 @@ MODULE pw_restart_new
vdw_term_pt => dispersion_energy_term
vdw_corr_ = TRIM(vdw_corr)
vdw_corr_pt => vdw_corr_
+ NULLIFY (london_rcut_pt, london_s6_pt)
+ NULLIFY (xdm_a1_pt, xdm_a2_pt)
+ NULLIFY (dftd3_version_pt, dftd3_threebody_pt)
+ NULLIFY (ts_vdw_isolated_pt, ts_vdw_econv_thr_pt)
IF (llondon ) THEN
dispersion_energy_term = elondon/e2
lond_s6_ = scal6
@@ -685,7 +690,7 @@ MODULE pw_restart_new
USE buffers, ONLY : get_buffer
USE wavefunctions, ONLY : evc
- USE klist, ONLY : nks, nkstot, xk, ngk, igk_k, wk
+ USE klist, ONLY : nks, nkstot, xk, ngk, igk_k
USE gvect, ONLY : ngm, g, mill
USE fft_base, ONLY : dfftp
USE basis, ONLY : natomwfc
@@ -885,21 +890,18 @@ MODULE pw_restart_new
END SUBROUTINE gk_l2gmap_kdip
!
!------------------------------------------------------------------------
- SUBROUTINE read_collected_to_evc( dirname )
+ SUBROUTINE read_this_wfc ( dirname, ik, evc )
!------------------------------------------------------------------------
!
- ! ... This routines reads wavefunctions from the new file format and
- ! ... writes them into the old format
+ ! ... reads from directory "dirname" (new file format) for k-point "ik"
+ ! ... the wavefunctions into array "evc"
!
USE control_flags, ONLY : gamma_only
USE lsda_mod, ONLY : nspin, isk
- USE klist, ONLY : nkstot, wk, nks, xk, ngk, igk_k
- USE wvfct, ONLY : npwx, g2kin, et, wg, nbnd
- USE wavefunctions, ONLY : evc
- USE io_files, ONLY : nwordwfc, iunwfc
- USE buffers, ONLY : save_buffer
- USE gvect, ONLY : ig_l2g
USE noncollin_module, ONLY : noncolin, npol
+ USE klist, ONLY : nkstot, nks, xk, ngk, igk_k
+ USE wvfct, ONLY : npwx, g2kin, et, wg, nbnd
+ USE gvect, ONLY : ig_l2g
USE mp_bands, ONLY : root_bgrp, intra_bgrp_comm
USE mp_pools, ONLY : me_pool, root_pool, &
intra_pool_comm, inter_pool_comm
@@ -908,108 +910,101 @@ MODULE pw_restart_new
!
IMPLICIT NONE
!
- CHARACTER(LEN=*), INTENT(IN) :: dirname
+ CHARACTER(LEN=*), INTENT(IN) :: dirname
+ INTEGER, INTENT(IN) :: ik
+ COMPLEX(dp), INTENT(OUT) :: evc(:,:)
!
CHARACTER(LEN=2), DIMENSION(2) :: updw = (/ 'up', 'dw' /)
CHARACTER(LEN=320) :: filename, msg
- INTEGER :: i, ik, ik_g, ig, ipol, ik_s
+ INTEGER :: i, ik_g, ig, ipol, ik_s
INTEGER :: npol_, nbnd_
- INTEGER :: nupdwn(2), ike, iks, npw_g, ispin
+ INTEGER :: nupdwn(2), ike, iks, ngk_g, npw_g, ispin
INTEGER, EXTERNAL :: global_kpoint_index
- INTEGER, ALLOCATABLE :: ngk_g(:), mill_k(:,:)
+ INTEGER, ALLOCATABLE :: mill_k(:,:)
INTEGER, ALLOCATABLE :: igk_l2g(:), igk_l2g_kdip(:)
LOGICAL :: opnd, ionode_k
REAL(DP) :: scalef, xk_(3), b1(3), b2(3), b3(3)
-
- !
- iks = global_kpoint_index (nkstot, 1)
- ike = iks + nks - 1
- !
- ! ... ngk_g: global number of k+G vectors for all k points
- !
- ALLOCATE( ngk_g( nks ) )
- ngk_g(1:nks) = ngk(1:nks)
- CALL mp_sum( ngk_g, intra_bgrp_comm)
!
! ... the root processor of each pool reads
!
ionode_k = (me_pool == root_pool)
!
- ! ... The igk_l2g array yields the correspondence between the
- ! ... local k+G index and the global G index
+ iks = global_kpoint_index (nkstot, 1)
+ ike = iks + nks - 1
!
- ALLOCATE ( igk_l2g( npwx ) )
+ ! ik_g: index of k-point ik in the global list
+ !
+ ik_g = ik + iks - 1
!
! ... the igk_l2g_kdip local-to-global map is needed to read wfcs
!
ALLOCATE ( igk_l2g_kdip( npwx ) )
!
+ ! ... The igk_l2g array yields the correspondence between the
+ ! ... local k+G index and the global G index - requires arrays
+ ! ... igk_k (k+G indices) and ig_l2g (local to global G index map)
+ !
+ ALLOCATE ( igk_l2g( npwx ) )
+ igk_l2g = 0
+ DO ig = 1, ngk(ik)
+ igk_l2g(ig) = ig_l2g(igk_k(ig,ik))
+ END DO
+ !
+ ! ... npw_g: the maximum G vector index among all processors
+ ! ... ngk_g: global number of k+G vectors for all k points
+ !
+ npw_g = MAXVAL( igk_l2g(1:ngk(ik)) )
+ CALL mp_max( npw_g, intra_pool_comm )
+ ngk_g = ngk(ik)
+ CALL mp_sum( ngk_g, intra_bgrp_comm)
+ !
+ ! ... now compute the igk_l2g_kdip local-to-global map
+ !
+ igk_l2g_kdip = 0
+ CALL gk_l2gmap_kdip( npw_g, ngk_g, ngk(ik), igk_l2g, &
+ igk_l2g_kdip )
+ DEALLOCATE ( igk_l2g )
+ !
+ IF ( nspin == 2 ) THEN
+ !
+ ! ... LSDA: spin mapped to k-points, isk(ik) tracks up and down spin
+ !
+ ik_g = MOD ( ik_g-1, nkstot/2 ) + 1
+ ispin = isk(ik)
+ filename = TRIM(dirname) // 'wfc' // updw(ispin) // &
+ & TRIM(int_to_char(ik_g))
+ !
+ ELSE
+ !
+ filename = TRIM(dirname) // 'wfc' // TRIM(int_to_char(ik_g))
+ !
+ ENDIF
+ !
+ ! ... Miller indices are read from file (but not used)
+ !
ALLOCATE( mill_k ( 3,npwx ) )
!
- k_points_loop: DO ik = 1, nks
- !
- ! index of k-point ik in the global list
- !
- ik_g = ik + iks - 1
- !
- ! ... Compute the igk_l2g array from previously computed arrays
- ! ... igk_k (k+G indices) and ig_l2g (local to global G index map)
- !
- igk_l2g = 0
- DO ig = 1, ngk(ik)
- igk_l2g(ig) = ig_l2g(igk_k(ig,ik))
- END DO
- !
- ! ... npw_g: the maximum G vector index among all processors
- !
- npw_g = MAXVAL( igk_l2g(1:ngk(ik)) )
- CALL mp_max( npw_g, intra_pool_comm )
- !
- igk_l2g_kdip = 0
- CALL gk_l2gmap_kdip( npw_g, ngk_g(ik), ngk(ik), igk_l2g, &
- igk_l2g_kdip )
- !
- evc=(0.0_DP, 0.0_DP)
- !
- IF ( nspin == 2 ) THEN
- !
- ! ... LSDA: spin mapped to k-points, isk(ik) tracks up and down spin
- !
- ik_g = MOD ( ik_g-1, nkstot/2 ) + 1
- ispin = isk(ik)
- filename = TRIM(dirname) // 'wfc' // updw(ispin) // &
- & TRIM(int_to_char(ik_g))
- !
- ELSE
- !
- filename = TRIM(dirname) // 'wfc' // TRIM(int_to_char(ik_g))
- !
- ENDIF
- !
- CALL read_wfc( iunpun, filename, root_bgrp, intra_bgrp_comm, &
- ik_g, xk_, ispin, npol_, evc, npw_g, gamma_only, nbnd_, &
- igk_l2g_kdip(:), ngk(ik), b1, b2, b3, mill_k, scalef )
- !
- ! ... here one should check for consistency between what is read
- ! ... and what is expected
- !
- IF ( nbnd_ < nbnd ) THEN
- WRITE (msg,'("The number of bands for this run is",I6,", but only",&
- & I6," bands were read from file")') nbnd, nbnd_
- CALL errore ('pw_restart - read_collected_to_evc', msg, 1 )
- END IF
- CALL save_buffer ( evc, nwordwfc, iunwfc, ik )
- !
- END DO k_points_loop
+ evc=(0.0_DP, 0.0_DP)
+ !
+ CALL read_wfc( iunpun, filename, root_bgrp, intra_bgrp_comm, &
+ ik_g, xk_, ispin, npol_, evc, npw_g, gamma_only, nbnd_, &
+ igk_l2g_kdip(:), ngk(ik), b1, b2, b3, mill_k, scalef )
!
DEALLOCATE ( mill_k )
- DEALLOCATE ( igk_l2g )
DEALLOCATE ( igk_l2g_kdip )
- DEALLOCATE ( ngk_g )
+ !
+ ! ... here one should check for consistency between what is read
+ ! ... and what is expected
+ !
+ IF ( nbnd_ < nbnd ) THEN
+ WRITE (msg,'("The number of bands for this run is",I6,", but only",&
+ & I6," bands were read from file")') nbnd, nbnd_
+ CALL errore ('pw_restart - read_this_wfc', msg, 1 )
+ END IF
!
RETURN
!
- END SUBROUTINE read_collected_to_evc
+ END SUBROUTINE read_this_wfc
!
!------------------------------------------------------------------------
END MODULE pw_restart_new
diff --git a/PW/src/read_file_new.f90 b/PW/src/read_file_new.f90
index 5bb6a387e..5eca4244c 100644
--- a/PW/src/read_file_new.f90
+++ b/PW/src/read_file_new.f90
@@ -9,36 +9,79 @@
SUBROUTINE read_file()
!----------------------------------------------------------------------------
!
- ! Read data produced by pw.x or cp.x - new xml file and binary files
- ! Wrapper routine for backwards compatibility
+ ! Wrapper routine, for backwards compatibility
!
- USE io_global, ONLY : stdout
- USE io_files, ONLY : nwordwfc, iunwfc, wfc_dir, tmp_dir, restart_dir
- USE buffers, ONLY : open_buffer, close_buffer
- USE wvfct, ONLY : nbnd, npwx
- USE noncollin_module, ONLY : npol
- USE pw_restart_new, ONLY : read_collected_to_evc
- USE control_flags, ONLY : io_level
+ USE io_global, ONLY : stdout
+ USE control_flags, ONLY : io_level
+ USE buffers, ONLY : open_buffer, close_buffer, save_buffer
+ USE io_files, ONLY : nwordwfc, iunwfc, restart_dir
+ USE wvfct, ONLY : nbnd, npwx
+ USE noncollin_module, ONLY : npol
+ USE klist, ONLY : nks
+ USE wavefunctions, ONLY : evc
+ USE pw_restart_new, ONLY : read_this_wfc
+ !
+ IMPLICIT NONE
+ !
+ INTEGER :: ik
+ LOGICAL :: exst, wfc_is_collected
+ CHARACTER( LEN=256 ) :: dirname
+ !
+ dirname = restart_dir( )
+ WRITE( stdout, '(/,5x,A,/,5x,A)') &
+ 'Reading data from directory:', TRIM( dirname )
+ !
+ CALL read_file_new( wfc_is_collected )
+ !
+ ! ... Open unit iunwfc, for Kohn-Sham orbitals - we assume that wfcs
+ ! ... have been written to tmp_dir, not to a different directory!
+ ! ... io_level = 1 so that a real file is opened
+ !
+ nwordwfc = nbnd*npwx*npol
+ io_level = 1
+ CALL open_buffer ( iunwfc, 'wfc', nwordwfc, io_level, exst )
+ !
+ ! ... read wavefunctions in collected format, write them to file
+ !
+ IF ( wfc_is_collected ) THEN
+ !
+ DO ik = 1, nks
+ !
+ CALL read_this_wfc ( dirname, ik, evc )
+ CALL save_buffer ( evc, nwordwfc, iunwfc, ik )
+ !
+ END DO
+ !
+ END IF
+ !
+ CALL close_buffer ( iunwfc, 'KEEP' )
+ !
+END SUBROUTINE read_file
+!
+!----------------------------------------------------------------------------
+SUBROUTINE read_file_new ( wfc_is_collected )
+ !----------------------------------------------------------------------------
+ !
+ ! Read xml data file produced by pw.x or cp.x, performs some initialization
+ ! DOes not read wfcs but returns in "wfc_is_collected" info on the wfc file
+ !
+ USE io_files, ONLY : nwordwfc, iunwfc, wfc_dir, tmp_dir
USE gvect, ONLY : ngm, g
USE gvecw, ONLY : gcutw
USE klist, ONLY : nkstot, nks, xk, wk
USE lsda_mod, ONLY : isk
USE wvfct, ONLY : nbnd, et, wg
!
- IMPLICIT NONE
- INTEGER :: ierr
- LOGICAL :: exst, wfc_is_collected
- CHARACTER( LEN=256 ) :: dirname
+ IMPLICIT NONE
!
+ LOGICAL, INTENT(OUT) :: wfc_is_collected
+ !
+ INTEGER :: ierr
!
ierr = 0
!
! ... Read the contents of the xml data file
!
- dirname = restart_dir( )
- WRITE( stdout, '(/,5x,A,/,5x,A)') &
- 'Reading data from directory:', TRIM( dirname )
- !
CALL read_xml_file ( wfc_is_collected )
!
! ... more initializations: pseudopotentials / G-vectors / FFT arrays /
@@ -48,6 +91,8 @@ SUBROUTINE read_file()
!
! ... initialization of KS orbitals
!
+ wfc_dir = tmp_dir ! this is likely obsolete and no longer used
+ !
! ... distribute across pools k-points and related variables.
! ... nks is defined by the following routine as the number
! ... of k-points in the current pool
@@ -61,23 +106,7 @@ SUBROUTINE read_file()
!
CALL allocate_wfc_k()
!
- ! ... Open unit iunwfc, for Kohn-Sham orbitals - we assume that wfcs
- ! ... have been written to tmp_dir, not to a different directory!
- ! ... io_level = 1 so that a real file is opened
- !
- wfc_dir = tmp_dir
- nwordwfc = nbnd*npwx*npol
- io_level = 1
- CALL open_buffer ( iunwfc, 'wfc', nwordwfc, io_level, exst )
- !
- ! ... read wavefunctions in collected format, writes them to file
- ! ... FIXME: likely not a great idea
- !
- IF ( wfc_is_collected ) CALL read_collected_to_evc(dirname)
- !
- CALL close_buffer ( iunwfc, 'KEEP' )
- !
-END SUBROUTINE read_file
+END SUBROUTINE read_file_new
!
!----------------------------------------------------------------------------
SUBROUTINE read_xml_file ( wfc_is_collected )
diff --git a/PW/src/wfcinit.f90 b/PW/src/wfcinit.f90
index 63640a7fe..66bcc4b1d 100644
--- a/PW/src/wfcinit.f90
+++ b/PW/src/wfcinit.f90
@@ -26,10 +26,10 @@ SUBROUTINE wfcinit()
diropn, xmlfile, restart_dir
USE buffers, ONLY : open_buffer, get_buffer, save_buffer
USE uspp, ONLY : nkb, vkb
- USE wavefunctions, ONLY : evc
+ USE wavefunctions, ONLY : evc
USE wvfct, ONLY : nbnd, npwx, current_k
USE wannier_new, ONLY : use_wannier
- USE pw_restart_new, ONLY : read_collected_to_evc
+ USE pw_restart_new, ONLY : read_this_wfc
USE mp, ONLY : mp_bcast
USE mp_images, ONLY : intra_image_comm
USE qexsd_module, ONLY : qexsd_readschema
@@ -61,13 +61,22 @@ SUBROUTINE wfcinit()
IF (ionode) CALL qexsd_readschema ( xmlfile(), ierr, output_obj )
CALL mp_bcast(ierr, ionode_id, intra_image_comm)
IF ( ierr <= 0 ) THEN
+ !
IF (ionode) twfcollect_file = output_obj%band_structure%wf_collected
CALL mp_bcast(twfcollect_file, ionode_id, intra_image_comm)
+ !
IF ( twfcollect_file ) THEN
- CALL read_collected_to_evc(dirname )
+ !
+ DO ik = 1, nks
+ CALL read_this_wfc ( dirname, ik, evc )
+ CALL save_buffer ( evc, nwordwfc, iunwfc, ik )
+ END DO
+ !
ELSE IF ( .NOT. exst_file) THEN
+ ! !
WRITE( stdout, '(5X,"Cannot read wfcs: file not found")' )
starting_wfc = 'atomic+random'
+ !
ELSE
!
! ... wavefunctions are read from file (or buffer) not here but
From 01d62a61ab38cefda6a293fa2f16bb3690af84c7 Mon Sep 17 00:00:00 2001
From: Paolo Giannozzi
Date: Sat, 2 Nov 2019 10:54:26 +0100
Subject: [PATCH 2/3] Script computing dependencies updated to deal with libxc
module
---
install/makedeps.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/install/makedeps.sh b/install/makedeps.sh
index ef55f2d31..4c9c19781 100755
--- a/install/makedeps.sh
+++ b/install/makedeps.sh
@@ -104,11 +104,12 @@ for dir in $dirs; do
$TOPDIR/moduledep.sh $DEPENDS > make.depend
$TOPDIR/includedep.sh $DEPENDS >> make.depend
- # handle special cases: modules for C-fortran binding, hdf5, MPI
+ # handle special cases: modules for C-fortran binding,
+ # hdf5, MPI, FoX, libxc
sed '/@iso_c_binding@/d' make.depend > make.depend.tmp
sed '/@hdf5@/d;/@mpi@/d' make.depend.tmp > make.depend
sed '/@fox_dom@/d;/@fox_wxml@/d' make.depend > make.depend.tmp
- sed '/@m_common_io@/d' make.depend.tmp > make.depend
+ sed '/@m_common_io@/d;/@xc_f03_lib_m@/d' make.depend.tmp > make.depend
if test "$DIR" = "FFTXlib"
then
From 117d18e2409b015d62de1c399a53ed365d927322 Mon Sep 17 00:00:00 2001
From: Paolo Giannozzi
Date: Sat, 2 Nov 2019 11:10:02 +0100
Subject: [PATCH 3/3] More removal of unneeded I/O in postprocessing:
wavefunctions are read directly from the final collected format into
distributed array "evc". Everything should work as before, including
unmodified postprocessing, but no warranty.
---
PP/src/add_shift_us.f90 | 17 +++++++----------
PP/src/elf.f90 | 5 +++--
PP/src/epsilon.f90 | 13 ++++++-------
PP/src/initial_state.f90 | 13 +++----------
PP/src/local_dos.f90 | 5 +++--
PP/src/local_dos_mag.f90 | 5 +++--
PP/src/make.depend | 10 ++++++++++
PP/src/plan_avg.f90 | 15 ++++++++-------
PP/src/poormanwannier.f90 | 13 +++++--------
PP/src/postproc.f90 | 4 ++--
PP/src/ppacf.f90 | 4 ++--
PP/src/projwfc.f90 | 12 ++++++------
PP/src/projwfc_box.f90 | 5 +++--
PP/src/stm.f90 | 5 +++--
PP/src/wannier_ham.f90 | 5 ++---
PP/src/wannier_plot.f90 | 4 ++--
PP/src/wfck2r.f90 | 10 ++++++----
PW/src/pw_restart_new.f90 | 10 +++++-----
PW/src/read_file_new.f90 | 4 ++--
PW/src/wannier_proj.f90 | 13 +++++++------
PW/src/wfcinit.f90 | 4 ++--
21 files changed, 90 insertions(+), 86 deletions(-)
diff --git a/PP/src/add_shift_us.f90 b/PP/src/add_shift_us.f90
index 72e69f5c1..ad9c4e41b 100644
--- a/PP/src/add_shift_us.f90
+++ b/PP/src/add_shift_us.f90
@@ -24,9 +24,10 @@ SUBROUTINE add_shift_us( shift_nl )
USE wvfct, ONLY : nbnd, wg, et
USE lsda_mod, ONLY : lsda, isk
USE symme, ONLY : symscalar
- USE wavefunctions, ONLY : evc
- USE io_files, ONLY : iunwfc, nwordwfc
+ USE wavefunctions, ONLY : evc
+ USE io_files, ONLY : restart_dir
USE becmod, ONLY : calbec
+ USE pw_restart_new, ONLY : read_collected_wfc
!
IMPLICIT NONE
!
@@ -79,10 +80,8 @@ SUBROUTINE add_shift_us( shift_nl )
!
is = isk(ik)
npw = ngk(ik)
- IF ( nks > 1 ) THEN
- CALL davcio( evc, 2*nwordwfc, iunwfc, ik, -1 )
- IF ( nkb > 0 ) CALL init_us_2( npw, igk_k(1,ik), xk(1,ik), vkb )
- ENDIF
+ CALL read_collected_wfc ( restart_dir(), ik, evc )
+ IF ( nkb > 0 ) CALL init_us_2( npw, igk_k(1,ik), xk(1,ik), vkb )
!
CALL calbec ( npw, vkb, evc, rbecp )
!
@@ -169,10 +168,8 @@ SUBROUTINE add_shift_us( shift_nl )
!
is = isk(ik)
npw = ngk(ik)
- IF ( nks > 1 ) THEN
- CALL davcio( evc, 2*nwordwfc, iunwfc, ik, -1 )
- IF ( nkb > 0 ) CALL init_us_2( npw, igk_k(1,ik), xk(1,ik), vkb )
- ENDIF
+ CALL read_collected_wfc( restart_dir(), ik, evc )
+ IF ( nkb > 0 ) CALL init_us_2( npw, igk_k(1,ik), xk(1,ik), vkb )
!
CALL calbec( npw, vkb, evc, becp )
!
diff --git a/PP/src/elf.f90 b/PP/src/elf.f90
index de05f4475..3f3897079 100644
--- a/PP/src/elf.f90
+++ b/PP/src/elf.f90
@@ -30,7 +30,7 @@ SUBROUTINE do_elf (elf)
USE fft_interfaces, ONLY : fwfft, invfft, fft_interpolate
USE gvect, ONLY: gcutm, g, ngm
USE gvecs, ONLY : ngms, doublegrid, dual
- USE io_files, ONLY: iunwfc, nwordwfc
+ USE io_files, ONLY: restart_dir
USE klist, ONLY: nks, xk, ngk, igk_k
USE lsda_mod, ONLY: nspin
USE scf, ONLY: rho
@@ -40,6 +40,7 @@ SUBROUTINE do_elf (elf)
USE wavefunctions, ONLY: evc
USE mp_pools, ONLY: inter_pool_comm, intra_pool_comm
USE mp, ONLY: mp_sum
+ USE pw_restart_new, ONLY : read_collected_wfc
!
! I/O variables
!
@@ -66,7 +67,7 @@ SUBROUTINE do_elf (elf)
!
! reads the eigenfunctions
!
- CALL davcio (evc, 2*nwordwfc, iunwfc, ik, - 1)
+ CALL read_collected_wfc ( restart_dir(), ik, evc )
!
DO ibnd = 1, nbnd
DO j = 1, 3
diff --git a/PP/src/epsilon.f90 b/PP/src/epsilon.f90
index 12b8edcb1..b8b3359d3 100644
--- a/PP/src/epsilon.f90
+++ b/PP/src/epsilon.f90
@@ -168,7 +168,7 @@ PROGRAM epsilon
INTEGER :: nw,nbndmin,nbndmax
REAL(DP) :: intersmear,intrasmear,wmax,wmin,shift
CHARACTER(10) :: calculation,smeartype
- LOGICAL :: metalcalc
+ LOGICAL :: metalcalc, wfc_is_collected
!
NAMELIST / inputpp / prefix, outdir, calculation
NAMELIST / energy_grid / smeartype, intersmear, intrasmear, nw, wmax, wmin, &
@@ -255,9 +255,7 @@ PROGRAM epsilon
!
IF (ionode) WRITE( stdout, "( 5x, 'Reading PW restart file...' ) " )
- CALL read_file
- CALL openfil_pp
-
+ CALL read_file_new( wfc_is_collected )
!
! few conversions
!
@@ -1064,10 +1062,11 @@ SUBROUTINE dipole_calc( ik, dipole_aux, metalcalc, nbndmin, nbndmax )
!
USE kinds, ONLY : DP
USE wvfct, ONLY : nbnd, npwx
- USE wavefunctions, ONLY : evc
+ USE wavefunctions, ONLY : evc
USE klist, ONLY : xk, ngk, igk_k
USE gvect, ONLY : ngm, g
- USE io_files, ONLY : nwordwfc, iunwfc
+ USE io_files, ONLY : restart_dir
+ USE pw_restart_new, ONLY : read_collected_wfc
USE grid_module, ONLY : focc, full_occ
USE mp_bands, ONLY : intra_bgrp_comm
USE mp, ONLY : mp_sum
@@ -1091,7 +1090,7 @@ SUBROUTINE dipole_calc( ik, dipole_aux, metalcalc, nbndmin, nbndmax )
!
! read wfc for the given kpt
!
- CALL davcio (evc, 2*nwordwfc, iunwfc, ik, - 1)
+ CALL read_collected_wfc ( restart_dir(), ik, evc )
!
! compute matrix elements
!
diff --git a/PP/src/initial_state.f90 b/PP/src/initial_state.f90
index 45e67d5e8..0d79b8310 100644
--- a/PP/src/initial_state.f90
+++ b/PP/src/initial_state.f90
@@ -34,13 +34,12 @@ PROGRAM initial_state
!
CHARACTER(len=256) :: outdir
INTEGER :: ios, ik, excite(ntypx)
+ LOGICAL :: dummy
NAMELIST / inputpp / outdir, prefix, excite
!
! initialise environment
!
-#if defined(__MPI)
CALL mp_startup ( )
-#endif
CALL environment_start ( 'initstate' )
!
! set default values for variables in namelist
@@ -75,14 +74,8 @@ PROGRAM initial_state
!
! Now allocate space for pwscf variables, read and check them.
!
- CALL read_file
- CALL openfil_pp
- IF ( nks == 1 ) THEN
- ik = 1
- CALL davcio( evc, 2*nwordwfc, iunwfc, ik, -1 )
- IF ( nkb > 0 ) CALL init_us_2( ngk(ik), igk_k(1,ik), xk(1,ik), vkb )
- ENDIF
-
+ CALL read_file_new( dummy )
+ !
CALL do_initial_state (excite)
!
CALL environment_end ( 'initstate' )
diff --git a/PP/src/local_dos.f90 b/PP/src/local_dos.f90
index 9d62bd3d6..6def2a5f9 100644
--- a/PP/src/local_dos.f90
+++ b/PP/src/local_dos.f90
@@ -43,7 +43,8 @@ SUBROUTINE local_dos (iflag, lsign, kpoint, kband, spin_component, &
USE control_flags, ONLY : gamma_only
USE noncollin_module, ONLY : noncolin, npol
USE spin_orb, ONLY : lspinorb, fcoef
- USE io_files, ONLY : iunwfc, nwordwfc
+ USE io_files, ONLY : restart_dir
+ USE pw_restart_new, ONLY : read_collected_wfc
USE mp_pools, ONLY : me_pool, nproc_pool, my_pool_id, npool, &
inter_pool_comm, intra_pool_comm
USE mp, ONLY : mp_bcast, mp_sum
@@ -150,7 +151,7 @@ SUBROUTINE local_dos (iflag, lsign, kpoint, kband, spin_component, &
DO ik = 1, nks
IF ( iflag /= 0 .or. ik == kpoint_pool) THEN
IF (lsda) current_spin = isk (ik)
- CALL davcio (evc, 2*nwordwfc, iunwfc, ik, - 1)
+ CALL read_collected_wfc ( restart_dir(), ik, evc )
npw = ngk(ik)
CALL init_us_2 (npw, igk_k(1,ik), xk (1, ik), vkb)
diff --git a/PP/src/local_dos_mag.f90 b/PP/src/local_dos_mag.f90
index 28551aa62..aa465158a 100644
--- a/PP/src/local_dos_mag.f90
+++ b/PP/src/local_dos_mag.f90
@@ -23,7 +23,7 @@ SUBROUTINE local_dos_mag(spin_component, kpoint, kband, raux)
USE gvecs, ONLY : doublegrid
USE klist, ONLY : nks, xk, ngk, igk_k, nkstot
USE scf, ONLY : rho
- USE io_files, ONLY : iunwfc, nwordwfc
+ USE io_files, ONLY : restart_dir
USE uspp, ONLY : nkb, vkb, becsum, nhtol, nhtoj, indv, okvan
USE uspp_param, ONLY : upf, nh, nhm
USE wavefunctions, ONLY : evc, psic_nc
@@ -33,6 +33,7 @@ SUBROUTINE local_dos_mag(spin_component, kpoint, kband, raux)
USE becmod, ONLY : calbec
USE mp_pools, ONLY : my_pool_id, npool, inter_pool_comm
USE mp, ONLY : mp_sum
+ USE pw_restart_new, ONLY : read_collected_wfc
!
IMPLICIT NONE
!
@@ -79,7 +80,7 @@ SUBROUTINE local_dos_mag(spin_component, kpoint, kband, raux)
IF ( ik > 0 ) THEN
!
npw = ngk(ik)
- CALL davcio (evc, 2*nwordwfc, iunwfc, ik, - 1)
+ CALL read_collected_wfc ( restart_dir(), ik, evc )
IF (nkb > 0) CALL init_us_2 (npw, igk_k(1,ik), xk (1, ik), vkb)
CALL calbec ( npw, vkb, evc, becp_nc)
!
diff --git a/PP/src/make.depend b/PP/src/make.depend
index f36b34402..16f803a1f 100644
--- a/PP/src/make.depend
+++ b/PP/src/make.depend
@@ -29,6 +29,7 @@ add_shift_us.o : ../../Modules/mp_pools.o
add_shift_us.o : ../../Modules/recvec.o
add_shift_us.o : ../../Modules/uspp.o
add_shift_us.o : ../../Modules/wavefunctions.o
+add_shift_us.o : ../../PW/src/pw_restart_new.o
add_shift_us.o : ../../PW/src/pwcom.o
add_shift_us.o : ../../PW/src/symme.o
add_shift_us.o : ../../UtilXlib/mp.o
@@ -201,6 +202,7 @@ elf.o : ../../Modules/kind.o
elf.o : ../../Modules/mp_pools.o
elf.o : ../../Modules/recvec.o
elf.o : ../../Modules/wavefunctions.o
+elf.o : ../../PW/src/pw_restart_new.o
elf.o : ../../PW/src/pwcom.o
elf.o : ../../PW/src/scf_mod.o
elf.o : ../../PW/src/symme.o
@@ -218,6 +220,7 @@ epsilon.o : ../../Modules/mp_pools.o
epsilon.o : ../../Modules/recvec.o
epsilon.o : ../../Modules/uspp.o
epsilon.o : ../../Modules/wavefunctions.o
+epsilon.o : ../../PW/src/pw_restart_new.o
epsilon.o : ../../PW/src/pwcom.o
epsilon.o : ../../UtilXlib/mp.o
fermi_proj.o : ../../Modules/environment.o
@@ -292,6 +295,7 @@ local_dos.o : ../../Modules/noncol.o
local_dos.o : ../../Modules/recvec.o
local_dos.o : ../../Modules/uspp.o
local_dos.o : ../../Modules/wavefunctions.o
+local_dos.o : ../../PW/src/pw_restart_new.o
local_dos.o : ../../PW/src/pwcom.o
local_dos.o : ../../PW/src/scf_mod.o
local_dos.o : ../../PW/src/symme.o
@@ -319,6 +323,7 @@ local_dos_mag.o : ../../Modules/noncol.o
local_dos_mag.o : ../../Modules/recvec.o
local_dos_mag.o : ../../Modules/uspp.o
local_dos_mag.o : ../../Modules/wavefunctions.o
+local_dos_mag.o : ../../PW/src/pw_restart_new.o
local_dos_mag.o : ../../PW/src/pwcom.o
local_dos_mag.o : ../../PW/src/scf_mod.o
local_dos_mag.o : ../../UtilXlib/mp.o
@@ -422,6 +427,7 @@ plan_avg.o : ../../Modules/recvec.o
plan_avg.o : ../../Modules/run_info.o
plan_avg.o : ../../Modules/uspp.o
plan_avg.o : ../../Modules/wavefunctions.o
+plan_avg.o : ../../PW/src/pw_restart_new.o
plan_avg.o : ../../PW/src/pwcom.o
plan_avg.o : ../../UtilXlib/mp.o
plotband.o : ../../Modules/kind.o
@@ -443,6 +449,7 @@ poormanwannier.o : ../../Modules/uspp.o
poormanwannier.o : ../../Modules/wavefunctions.o
poormanwannier.o : ../../PW/src/atomic_wfc_mod.o
poormanwannier.o : ../../PW/src/ldaU.o
+poormanwannier.o : ../../PW/src/pw_restart_new.o
poormanwannier.o : ../../PW/src/pwcom.o
poormanwannier.o : ../../PW/src/symm_base.o
poormanwannier.o : ../../UtilXlib/mp.o
@@ -550,6 +557,7 @@ projwfc_box.o : ../../Modules/run_info.o
projwfc_box.o : ../../Modules/uspp.o
projwfc_box.o : ../../Modules/wavefunctions.o
projwfc_box.o : ../../PW/src/atomic_wfc_mod.o
+projwfc_box.o : ../../PW/src/pw_restart_new.o
projwfc_box.o : ../../PW/src/pwcom.o
projwfc_box.o : ../../PW/src/scf_mod.o
projwfc_box.o : ../../UtilXlib/mp.o
@@ -702,6 +710,7 @@ stm.o : ../../Modules/kind.o
stm.o : ../../Modules/mp_pools.o
stm.o : ../../Modules/recvec.o
stm.o : ../../Modules/wavefunctions.o
+stm.o : ../../PW/src/pw_restart_new.o
stm.o : ../../PW/src/pwcom.o
stm.o : ../../PW/src/scf_mod.o
stm.o : ../../PW/src/symme.o
@@ -843,6 +852,7 @@ wfck2r.o : ../../Modules/mp_pools.o
wfck2r.o : ../../Modules/noncol.o
wfck2r.o : ../../Modules/recvec.o
wfck2r.o : ../../Modules/wavefunctions.o
+wfck2r.o : ../../PW/src/pw_restart_new.o
wfck2r.o : ../../PW/src/pwcom.o
wfck2r.o : ../../UtilXlib/mp.o
work_function.o : ../../FFTXlib/scatter_mod.o
diff --git a/PP/src/plan_avg.f90 b/PP/src/plan_avg.f90
index a4bf5293e..c06462179 100644
--- a/PP/src/plan_avg.f90
+++ b/PP/src/plan_avg.f90
@@ -37,7 +37,7 @@ PROGRAM plan_avg
INTEGER :: ninter
CHARACTER(len=256) :: filplot, outdir
REAL(DP), ALLOCATABLE :: averag (:,:,:), plan (:,:,:)
- !
+ LOGICAL :: wfc_is_collected
INTEGER :: iunplot = 4, ios, ibnd, ik, ir, nt, na, i
!
NAMELIST / inputpp / outdir, prefix, filplot
@@ -81,13 +81,13 @@ PROGRAM plan_avg
!
! Now allocate space for pwscf variables, read and check them.
!
- CALL read_file ( )
+ CALL read_file_new ( wfc_is_collected )
+ IF ( .NOT. wfc_is_collected ) CALL errore ('plan_avg', &
+ ' wavefunctiosn not available?!?',1)
!
IF (gamma_only) CALL errore ('plan_avg', &
' planar average with gamma tricks not yet implemented',2)
!
- CALL openfil_pp ( )
- !
ALLOCATE (averag( nat, nbnd, nkstot))
ALLOCATE (plan(dfftp%nr3, nbnd, nkstot))
!
@@ -163,9 +163,10 @@ SUBROUTINE do_plan_avg (averag, plan, ninter)
USE wvfct, ONLY: npwx, nbnd, wg
USE wavefunctions, ONLY: evc
USE noncollin_module, ONLY : noncolin, npol
- USE io_files, ONLY: iunwfc, nwordwfc
+ USE io_files, ONLY: restart_dir
USE becmod, ONLY: bec_type, becp, calbec, allocate_bec_type, deallocate_bec_type
-
+ USE pw_restart_new, ONLY: read_collected_wfc
+ !
IMPLICIT NONE
INTEGER :: ninter
! output: the number of planes
@@ -256,7 +257,7 @@ SUBROUTINE do_plan_avg (averag, plan, ninter)
DO ik = 1, nks
IF (lsda) current_spin = isk (ik)
npw = ngk(ik)
- CALL davcio (evc, 2*nwordwfc, iunwfc, ik, - 1)
+ CALL read_collected_wfc ( restart_dir(), ik, evc )
CALL init_us_2 (npw, igk_k(1,ik), xk (1, ik), vkb)
CALL calbec ( npw, vkb, evc, becp)
diff --git a/PP/src/poormanwannier.f90 b/PP/src/poormanwannier.f90
index c60e3f556..8686d7f07 100644
--- a/PP/src/poormanwannier.f90
+++ b/PP/src/poormanwannier.f90
@@ -37,16 +37,14 @@ PROGRAM pmw
INTEGER :: ios
INTEGER :: first_band, last_band
REAL(DP) :: min_energy, max_energy, sigma
- LOGICAL :: writepp
+ LOGICAL :: writepp, wfc_is_collected
NAMELIST / inputpp / outdir, prefix, first_band, last_band, writepp, &
min_energy, max_energy, sigma
!
! initialise environment
!
-#if defined(__MPI)
CALL mp_startup ( )
-#endif
CALL environment_start ( 'PMW' )
IF ( ionode ) CALL input_from_file ( )
!
@@ -88,7 +86,7 @@ PROGRAM pmw
!
! Now allocate space for pwscf variables, read and check them.
!
- CALL read_file ( )
+ CALL read_file_new ( wfc_is_collected )
!
! Check on correctness and consistency of the input
!
@@ -105,8 +103,6 @@ PROGRAM pmw
! Currently, WF projectors are built for Hubbard species only
IF ( .NOT.lda_plus_U ) CALL errore('pmw','Hubbard U calculation required', 1)
!
- CALL openfil_pp ( )
- !
CALL projection( first_band, last_band, min_energy, max_energy, sigma, writepp)
!
CALL environment_end ( 'PMW' )
@@ -135,9 +131,10 @@ SUBROUTINE projection (first_band, last_band, min_energy, max_energy, sigma, iop
USE control_flags, ONLY: gamma_only
USE uspp, ONLY: nkb, vkb
USE becmod, ONLY: bec_type, becp, calbec, allocate_bec_type, deallocate_bec_type
- USE io_files, ONLY: nd_nmbr, prefix, tmp_dir, nwordwfc, iunwfc, &
+ USE io_files, ONLY: prefix, restart_dir, &
iunhub, nwordwfcU, nwordatwfc, diropn
USE wavefunctions, ONLY: evc
+ USE pw_restart_new,ONLY: read_collected_wfc
IMPLICIT NONE
!
@@ -247,7 +244,7 @@ SUBROUTINE projection (first_band, last_band, min_energy, max_energy, sigma, iop
!
npw = ngk(ik)
- CALL davcio (evc, 2*nwordwfc, iunwfc, ik, - 1)
+ CALL read_collected_wfc ( restart_dir(), ik, evc )
CALL atomic_wfc (ik, wfcatom)
diff --git a/PP/src/postproc.f90 b/PP/src/postproc.f90
index dde691de8..2e57b8160 100644
--- a/PP/src/postproc.f90
+++ b/PP/src/postproc.f90
@@ -145,8 +145,8 @@ SUBROUTINE extract (plot_files,plot_num)
needwf=(plot_num==3).or.(plot_num==4).or.(plot_num==5).or.(plot_num==7).or. &
(plot_num==8).or.(plot_num==10)
IF ( needwf ) THEN
- CALL read_file ( )
- CALL openfil_pp ( )
+ CALL read_file_new ( dummy )
+ IF (.not.dummy) CALL errore('postproc','Wavefunctions not available?!?',1)
ELSE
CALL read_xml_file ( dummy )
CALL post_xml_init ( )
diff --git a/PP/src/ppacf.f90 b/PP/src/ppacf.f90
index 7981a6c52..09d8732b0 100644
--- a/PP/src/ppacf.f90
+++ b/PP/src/ppacf.f90
@@ -79,6 +79,7 @@ PROGRAM do_ppacf
! counter on nspin
INTEGER :: iexch, icorr, igcx, igcc, inlc
INTEGER :: ierr, ios
+ LOGICAL :: dummy
REAL(DP) :: cc, dcc, ccp, ccm, ccp2, ccm2, ccp3, ccm3, ccp4, ccm4, ccp8, ccm8, cc3
! coupling constant
! local exchange energy, local correlation energy
@@ -222,8 +223,7 @@ PROGRAM do_ppacf
IF (code_num == 1) THEN
!
tmp_dir = TRIM(outdir)
- ! CALL read_xml_file_internal(.TRUE.)
- CALL read_file()
+ CALL read_file_new (dummy)
!
! Check exchange correlation functional
iexch = get_iexch()
diff --git a/PP/src/projwfc.f90 b/PP/src/projwfc.f90
index 0559177e0..fefeca552 100644
--- a/PP/src/projwfc.f90
+++ b/PP/src/projwfc.f90
@@ -915,7 +915,7 @@ SUBROUTINE projwave_nc(filproj, lsym, lwrite_ovp, lbinary, ef_0 )
USE uspp_param, ONLY: upf
USE becmod, ONLY: bec_type, becp, calbec, allocate_bec_type, deallocate_bec_type
USE io_files, ONLY : restart_dir
- USE pw_restart_new,ONLY : read_this_wfc
+ USE pw_restart_new,ONLY : read_collected_wfc
USE wavefunctions, ONLY: evc
USE mp, ONLY : mp_sum
USE mp_pools, ONLY : inter_pool_comm, intra_pool_comm
@@ -1001,7 +1001,7 @@ SUBROUTINE projwave_nc(filproj, lsym, lwrite_ovp, lbinary, ef_0 )
swfcatom= (0.d0,0.d0)
npw = ngk(ik)
- CALL read_this_wfc ( restart_dir() , ik, evc )
+ CALL read_collected_wfc ( restart_dir(), ik, evc )
!---- AlexS
! To project on real harmonics, not on spinors.
@@ -1212,7 +1212,7 @@ SUBROUTINE projwave_paw( filproj)
USE uspp_param, ONLY : upf
USE becmod, ONLY: bec_type, becp, calbec, allocate_bec_type, deallocate_bec_type
USE io_files, ONLY : restart_dir
- USE pw_restart_new,ONLY : read_this_wfc
+ USE pw_restart_new,ONLY : read_collected_wfc
USE wavefunctions, ONLY: evc
!
USE projections
@@ -1276,7 +1276,7 @@ SUBROUTINE projwave_paw( filproj)
! loop on k points
!
DO ik = 1, nks
- CALL read_this_wfc ( restart_dir() , ik, evc )
+ CALL read_collected_wfc ( restart_dir() , ik, evc )
npw = ngk(ik)
CALL init_us_2 (npw, igk_k(1,ik), xk (1, ik), vkb)
@@ -1586,7 +1586,7 @@ SUBROUTINE projwave( filproj, lsym, lwrite_ovp, lbinary )
USE becmod, ONLY : bec_type, becp, calbec, allocate_bec_type, deallocate_bec_type
USE io_files, ONLY : prefix, restart_dir, tmp_dir
USE control_flags, ONLY : gamma_only
- USE pw_restart_new,ONLY : read_this_wfc
+ USE pw_restart_new,ONLY : read_collected_wfc
USE wavefunctions, ONLY : evc
!
USE projections
@@ -1690,7 +1690,7 @@ SUBROUTINE projwave( filproj, lsym, lwrite_ovp, lbinary )
DO ik = 1, nks
!
npw = ngk(ik)
- CALL read_this_wfc ( restart_dir() , ik, evc )
+ CALL read_collected_wfc ( restart_dir() , ik, evc )
CALL atomic_wfc (ik, wfcatom)
diff --git a/PP/src/projwfc_box.f90 b/PP/src/projwfc_box.f90
index 4d14ca3c8..844561842 100644
--- a/PP/src/projwfc_box.f90
+++ b/PP/src/projwfc_box.f90
@@ -34,7 +34,7 @@ SUBROUTINE projwave_boxes( filpdos, filproj, n_proj_boxes, irmin, irmax, plotbox
USE uspp, ONLY: okvan
USE noncollin_module, ONLY: noncolin, npol
USE wavefunctions, ONLY: evc, psic, psic_nc
- USE io_files, ONLY : iunwfc, nwordwfc
+ USE io_files, ONLY : restart_dir
USE scf, ONLY : rho
USE projections_ldos, ONLY : proj
USE fft_base, ONLY : dfftp
@@ -42,6 +42,7 @@ SUBROUTINE projwave_boxes( filpdos, filproj, n_proj_boxes, irmin, irmax, plotbox
USE fft_interfaces, ONLY : invfft
USE mp_pools, ONLY : intra_pool_comm
USE mp, ONLY : mp_sum
+ USE pw_restart_new, ONLY : read_collected_wfc
!
!
IMPLICIT NONE
@@ -222,7 +223,7 @@ SUBROUTINE projwave_boxes( filpdos, filproj, n_proj_boxes, irmin, irmax, plotbox
!
IF ( lsda ) current_spin = isk(ik)
npw = ngk(ik)
- CALL davcio (evc, 2*nwordwfc, iunwfc, ik, - 1)
+ CALL read_collected_wfc ( restart_dir(), ik, evc )
!
bnd_loop: DO ibnd = 1, nbnd
!
diff --git a/PP/src/stm.f90 b/PP/src/stm.f90
index acbcc4a52..b8dcf271f 100644
--- a/PP/src/stm.f90
+++ b/PP/src/stm.f90
@@ -33,10 +33,11 @@ SUBROUTINE stm (sample_bias, stmdos, istates)
USE wvfct, ONLY: npwx, nbnd, wg, et
USE control_flags, ONLY : gamma_only
USE wavefunctions, ONLY : evc, psic
- USE io_files, ONLY: iunwfc, nwordwfc
+ USE io_files, ONLY: restart_dir
USE constants, ONLY : degspin
USE mp, ONLY : mp_max, mp_min, mp_sum
USE mp_pools, ONLY : inter_pool_comm
+ USE pw_restart_new,ONLY : read_collected_wfc
!
IMPLICIT NONE
!
@@ -149,7 +150,7 @@ SUBROUTINE stm (sample_bias, stmdos, istates)
istates = istates + (last_band - first_band + 1)
npw = ngk(ik)
- CALL davcio (evc, 2*nwordwfc, iunwfc, ik, - 1)
+ CALL read_collected_wfc ( restart_dir(), ik, evc )
!
IF (gamma_only) THEN
!
diff --git a/PP/src/wannier_ham.f90 b/PP/src/wannier_ham.f90
index d8c09f459..05efd6d0b 100644
--- a/PP/src/wannier_ham.f90
+++ b/PP/src/wannier_ham.f90
@@ -29,7 +29,7 @@ PROGRAM wannier_ham
!
CHARACTER(len=256) :: outdir, form
INTEGER :: ios
- LOGICAL :: plot_bands
+ LOGICAL :: plot_bands, dummy
NAMELIST /inputpp/ outdir, prefix, nwan, plot_bands, use_energy_int, form
! initialise environment
@@ -64,8 +64,7 @@ PROGRAM wannier_ham
!
CALL mp_bcast( ios, ionode_id, world_comm )
IF ( ios /= 0 ) CALL errore('wannier_ham','reading inputpp namelist',abs(ios))
- CALL read_file
- CALL openfil_pp
+ CALL read_file_new ( dummy )
CALL wannier_init(.false.)
diff --git a/PP/src/wannier_plot.f90 b/PP/src/wannier_plot.f90
index 091646bd5..b62ed83b3 100644
--- a/PP/src/wannier_plot.f90
+++ b/PP/src/wannier_plot.f90
@@ -30,6 +30,7 @@ PROGRAM wannier_plot
!
CHARACTER(len=256) :: outdir
INTEGER :: ios,nc(3),n0(3)
+ LOGICAL :: dummy
NAMELIST /inputpp/ outdir, prefix, nwan, plot_wan_num, plot_wan_spin, nc, n0
!
! initialise environment
@@ -67,8 +68,7 @@ PROGRAM wannier_plot
!
CALL mp_bcast( ios, ionode_id, world_comm )
IF ( ios /= 0 ) CALL errore('wannier_ham','reading inputpp namelist',abs(ios))
- CALL read_file
- CALL openfil_pp
+ CALL read_file_new ( dummy )
CALL wannier_init(.true.)
diff --git a/PP/src/wfck2r.f90 b/PP/src/wfck2r.f90
index 57c9065fe..36c926528 100644
--- a/PP/src/wfck2r.f90
+++ b/PP/src/wfck2r.f90
@@ -37,7 +37,7 @@ PROGRAM wfck2r
!-----------------------------------------------------------------------
!
USE kinds, ONLY : DP
- USE io_files, ONLY : prefix, tmp_dir, diropn
+ USE io_files, ONLY : prefix, tmp_dir, diropn, restart_dir
USE wvfct, ONLY : nbnd, npwx, et, wg
USE klist, ONLY : xk, nks, ngk, igk_k, wk
USE io_global, ONLY : ionode, ionode_id, stdout
@@ -54,6 +54,7 @@ PROGRAM wfck2r
USE scatter_mod, only : gather_grid
USE fft_interfaces, ONLY : invfft
USE ener, ONLY: efermi => ef
+ USE pw_restart_new,ONLY : read_collected_wfc
!
IMPLICIT NONE
CHARACTER (len=256) :: outdir
@@ -113,8 +114,9 @@ PROGRAM wfck2r
!
! Now allocate space for pwscf variables, read and check them.
!
- CALL read_file
- call openfil_pp
+ CALL read_file_new ( exst )
+ IF ( .NOT. exst ) &
+ CALL errore ('wfck2r','wavefunctions not available?!?',1)
exst=.false.
@@ -193,7 +195,7 @@ PROGRAM wfck2r
DO ik = first_k, last_k
npw = ngk(ik)
- CALL davcio (evc, 2*nwordwfc, iunwfc, ik, - 1)
+ CALL read_collected_wfc ( restart_dir(), ik, evc )
do ibnd = first_band, last_band
!
diff --git a/PW/src/pw_restart_new.f90 b/PW/src/pw_restart_new.f90
index 6cd9426c0..3a5b1522e 100644
--- a/PW/src/pw_restart_new.f90
+++ b/PW/src/pw_restart_new.f90
@@ -38,7 +38,7 @@ MODULE pw_restart_new
CHARACTER(LEN=6), EXTERNAL :: int_to_char
PRIVATE
PUBLIC :: pw_write_schema, pw_write_binaries
- PUBLIC :: read_this_wfc
+ PUBLIC :: read_collected_wfc
!
CONTAINS
!------------------------------------------------------------------------
@@ -890,11 +890,11 @@ MODULE pw_restart_new
END SUBROUTINE gk_l2gmap_kdip
!
!------------------------------------------------------------------------
- SUBROUTINE read_this_wfc ( dirname, ik, evc )
+ SUBROUTINE read_collected_wfc ( dirname, ik, evc )
!------------------------------------------------------------------------
!
! ... reads from directory "dirname" (new file format) for k-point "ik"
- ! ... the wavefunctions into array "evc"
+ ! ... wavefunctions from collected format into distributed array "evc"
!
USE control_flags, ONLY : gamma_only
USE lsda_mod, ONLY : nspin, isk
@@ -999,12 +999,12 @@ MODULE pw_restart_new
IF ( nbnd_ < nbnd ) THEN
WRITE (msg,'("The number of bands for this run is",I6,", but only",&
& I6," bands were read from file")') nbnd, nbnd_
- CALL errore ('pw_restart - read_this_wfc', msg, 1 )
+ CALL errore ('pw_restart - read_collected_wfc', msg, 1 )
END IF
!
RETURN
!
- END SUBROUTINE read_this_wfc
+ END SUBROUTINE read_collected_wfc
!
!------------------------------------------------------------------------
END MODULE pw_restart_new
diff --git a/PW/src/read_file_new.f90 b/PW/src/read_file_new.f90
index 5eca4244c..3ef9cfdbf 100644
--- a/PW/src/read_file_new.f90
+++ b/PW/src/read_file_new.f90
@@ -19,7 +19,7 @@ SUBROUTINE read_file()
USE noncollin_module, ONLY : npol
USE klist, ONLY : nks
USE wavefunctions, ONLY : evc
- USE pw_restart_new, ONLY : read_this_wfc
+ USE pw_restart_new, ONLY : read_collected_wfc
!
IMPLICIT NONE
!
@@ -47,7 +47,7 @@ SUBROUTINE read_file()
!
DO ik = 1, nks
!
- CALL read_this_wfc ( dirname, ik, evc )
+ CALL read_collected_wfc ( dirname, ik, evc )
CALL save_buffer ( evc, nwordwfc, iunwfc, ik )
!
END DO
diff --git a/PW/src/wannier_proj.f90 b/PW/src/wannier_proj.f90
index c01972e04..7e00e8864 100644
--- a/PW/src/wannier_proj.f90
+++ b/PW/src/wannier_proj.f90
@@ -13,7 +13,9 @@ subroutine wannier_proj(ik, wan_func)
USE kinds, ONLY : DP
USE io_global, ONLY : stdout
- USE io_files
+ USE io_files, ONLY : restart_dir, iunsat, nwordatwfc, &
+ iunwf, nwordwf, iunwpp, nwordwpp
+ USE pw_restart_new, ONLY : read_collected_wfc
USE wannier_new, ONLY : wan_in, nwan, use_energy_int
USE ions_base, ONLY : nat, ityp
USE wvfct, ONLY : nbnd, npwx, et
@@ -49,12 +51,11 @@ subroutine wannier_proj(ik, wan_func)
IF (lsda) current_spin = isk(ik)
npw = ngk(ik)
- ! Read current wavefunctions
+ ! Read current wavefunctions DIRECTLY FROM FINAL WFC FILES
+ ! (this routine must be called from PP/src/, not from PW/src)
!
- evc = ZERO
- ! See comment in PP/src/openfil.f90 why davcio and not get_buffer
- ! call get_buffer ( evc, nwordwfc, iunwfc, ik )
- call davcio ( evc, 2*nwordwfc, iunwfc, ik, -1 )
+ evc = ZERO
+ call read_collected_wfc ( restart_dir(), ik, evc )
! Reads ortho-atomic wfc
! You should prepare data using orthoatwfc.f90
swfcatom = ZERO
diff --git a/PW/src/wfcinit.f90 b/PW/src/wfcinit.f90
index 66bcc4b1d..e2a76070c 100644
--- a/PW/src/wfcinit.f90
+++ b/PW/src/wfcinit.f90
@@ -29,7 +29,7 @@ SUBROUTINE wfcinit()
USE wavefunctions, ONLY : evc
USE wvfct, ONLY : nbnd, npwx, current_k
USE wannier_new, ONLY : use_wannier
- USE pw_restart_new, ONLY : read_this_wfc
+ USE pw_restart_new, ONLY : read_collected_wfc
USE mp, ONLY : mp_bcast
USE mp_images, ONLY : intra_image_comm
USE qexsd_module, ONLY : qexsd_readschema
@@ -68,7 +68,7 @@ SUBROUTINE wfcinit()
IF ( twfcollect_file ) THEN
!
DO ik = 1, nks
- CALL read_this_wfc ( dirname, ik, evc )
+ CALL read_collected_wfc ( dirname, ik, evc )
CALL save_buffer ( evc, nwordwfc, iunwfc, ik )
END DO
!