Commit cbd08e75 authored by sponce's avatar sponce

Restart with arbitray number of cores after epmatwp has been written to file

Some Ford doc added. 
Some unused variables cleaned. 



git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@12887 c92efa57-630b-4861-b058-cf58834340f0
parent 95cf2364
......@@ -26,14 +26,13 @@
USE spin_orb, ONLY : lspinorb
USE control_lr, ONLY : lgamma, nbnd_occ
USE phcom, ONLY : evq, dvpsi, dpsi, vlocq,&
dmuxc, w2, dyn00, t, tmq,&
npertx
dmuxc, w2, npertx
USE phus, ONLY : int1, int1_nc, int2, int2_so, &
int4, int4_nc, int5, int5_so, becsum_nc, &
alphasum, alphasum_nc, alphap
USE lr_symm_base, ONLY : rtau
USE qpoint, ONLY : eigqts
USE lrus, ONLY : becp1, int3, int3_nc, dpqq, dpqq_so
USE lrus, ONLY : becp1, int3, int3_nc
USE elph2, ONLY : elph, el_ph_mat
USE becmod, ONLY : becp, allocate_bec_type
USE uspp_param, ONLY : nhm
......@@ -81,9 +80,7 @@
ALLOCATE (rtau ( 3, 48, nat))
ALLOCATE (u ( 3 * nat, 3 * nat))
ALLOCATE (w2 ( 3 * nat))
ALLOCATE (dyn00 ( 3 * nat, 3 * nat))
ALLOCATE (t (npertx, npertx, 48,3 * nat))
ALLOCATE (tmq (npertx, npertx, 3 * nat))
! ALLOCATE (t (npertx, npertx, 48,3 * nat))
allocate (name_rap_mode( 3 * nat))
allocate (num_rap_mode( 3 * nat ))
ALLOCATE (npert ( 3 * nat))
......@@ -93,7 +90,6 @@
ALLOCATE (int3 ( nhm, nhm, npertx, nat, nspin))
ALLOCATE (int4 ( nhm * (nhm + 1)/2, 3, 3, nat, nspin))
ALLOCATE (int5 ( nhm * (nhm + 1)/2, 3, 3, nat , nat))
ALLOCATE (dpqq( nhm, nhm, 3, ntyp))
IF (noncolin) THEN
ALLOCATE(int1_nc( nhm, nhm, 3, nat, nspin))
ALLOCATE(int3_nc( nhm, nhm, npertx, nat, nspin))
......@@ -103,7 +99,6 @@
IF (lspinorb) THEN
ALLOCATE(int2_so( nhm, nhm, 3, nat, nat, nspin))
ALLOCATE(int5_so( nhm, nhm, 3, 3, nat, nat, nspin))
ALLOCATE(dpqq_so( nhm, nhm, nspin, 3, ntyp))
END IF
END IF
ALLOCATE (alphasum ( nhm * (nhm + 1)/2, 3, nat , nspin))
......
......@@ -23,10 +23,9 @@
!----------------------------------------------------------------------
USE phcom, ONLY : alphap, alphasum, alphasum_nc, &
becsum_nc, dmuxc, dpsi,&
drc, dpsi, dyn, dyn00, evq, w2, dvpsi,&
drc, dpsi, dyn, evq, w2, dvpsi,&
int5, vlocq, int2_so, int5_so
USE gc_lr, ONLY : grho, dvxc_rr, dvxc_s, dvxc_ss, dvxc_sr
USE lrus, ONLY : becp1, int3, int3_nc, dpqq, dpqq_so
USE lrus, ONLY : becp1, int3, int3_nc
USE phus, ONLY : int1, int1_nc, int2, int4, int4_nc
USE lr_symm_base, ONLY : rtau
USE noncollin_module, ONLY : m_loc
......@@ -35,100 +34,112 @@
USE elph2, ONLY : el_ph_mat, epf17, epsi, etf,&
etq, et_all, wf, wkf, wqf, wslen,&
xkq, xk_all, zstar, xkf, xqf, epmatwp
USE modes, ONLY : tmq, t, npert, u, name_rap_mode, num_rap_mode
USE epwcom, ONLY : epbread, epwread
USE modes, ONLY : t, npert, u, name_rap_mode, num_rap_mode
USE qpoint, ONLY : eigqts, igkq
USE klist, ONLY : nks
!
IMPLICIT NONE
INTEGER :: ik, ipol
!
IF (lgamma) THEN
IF(ASSOCIATED(evq)) NULLIFY(evq)
IF(ASSOCIATED(igkq)) NULLIFY(igkq)
IF ( epwread .and. .not. epbread ) THEN
! EPW variables ONLY
!
IF(ALLOCATED(el_ph_mat)) DEALLOCATE (el_ph_mat)
IF(ALLOCATED(epmatwp)) DEALLOCATE (epmatwp)
IF(ALLOCATED(epf17)) DEALLOCATE (epf17)
IF(ALLOCATED(etq)) DEALLOCATE (etq)
IF(ALLOCATED(etf)) DEALLOCATE (etf)
IF(ALLOCATED(wf)) DEALLOCATE (wf)
IF(ALLOCATED(xkq)) DEALLOCATE (xkq)
IF(ALLOCATED(xkf)) DEALLOCATE (xkf)
IF(ALLOCATED(wkf)) DEALLOCATE (wkf)
IF(ALLOCATED(xqf)) DEALLOCATE (xqf)
IF(ALLOCATED(wqf)) DEALLOCATE (wqf)
IF(ALLOCATED(xk_all)) DEALLOCATE (xk_all)
IF(ALLOCATED(et_all)) DEALLOCATE (et_all)
IF(ALLOCATED(wslen)) DEALLOCATE (wslen)
!
ELSE
IF(ASSOCIATED(evq)) DEALLOCATE(evq)
IF(ASSOCIATED(igkq)) DEALLOCATE(igkq)
END IF
!
IF(ALLOCATED(dvpsi)) DEALLOCATE (dvpsi)
IF(ALLOCATED(dpsi)) DEALLOCATE ( dpsi)
!
IF(ALLOCATED(vlocq)) DEALLOCATE (vlocq)
IF(ALLOCATED(dmuxc)) DEALLOCATE (dmuxc)
!
IF(ALLOCATED(eigqts)) DEALLOCATE (eigqts)
IF(ALLOCATED(rtau)) DEALLOCATE (rtau)
IF(ASSOCIATED(u)) DEALLOCATE (u)
if(allocated(name_rap_mode)) deallocate (name_rap_mode)
if(allocated(num_rap_mode)) deallocate (num_rap_mode)
IF(ALLOCATED(dyn)) DEALLOCATE (dyn)
IF(ALLOCATED(dyn00)) DEALLOCATE (dyn00)
IF(ALLOCATED(w2)) DEALLOCATE (w2)
IF(ASSOCIATED(t)) DEALLOCATE (t)
IF(ASSOCIATED(tmq)) DEALLOCATE (tmq)
IF(ALLOCATED(epsi)) DEALLOCATE (epsi)
IF(ALLOCATED(zstar)) DEALLOCATE (zstar)
!
IF(ALLOCATED(npert)) DEALLOCATE (npert)
!
IF(ALLOCATED(int1)) DEALLOCATE (int1)
IF(ALLOCATED(int2)) DEALLOCATE (int2)
IF(ALLOCATED(int3)) DEALLOCATE (int3)
IF(ALLOCATED(int4)) DEALLOCATE (int4)
IF(ALLOCATED(int5)) DEALLOCATE (int5)
IF(ALLOCATED(dpqq)) DEALLOCATE (dpqq)
IF(ALLOCATED(int1_nc)) DEALLOCATE(int1_nc)
IF(ALLOCATED(int3_nc)) DEALLOCATE(int3_nc)
IF(ALLOCATED(int4_nc)) DEALLOCATE(int4_nc)
IF(ALLOCATED(becsum_nc)) DEALLOCATE(becsum_nc)
IF(ALLOCATED(alphasum_nc)) DEALLOCATE(alphasum_nc)
IF(ALLOCATED(int2_so)) DEALLOCATE(int2_so)
IF(ALLOCATED(int5_so)) DEALLOCATE(int5_so)
IF(ALLOCATED(dpqq_so)) DEALLOCATE(dpqq_so)
IF(ALLOCATED(alphasum)) DEALLOCATE (alphasum)
!
if(allocated(alphap)) then
do ik=1,nks
do ipol=1,3
call deallocate_bec_type ( alphap(ipol,ik) )
enddo
end do
deallocate (alphap)
endif
if(allocated(becp1)) then
do ik=1,size(becp1)
call deallocate_bec_type ( becp1(ik) )
end do
deallocate(becp1)
end if
call deallocate_bec_type ( becp )
IF(ALLOCATED(nbnd_occ)) DEALLOCATE(nbnd_occ)
IF(ALLOCATED(m_loc)) DEALLOCATE(m_loc)
!
IF(ALLOCATED(drc)) DEALLOCATE(drc)
!
IF(ALLOCATED(dvxc_rr)) DEALLOCATE (dvxc_rr)
IF(ALLOCATED(dvxc_sr)) DEALLOCATE (dvxc_sr)
IF(ALLOCATED(dvxc_ss)) DEALLOCATE (dvxc_ss)
IF(ALLOCATED(dvxc_s)) DEALLOCATE (dvxc_s)
IF(ALLOCATED(grho)) DEALLOCATE (grho)
!
! EPW variables
!
IF(ALLOCATED(el_ph_mat)) DEALLOCATE (el_ph_mat)
IF(ALLOCATED(epmatwp)) DEALLOCATE (epmatwp)
IF(ALLOCATED(epf17)) DEALLOCATE (epf17)
IF(ALLOCATED(etq)) DEALLOCATE (etq)
IF(ALLOCATED(etf)) DEALLOCATE (etf)
IF(ALLOCATED(wf)) DEALLOCATE (wf)
IF(ALLOCATED(xkq)) DEALLOCATE (xkq)
IF(ALLOCATED(xkf)) DEALLOCATE (xkf)
IF(ALLOCATED(wkf)) DEALLOCATE (wkf)
IF(ALLOCATED(xqf)) DEALLOCATE (xqf)
IF(ALLOCATED(wqf)) DEALLOCATE (wqf)
IF(ALLOCATED(xk_all)) DEALLOCATE (xk_all)
IF(ALLOCATED(et_all)) DEALLOCATE (et_all)
IF(ALLOCATED(wslen)) DEALLOCATE (wslen)
!
IF (lgamma) THEN
IF(ASSOCIATED(evq)) NULLIFY(evq)
IF(ASSOCIATED(igkq)) NULLIFY(igkq)
ELSE
IF(ASSOCIATED(evq)) DEALLOCATE(evq)
IF(ASSOCIATED(igkq)) DEALLOCATE(igkq)
END IF
!
IF(ALLOCATED(dvpsi)) DEALLOCATE (dvpsi)
IF(ALLOCATED(dpsi)) DEALLOCATE ( dpsi)
!
IF(ALLOCATED(vlocq)) DEALLOCATE (vlocq)
IF(ALLOCATED(dmuxc)) DEALLOCATE (dmuxc)
!
IF(ALLOCATED(eigqts)) DEALLOCATE (eigqts)
IF(ALLOCATED(rtau)) DEALLOCATE (rtau)
IF(ASSOCIATED(u)) DEALLOCATE (u)
if(allocated(name_rap_mode)) deallocate (name_rap_mode)
if(allocated(num_rap_mode)) deallocate (num_rap_mode)
IF(ALLOCATED(dyn)) DEALLOCATE (dyn)
IF(ALLOCATED(w2)) DEALLOCATE (w2)
!IF(ASSOCIATED(t)) DEALLOCATE (t)
IF(ALLOCATED(epsi)) DEALLOCATE (epsi)
IF(ALLOCATED(zstar)) DEALLOCATE (zstar)
!
IF(ALLOCATED(npert)) DEALLOCATE (npert)
!
IF(ALLOCATED(int1)) DEALLOCATE (int1)
IF(ALLOCATED(int2)) DEALLOCATE (int2)
IF(ALLOCATED(int3)) DEALLOCATE (int3)
IF(ALLOCATED(int4)) DEALLOCATE (int4)
IF(ALLOCATED(int5)) DEALLOCATE (int5)
IF(ALLOCATED(int1_nc)) DEALLOCATE(int1_nc)
IF(ALLOCATED(int3_nc)) DEALLOCATE(int3_nc)
IF(ALLOCATED(int4_nc)) DEALLOCATE(int4_nc)
IF(ALLOCATED(becsum_nc)) DEALLOCATE(becsum_nc)
IF(ALLOCATED(alphasum_nc)) DEALLOCATE(alphasum_nc)
IF(ALLOCATED(int2_so)) DEALLOCATE(int2_so)
IF(ALLOCATED(int5_so)) DEALLOCATE(int5_so)
IF(ALLOCATED(alphasum)) DEALLOCATE (alphasum)
!
if(allocated(alphap)) then
do ik=1,nks
do ipol=1,3
call deallocate_bec_type ( alphap(ipol,ik) )
enddo
end do
deallocate (alphap)
endif
if(allocated(becp1)) then
do ik=1,size(becp1)
call deallocate_bec_type ( becp1(ik) )
end do
deallocate(becp1)
end if
call deallocate_bec_type ( becp )
IF(ALLOCATED(nbnd_occ)) DEALLOCATE(nbnd_occ)
IF(ALLOCATED(m_loc)) DEALLOCATE(m_loc)
!
IF(ALLOCATED(drc)) DEALLOCATE(drc)
!
! EPW variables
!
IF(ALLOCATED(el_ph_mat)) DEALLOCATE (el_ph_mat)
IF(ALLOCATED(epmatwp)) DEALLOCATE (epmatwp)
IF(ALLOCATED(epf17)) DEALLOCATE (epf17)
IF(ALLOCATED(etq)) DEALLOCATE (etq)
IF(ALLOCATED(etf)) DEALLOCATE (etf)
IF(ALLOCATED(wf)) DEALLOCATE (wf)
IF(ALLOCATED(xkq)) DEALLOCATE (xkq)
IF(ALLOCATED(xkf)) DEALLOCATE (xkf)
IF(ALLOCATED(wkf)) DEALLOCATE (wkf)
IF(ALLOCATED(xqf)) DEALLOCATE (xqf)
IF(ALLOCATED(wqf)) DEALLOCATE (wqf)
IF(ALLOCATED(xk_all)) DEALLOCATE (xk_all)
IF(ALLOCATED(et_all)) DEALLOCATE (et_all)
IF(ALLOCATED(wslen)) DEALLOCATE (wslen)
ENDIF ! epwread .and. .not. epbread
!
END SUBROUTINE deallocate_epw
......@@ -7,7 +7,7 @@
! present distribution, or http://www.gnu.org/copyleft.gpl.txt .
!
!--------------------------------------------------------------------------
SUBROUTINE dynwan2bloch ( nbnd, nrr, irvec, ndegen, xq, cuf, eig)
SUBROUTINE dynwan2bloch ( nbnd, nrr, irvec, ndegen, xxq, cuf, eig)
!--------------------------------------------------------------------------
!!
!!
......@@ -40,37 +40,33 @@
USE elph2, ONLY : rdw, epsi, zstar
USE epwcom, ONLY : lpolar
USE constants_epw, ONLY : twopi, ci, czero
implicit none
!
! input variables
!
integer :: nbnd, nrr, irvec (3, nrr), ndegen (nrr)
! number of bands (possibly of the optimal subspace)
! kpoint number for the interpolation
! record length and unit for direct write of rotation matrix
! number of WS points, crystal coordinates, degeneracy
!
! Hamiltonian in wannier basis
!
real(kind=DP) :: xq (3)
! kpoint coordinates for the interpolation
!
! output variables
implicit none
!
real(kind=DP) :: eig (nbnd)
! interpolated hamiltonian eigenvalues for this kpoint
complex(kind=DP) :: cuf(nbnd, nbnd)
! Rotation matrix, fine mesh
INTEGER, INTENT (in) :: nbnd
!! number of bands (possibly of the optimal subspace)
INTEGER, INTENT (in) :: nrr
!! kpoint number for the interpolation
INTEGER, INTENT (in) :: irvec (3, nrr)
!! record length and unit for direct write of rotation matrix
INTEGER, INTENT (in) :: ndegen (nrr)
!! number of WS points, crystal coordinates, degeneracy
!
REAL(kind=DP), INTENT (in) :: xxq (3)
!! kpoint coordinates for the interpolation
REAL(kind=DP), INTENT (out) :: eig (nbnd)
!! interpolated hamiltonian eigenvalues for this kpoint
COMPLEX(kind=DP), INTENT (out) :: cuf(nbnd, nbnd)
!! Rotation matrix, fine mesh
!
! work variables
! variables for lapack ZHPEVX
!
integer :: neig, info, ifail( nbnd ), iwork( 5*nbnd )
real(kind=DP) :: w( nbnd ), rwork( 7*nbnd )
complex(kind=DP) :: champ( nbnd*(nbnd+1)/2 ), &
cwork( 2*nbnd ), cz( nbnd, nbnd)
!
! work variables
!
real(kind=DP) :: xq (3)
complex(kind=DP) :: chf(nbnd, nbnd)
! Hamiltonian in Bloch basis, fine mesh
integer :: ibnd, jbnd, ir, na, nb
......@@ -88,6 +84,7 @@
! H~_k is chf ( nbnd, nbnd, 2*ik-1 )
! H~_k+q is chf ( nbnd, nbnd, 2*ik )
!
xq = xxq
chf (:,:) = czero
!
DO ir = 1, nrr
......
......@@ -215,8 +215,14 @@
IF (allocated(qrad)) deallocate(qrad)
allocate (qrad (maxvalue, nbetam*(nbetam+1)/2,lmaxq, nsp))
ENDIF
IF (nkstot .ne. nk1*nk2*nk3 ) &
!
! DO not perform the check if restart
IF ( epwread .and. .not. epbread ) then
continue
ELSE
IF (nkstot .ne. nk1*nk2*nk3 ) &
CALL errore('elphon_shuffle_wrap','nscf run inconsistent with epw input',1)
ENDIF
!
! READ in external electronic eigenvalues. e.g. GW
!
......@@ -251,8 +257,14 @@
et_mb(:,:) = et(:,1:nks)
ENDIF
!
! Do not recompute dipole matrix elements
IF ( epwread .and. .not. epbread ) then
continue
ELSE
! compute coarse grid dipole matrix elements. Very fast
CALL compute_pmn_para
CALL compute_pmn_para
ENDIF
!CALL compute_pmn_para
!
! gather electronic eigenvalues for subsequent shuffle
!
......@@ -278,38 +290,44 @@
!
CALL mp_barrier(inter_pool_comm)
!
! allocate dynamical matrix and ep matrix for all q's
!
allocate ( dynq (nmodes, nmodes, nq1*nq2*nq3), &
epmatq (nbnd, nbnd, nks, nmodes, nq1*nq2*nq3), &
epsi(3,3), zstar(3,3,nat), bmat(nbnd, nbnd, nks, nq1*nq2*nq3), &
cu ( nbnd, nbndsub, nks), cuq ( nbnd, nbndsub, nks), &
lwin ( nbnd, nks ), lwinq ( nbnd, nks ) )
!
epsi=0.d0
zstar=0.d0
!
! SP: The symmetries are now consistent with QE 5. This means that the order of the q in the star
! should be the same as in the .dyn files produced by QE 5.
!
! First we start by setting up the lattice & crystal symm. as done in PH/init_representations.f90
!
! ~~~~~~~~ setup bravais lattice symmetry ~~~~~~~~
CALL set_sym_bl ( ) ! This should define the s matrix
WRITE(stdout, '(5x,a,i3)') "Symmetries of bravais lattice: ", nrot
!
! ~~~~~~~~ setup crystal symmetry ~~~~~~~~
CALL find_sym ( nat, tau, ityp, dfftp%nr1,dfftp%nr2,dfftp%nr3, .false., m_loc )
WRITE(stdout, '(5x,a,i3)') "Symmetries of crystal: ", nsym
!
! The following loop is required to propertly set up the symmetry matrix s.
! We here copy the calls made in PH/init_representations.f90 to have the same s as in QE 5.
DO iq_irr = 1, nqc_irr
xq = xqc_irr(:,iq_irr)
CALL set_small_group_of_q(nsymq,invsymq,minus_q)
CALL sgam_ph_new (at, bg, nsym, s, irt, tau, rtau, nat)
CALL set_giq (xq,s,nsymq,nsym,irotmq,minus_q,gi,gimq)
ENDDO
! Do not do symmetry stuff
IF ( epwread .and. .not. epbread ) then
CONTINUE
ELSE
!
! allocate dynamical matrix and ep matrix for all q's
!
allocate ( dynq (nmodes, nmodes, nq1*nq2*nq3), &
epmatq (nbnd, nbnd, nks, nmodes, nq1*nq2*nq3), &
epsi(3,3), zstar(3,3,nat), bmat(nbnd, nbnd, nks, nq1*nq2*nq3), &
cu ( nbnd, nbndsub, nks), cuq ( nbnd, nbndsub, nks), &
lwin ( nbnd, nks ), lwinq ( nbnd, nks ) )
!
epsi=0.d0
zstar=0.d0
!
! SP: The symmetries are now consistent with QE 5. This means that the order of the q in the star
! should be the same as in the .dyn files produced by QE 5.
!
! First we start by setting up the lattice & crystal symm. as done in PH/init_representations.f90
!
! ~~~~~~~~ setup bravais lattice symmetry ~~~~~~~~
CALL set_sym_bl ( ) ! This should define the s matrix
WRITE(stdout, '(5x,a,i3)') "Symmetries of bravais lattice: ", nrot
!
! ~~~~~~~~ setup crystal symmetry ~~~~~~~~
CALL find_sym ( nat, tau, ityp, dfftp%nr1,dfftp%nr2,dfftp%nr3, .false., m_loc )
WRITE(stdout, '(5x,a,i3)') "Symmetries of crystal: ", nsym
!
! The following loop is required to propertly set up the symmetry matrix s.
! We here copy the calls made in PH/init_representations.f90 to have the same s as in QE 5.
DO iq_irr = 1, nqc_irr
xq = xqc_irr(:,iq_irr)
CALL set_small_group_of_q(nsymq,invsymq,minus_q)
CALL sgam_ph_new (at, bg, nsym, s, irt, tau, rtau, nat)
CALL set_giq (xq,s,nsymq,nsym,irotmq,minus_q,gi,gimq)
ENDDO
ENDIF ! epwread .and. .not. epbread
!
! CV: if we read the .fmt files we don't need to read the .epb anymore
!
......
......@@ -26,9 +26,10 @@
!
USE kinds, ONLY : DP
USE pwcom, ONLY : nbnd, nks, nkstot, isk, &
et, xk, at, bg, ef, nelec
et, xk, ef, nelec
USE cell_base, ONLY : at, bg
USE start_k, ONLY : nk1, nk2, nk3
USE ions_base, ONLY : amass, ityp
USE ions_base, ONLY : nat, amass, ityp
USE phcom, ONLY : nq1, nq2, nq3, nmodes, w2
USE epwcom, ONLY : nbndsub, lrepmatf, fsthick, epwread, &
epwwrite, ngaussw, degaussw, lpolar, &
......@@ -42,7 +43,7 @@
USE io_files, ONLY : prefix, diropn
USE io_global, ONLY : stdout, ionode
USE io_epw, ONLY : lambda_phself, linewidth_phself, iunepmatf, &
iunepmatwe, iunepmatwp
iunepmatwe, iunepmatwp, crystal
USE elph2, ONLY : nrr_k, nrr_q, cu, cuq, lwin, lwinq, irvec, ndegen_k, ndegen_q, &
wslen, chw, chw_ks, cvmew, cdmew, rdw, epmatwp, epmatq, &
wf, etf, etf_k, etf_ks, xqf, xkf, wkf, &
......@@ -54,7 +55,7 @@
#endif
USE mp, ONLY : mp_barrier, mp_bcast, mp_sum
USE io_global, ONLY : ionode_id
USE mp_global, ONLY : inter_pool_comm
USE mp_global, ONLY : inter_pool_comm, intra_pool_comm, root_pool
USE mp_world, ONLY : mpime
!
implicit none
......@@ -157,6 +158,45 @@
!
! DBSP
! HERE loadkmesh
IF ( epwread ) THEN
!
! We need some crystal info
IF (mpime.eq.ionode_id) THEN
!
OPEN(unit=crystal,file='crystal.fmt',status='old',iostat=ios)
READ (crystal,*) nat
READ (crystal,*) nmodes
READ (crystal,*) nelec
READ (crystal,*) at
READ (crystal,*) bg
READ (crystal,*) amass
ALLOCATE( ityp( nat ) )
READ (crystal,*) ityp
!
ENDIF
CALL mp_bcast (nat, ionode_id, inter_pool_comm)
CALL mp_bcast (nat, root_pool, intra_pool_comm)
IF (mpime /= ionode_id) ALLOCATE( ityp( nat ) )
CALL mp_bcast (nmodes, ionode_id, inter_pool_comm)
CALL mp_bcast (nmodes, root_pool, intra_pool_comm)
CALL mp_bcast (nelec, ionode_id, inter_pool_comm)
CALL mp_bcast (nelec, root_pool, intra_pool_comm)
CALL mp_bcast (at, ionode_id, inter_pool_comm)
CALL mp_bcast (at, root_pool, intra_pool_comm)
CALL mp_bcast (bg, ionode_id, inter_pool_comm)
CALL mp_bcast (bg, root_pool, intra_pool_comm)
CALL mp_bcast (amass, ionode_id, inter_pool_comm)
CALL mp_bcast (amass, root_pool, intra_pool_comm)
CALL mp_bcast (ityp, ionode_id, inter_pool_comm)
CALL mp_bcast (ityp, root_pool, intra_pool_comm)
IF (mpime.eq.ionode_id) THEN
CLOSE(crystal)
ENDIF
CALL mp_barrier(inter_pool_comm)
!
ELSE
continue
ENDIF
!
! determine Wigner-Seitz points
!
......@@ -182,6 +222,7 @@
CALL epw_read
!
ELSE !if not epwread (i.e. need to calculate fmt file)
!
!
xxq = 0.d0
CALL loadumat &
......@@ -970,11 +1011,14 @@ SUBROUTINE epw_write
!
USE kinds, ONLY : DP
USE epwcom, ONLY : nbndsub, vme, eig_read, etf_mem
USE pwcom, ONLY : ef
USE pwcom, ONLY : ef, nelec
USE elph2, ONLY : nrr_k, nrr_q, chw, rdw, cdmew, cvmew, chw_ks, &
zstar, epsi, epmatwp
USE ions_base, ONLY : amass, ityp, nat
USE cell_base, ONLY : at, bg
USE phcom, ONLY : nmodes
USE io_epw, ONLY : epwdata, iundmedata, iunvmedata, iunksdata, iunepmatwp
USE io_epw, ONLY : epwdata, iundmedata, iunvmedata, iunksdata, iunepmatwp, &
crystal
USE io_files, ONLY : prefix, diropn
USE mp, ONLY : mp_barrier
USE mp_global, ONLY : inter_pool_comm
......@@ -992,9 +1036,17 @@ SUBROUTINE epw_write
IF (mpime.eq.ionode_id) THEN
!
OPEN(unit=epwdata,file='epwdata.fmt')
OPEN(unit=crystal,file='crystal.fmt')
OPEN(unit=iundmedata,file='dmedata.fmt')
IF (vme) OPEN(unit=iunvmedata,file='vmedata.fmt')
IF (eig_read) OPEN(unit=iunksdata,file='ksdata.fmt')
WRITE (crystal,*) nat
WRITE (crystal,*) nmodes
WRITE (crystal,*) nelec
WRITE (crystal,*) at
WRITE (crystal,*) bg
WRITE (crystal,*) amass
WRITE (crystal,*) ityp
WRITE (epwdata,*) ef
WRITE (epwdata,*) nbndsub, nrr_k, nmodes, nrr_q
WRITE (epwdata,*) zstar, epsi
......@@ -1036,7 +1088,7 @@ SUBROUTINE epw_write
ENDDO
ENDDO
!DBSP
!filint = trim(prefix)//'.epmatwp'
filint = trim(prefix)//'.epmatwp'
CALL diropn (iunepmatwp, 'epmatwp', lrepmatw, exst)
CALL davcio ( aux, lrepmatw, iunepmatwp, 1, +1 )
CLOSE(iunepmatwp)
......@@ -1044,6 +1096,7 @@ SUBROUTINE epw_write
ENDIF
!
CLOSE(epwdata)
CLOSE(crystal)
CLOSE(iundmedata)
IF (vme) CLOSE(iunvmedata)
IF (eig_read) CLOSE(iunksdata)
......@@ -1061,6 +1114,7 @@ SUBROUTINE epw_read()
USE pwcom, ONLY : ef
USE elph2, ONLY : nrr_k, nrr_q, chw, rdw, epmatwp, &
cdmew, cvmew, chw_ks, zstar, epsi
USE ions_base, ONLY : nat
USE phcom, ONLY : nmodes
USE io_global, ONLY : stdout
USE io_files, ONLY : prefix, diropn
......@@ -1081,9 +1135,14 @@ SUBROUTINE epw_read()
INTEGER :: ibnd, jbnd, jmode, imode, irk, irq, &
ipol, ios, i, lrepmatw
complex(kind=DP) :: aux ( nbndsub*nbndsub*nrr_k*nmodes*nrr_q )
!
!
WRITE(stdout,'(/5x,"Reading Hamiltonian, Dynamical matrix and EP vertex in Wann rep from file"/)')
call flush(6)
!
! This is important in restart mode as zstar etc has not been allocated
IF (.NOT. ALLOCATED (zstar) ) ALLOCATE( zstar(3,3,nat) )
IF (.NOT. ALLOCATED (epsi) ) ALLOCATE( epsi(3,3) )
IF (mpime.eq.ionode_id) THEN
!
OPEN(unit=epwdata,file='epwdata.fmt',status='old',iostat=ios)
......@@ -1170,8 +1229,13 @@ SUBROUTINE epw_read()
!
lrepmatw = 2 * nbndsub * nbndsub * nrr_k * nmodes * nrr_q
filint = trim(prefix)//'.epmatwp'
!CALL diropn (iunepmatwp, filint, lrepmatw, exst)
CALL diropn (iunepmatwp, 'epmatwp', lrepmatw, exst)
CALL davcio ( aux, lrepmatw, iunepmatwp, 1, -1 )
!READ( UNIT = iunepmatwp, REC = 1, IOSTAT = ios ) aux
i = 0
DO irq = 1, nrr_q
DO imode = 1, nmodes
......
......@@ -27,7 +27,7 @@
USE control_flags, ONLY : gamma_only
USE control_epw, ONLY : wannierize
USE global_version, ONLY : version_number
USE epwcom, ONLY : filukk, eliashberg, ep_coupling
USE epwcom, ONLY : filukk, eliashberg, ep_coupling, epwread, epbread
USE environment, ONLY : environment_start
USE elph2, ONLY : elph
! Flag to perform an electron-phonon calculation. If .true.
......@@ -90,7 +90,18 @@ write(stdout,'(a)') "
CALL epw_readin
!
CALL allocate_epwq
CALL epw_setup
IF ( epwread .AND. .NOT. epbread ) THEN
write(stdout,'(a)') " "
write(stdout,'(a)') " ------------------------------------------------------------------------ "
write(stdout,'(a)') " RESTART - RESTART - RESTART - RESTART "
write(stdout,'(a)') " Restart is done without reading PWSCF save file. "
write(stdout,'(a)') " Be aware that some consistency checks are therefore not done. "
write(stdout,'(a)') " ------------------------------------------------------------------------ "
write(stdout,'(a)') " "
ELSE
CALL epw_setup
ENDIF
!
! Print run info to stdout
!
......@@ -98,11 +109,20 @@ write(stdout,'(a)') "
!
IF ( ep_coupling ) THEN
!
CALL openfilepw
! In case of restart with arbitrary number of cores.
IF ( epwread .and. .not. epbread ) THEN
continue
ELSE
CALL openfilepw
ENDIF
!
CALL print_clock( 'EPW' )
!
CALL epw_init(.true.)
IF ( epwread .and. .not. epbread ) THEN
continue
ELSE
CALL epw_init(.true.)
ENDIF
!
CALL print_clock( 'EPW' )
!
......
......@@ -593,7 +593,11 @@
modenum_aux = modenum
!
! SP: This initialized nspin and nspin_mag
CALL read_file
IF ( epwread .and. .not. epbread ) then
continue
ELSE
CALL read_file