2003-01-20 05:58:50 +08:00
|
|
|
!
|
2004-09-28 16:50:35 +08:00
|
|
|
! Copyright (C) 2001-2004 PWSCF group
|
2003-01-20 05:58:50 +08:00
|
|
|
! This file is distributed under the terms of the
|
|
|
|
! GNU General Public License. See the file `License'
|
|
|
|
! in the root directory of the present distribution,
|
|
|
|
! or http://www.gnu.org/copyleft/gpl.txt .
|
|
|
|
!
|
2004-09-28 16:50:35 +08:00
|
|
|
!----------------------------------------------------------------------------
|
|
|
|
SUBROUTINE openfilq()
|
|
|
|
!----------------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! ... This subroutine opens all the files necessary for the phononq
|
|
|
|
! ... calculation.
|
|
|
|
!
|
|
|
|
USE kinds, ONLY : DP
|
2009-05-07 15:21:39 +08:00
|
|
|
USE control_flags, ONLY : modenum
|
2004-09-28 16:50:35 +08:00
|
|
|
USE units_ph, ONLY : iuwfc, iudwf, iubar, iucom, iudvkb3, &
|
|
|
|
iudrhous, iuebar, iudrho, iudyn, iudvscf, &
|
|
|
|
lrwfc, lrdwf, lrbar, lrcom, lrdvkb3, &
|
2010-10-12 22:46:04 +08:00
|
|
|
lrdrhous, lrebar, lrdrho, lint3paw, iuint3paw
|
2010-06-13 19:29:12 +08:00
|
|
|
USE io_files, ONLY : tmp_dir, diropn
|
2009-11-17 01:04:25 +08:00
|
|
|
USE control_ph, ONLY : epsil, zue, ext_recover, trans, elph, lgamma, &
|
2011-05-17 17:47:47 +08:00
|
|
|
tmp_dir_phq, start_irr, last_irr, xmldyn, dvscf_dir
|
2009-05-06 00:23:23 +08:00
|
|
|
USE save_ph, ONLY : tmp_dir_save
|
2010-10-12 22:46:04 +08:00
|
|
|
USE ions_base, ONLY : nat
|
2008-07-28 16:06:01 +08:00
|
|
|
USE qpoint, ONLY : nksq
|
2005-03-05 01:46:02 +08:00
|
|
|
USE output, ONLY : fildyn, fildvscf
|
2004-09-28 16:50:35 +08:00
|
|
|
USE wvfct, ONLY : nbnd, npwx
|
2010-12-31 21:18:20 +08:00
|
|
|
USE grid_dimensions,ONLY : nr1x, nr2x, nr3x
|
|
|
|
USE fft_base, ONLY : dfftp
|
2004-09-28 16:50:35 +08:00
|
|
|
USE lsda_mod, ONLY : nspin
|
2005-03-28 21:55:19 +08:00
|
|
|
USE uspp, ONLY : nkb, okvan
|
2010-10-12 22:46:04 +08:00
|
|
|
USE uspp_param, ONLY : nhm
|
2004-09-28 16:50:35 +08:00
|
|
|
USE io_files, ONLY : prefix, iunigk
|
2009-10-23 19:11:36 +08:00
|
|
|
USE noncollin_module, ONLY : npol, nspin_mag
|
2010-10-12 22:46:04 +08:00
|
|
|
USE paw_variables, ONLY : okpaw
|
2004-09-28 16:50:35 +08:00
|
|
|
USE control_flags, ONLY : twfcollect
|
2008-09-02 00:37:50 +08:00
|
|
|
USE mp_global, ONLY : me_pool
|
2004-09-28 16:50:35 +08:00
|
|
|
USE io_global, ONLY : ionode
|
2011-05-05 22:25:03 +08:00
|
|
|
USE ramanm, ONLY: lraman, elop, iuchf, iud2w, iuba2, lrchf, lrd2w, lrba2
|
|
|
|
USE acfdtest, ONLY : acfdt_is_active, acfdt_num_der
|
2011-05-07 20:09:24 +08:00
|
|
|
USE input_parameters,ONLY: nk1, nk2, nk3
|
2004-09-28 16:50:35 +08:00
|
|
|
!
|
|
|
|
IMPLICIT NONE
|
|
|
|
!
|
|
|
|
INTEGER :: ios
|
2003-01-20 05:58:50 +08:00
|
|
|
! integer variable for I/O control
|
2004-09-28 16:50:35 +08:00
|
|
|
CHARACTER (len=256) :: filint
|
2003-01-20 05:58:50 +08:00
|
|
|
! the name of the file
|
2004-09-28 16:50:35 +08:00
|
|
|
LOGICAL :: exst
|
2003-01-20 05:58:50 +08:00
|
|
|
! logical variable to check file existe
|
|
|
|
!
|
2005-08-28 22:09:42 +08:00
|
|
|
REAL(DP) :: edum(1,1), wdum(1,1)
|
2008-09-02 00:37:50 +08:00
|
|
|
INTEGER :: ndr, ierr
|
2006-01-31 00:17:30 +08:00
|
|
|
!
|
|
|
|
!
|
2004-09-28 16:50:35 +08:00
|
|
|
IF (LEN_TRIM(prefix) == 0) CALL errore ('openfilq', 'wrong prefix', 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! There are six direct access files to be opened in the tmp area
|
|
|
|
!
|
2009-05-06 00:23:23 +08:00
|
|
|
! The file with the wavefunctions. In the lgamma case reads those
|
|
|
|
! written by pw.x. In the other cases those calculated by ph.x
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2010-10-26 17:13:49 +08:00
|
|
|
tmp_dir=tmp_dir_phq
|
2011-03-10 05:39:09 +08:00
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!! ACFDT TEST !!!!!!!!!!!!!!!!
|
|
|
|
IF (acfdt_is_active) THEN
|
|
|
|
! ACFDT -test always the wfc is read/written from/to file in tmp_dir_phq
|
|
|
|
IF (.not.acfdt_num_der) then
|
|
|
|
IF (lgamma.AND.modenum==0) tmp_dir=tmp_dir_save
|
|
|
|
ENDIF
|
|
|
|
ELSE
|
|
|
|
! this is the standard treatment
|
With this commit I include the possibility of running a phonon calculation
with a different k-point grid than that used for the charge density.
This is equivalent to what was present in previous QE versions when pw.x
was run with the option calculation="phonon" and a number of k-points
different from that used for the charge density.
To use this option specify
nk1, nk2, nk3 with values differents from zero in the input file
of the ph.x
The variables k1, k2, k3 can also be used to shift the regular
grid from the origin.
An example of the ph.x input file is
Ph
&inputph
prefix='MgB2',
amass(1)= 10.811,
amass(2)= 24.305,
fildyn='dynq1',
fildvscf='dvscf_1',
outdir='./tmpdisp_nk/',
tr2_ph=1.0d-14,
trans=.true.,
epsil=.false.,
ldisp=.true.,
nq1=2,nq2=2,nq3=2,
nk1=16, <-------------------
nk2=16, <-------------------
nk3=12, <-------------------
k1=0,
k2=0,
k3=0,
&end
The defaults values for k1,k2,k3 and nk1, nk2, nk3 is zero.
The option works both with ldisp=.true. or with the calculation
for a fixed q.
See doc-def/INPUT_PH.def for details on the input file.
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@7744 c92efa57-630b-4861-b058-cf58834340f0
2011-05-05 04:38:27 +08:00
|
|
|
IF (lgamma.AND.modenum==0.AND.nk1.eq.0.AND.nk2.eq.0.AND.nk3.eq.0) tmp_dir=tmp_dir_save
|
2011-03-10 05:39:09 +08:00
|
|
|
ENDIF
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!! END OF ACFDT TEST !!!!!!!!!!!!!!!!
|
2003-02-08 00:04:36 +08:00
|
|
|
iuwfc = 20
|
2007-02-08 21:07:07 +08:00
|
|
|
lrwfc = 2 * nbnd * npwx * npol
|
2005-06-17 21:27:38 +08:00
|
|
|
CALL diropn (iuwfc, 'wfc', lrwfc, exst)
|
2006-03-08 18:10:06 +08:00
|
|
|
IF (.NOT.exst) THEN
|
2006-03-23 19:00:52 +08:00
|
|
|
CALL errore ('openfilq', 'file '//trim(prefix)//'.wfc not found', 1)
|
2004-09-28 16:50:35 +08:00
|
|
|
END IF
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2009-05-06 00:23:23 +08:00
|
|
|
! From now on all files are written with the _ph prefix
|
|
|
|
!
|
2010-10-26 17:13:49 +08:00
|
|
|
tmp_dir=tmp_dir_phq
|
2009-05-06 00:23:23 +08:00
|
|
|
!
|
2003-01-20 05:58:50 +08:00
|
|
|
! The file with deltaV_{bare} * psi
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
iubar = 21
|
2007-02-08 21:07:07 +08:00
|
|
|
lrbar = 2 * nbnd * npwx * npol
|
2005-06-17 21:27:38 +08:00
|
|
|
CALL diropn (iubar, 'bar', lrbar, exst)
|
2009-11-17 01:04:25 +08:00
|
|
|
IF (ext_recover.AND..NOT.exst) &
|
2005-06-17 21:27:38 +08:00
|
|
|
CALL errore ('openfilq','file '//trim(prefix)//'.bar not found', 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! The file with the solution delta psi
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
iudwf = 22
|
2007-02-08 21:07:07 +08:00
|
|
|
lrdwf = 2 * nbnd * npwx * npol
|
2005-06-17 21:27:38 +08:00
|
|
|
CALL diropn (iudwf, 'dwf', lrdwf, exst)
|
2009-11-17 01:04:25 +08:00
|
|
|
IF (ext_recover.AND..NOT.exst) &
|
2005-06-17 21:27:38 +08:00
|
|
|
CALL errore ('openfilq','file '//trim(prefix)//'.dwf not found', 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! open a file with the static change of the charge
|
|
|
|
!
|
2004-09-28 16:50:35 +08:00
|
|
|
IF (okvan) THEN
|
2003-02-08 00:04:36 +08:00
|
|
|
iudrhous = 25
|
2010-12-31 21:18:20 +08:00
|
|
|
lrdrhous = 2 * dfftp%nnr * nspin_mag
|
2005-06-17 21:27:38 +08:00
|
|
|
CALL diropn (iudrhous, 'prd', lrdrhous, exst)
|
2009-11-17 01:04:25 +08:00
|
|
|
IF (ext_recover.AND..NOT.exst) &
|
2005-06-17 21:27:38 +08:00
|
|
|
CALL errore ('openfilq','file '//trim(prefix)//'.prd not found', 1)
|
2004-09-28 16:50:35 +08:00
|
|
|
ENDIF
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2005-03-05 01:46:02 +08:00
|
|
|
! Optional file(s) containing Delta\rho (opened and written in solve_e
|
|
|
|
! and solve_linter). Used for third-order calculations.
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2005-03-05 01:46:02 +08:00
|
|
|
iudrho = 23
|
2010-09-19 00:48:39 +08:00
|
|
|
lrdrho = 2 * nr1x * nr2x * nr3x * nspin_mag
|
2004-11-02 01:48:04 +08:00
|
|
|
!
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! Here the sequential files
|
|
|
|
!
|
|
|
|
! The igk at a given k (and k+q if q!=0)
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
iunigk = 24
|
2008-07-28 16:06:01 +08:00
|
|
|
IF (nksq > 1) CALL seqopn (iunigk, 'igk', 'unformatted', exst)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! a formatted file which contains the dynamical matrix in cartesian
|
|
|
|
! coordinates is opened in the current directory
|
2004-09-28 16:50:35 +08:00
|
|
|
|
2005-07-20 22:57:21 +08:00
|
|
|
! ... by the first node only, other nodes write on unit 6 (i.e./dev/null
|
2003-01-20 05:58:50 +08:00
|
|
|
! exception: electron-phonon calculation from saved data
|
|
|
|
! (iudyn is read, not written, by all nodes)
|
|
|
|
!
|
2004-09-28 16:50:35 +08:00
|
|
|
IF ( ( .NOT. ionode ) .AND. (.NOT.elph.OR.trans) ) THEN
|
2003-02-08 00:04:36 +08:00
|
|
|
iudyn = 6
|
2004-09-28 16:50:35 +08:00
|
|
|
GOTO 400
|
|
|
|
ENDIF
|
|
|
|
|
2010-08-03 17:26:47 +08:00
|
|
|
IF (((trans.AND.(start_irr/=0.OR.last_irr/=0)).OR.elph).AND..NOT.xmldyn) THEN
|
2003-02-08 00:04:36 +08:00
|
|
|
iudyn = 26
|
2005-06-17 21:27:38 +08:00
|
|
|
OPEN (unit=iudyn, file=fildyn, status='unknown', err=100, iostat=ios)
|
2004-09-28 16:50:35 +08:00
|
|
|
100 CALL errore ('openfilq', 'opening file'//fildyn, ABS (ios) )
|
|
|
|
REWIND (iudyn)
|
2010-08-03 17:26:47 +08:00
|
|
|
ELSE
|
|
|
|
iudyn=0
|
2004-09-28 16:50:35 +08:00
|
|
|
ENDIF
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2005-07-20 22:57:21 +08:00
|
|
|
! An optional file for electron-phonon calculations containing deltaVscf
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2004-09-28 16:50:35 +08:00
|
|
|
400 IF (fildvscf.NE.' ') THEN
|
2003-02-08 00:04:36 +08:00
|
|
|
iudvscf = 27
|
2004-11-02 01:48:04 +08:00
|
|
|
IF ( me_pool == 0 ) THEN
|
2011-05-17 17:47:47 +08:00
|
|
|
IF(dvscf_dir.NE.' ') then
|
|
|
|
CALL diropn (iudvscf, fildvscf, lrdrho, exst, dvscf_dir)
|
|
|
|
ELSE
|
|
|
|
CALL diropn (iudvscf, fildvscf, lrdrho, exst )
|
|
|
|
ENDIF
|
2010-10-12 22:46:04 +08:00
|
|
|
IF (okpaw) THEN
|
|
|
|
filint=TRIM(fildvscf)//'_paw'
|
|
|
|
lint3paw = 2 * nhm * nhm * 3 * nat * nspin_mag
|
|
|
|
iuint3paw=34
|
2011-05-17 17:47:47 +08:00
|
|
|
IF(dvscf_dir.NE.' ') then
|
|
|
|
CALL diropn (iuint3paw, filint, lint3paw, exst, dvscf_dir)
|
|
|
|
ELSE
|
|
|
|
CALL diropn (iuint3paw, filint, lint3paw, exst)
|
|
|
|
ENDIF
|
2010-10-12 22:46:04 +08:00
|
|
|
ENDIF
|
2004-11-02 01:48:04 +08:00
|
|
|
END IF
|
2004-09-28 16:50:35 +08:00
|
|
|
END IF
|
2003-10-16 22:39:25 +08:00
|
|
|
!
|
|
|
|
! In the USPP case we need two files for the Commutator, the first is
|
|
|
|
! given by filbar and a second which just contains P_c x |psi>,
|
|
|
|
! which is required for the calculation of the Born effective carges
|
|
|
|
!
|
2004-09-28 16:50:35 +08:00
|
|
|
IF (okvan .AND. (epsil .OR. zue)) THEN
|
2003-10-16 22:39:25 +08:00
|
|
|
iucom = 28
|
2007-02-08 21:07:07 +08:00
|
|
|
lrcom = 2 * nbnd * npwx * npol
|
2005-06-17 21:27:38 +08:00
|
|
|
CALL diropn (iucom, 'com', lrcom, exst)
|
2009-11-17 01:04:25 +08:00
|
|
|
IF (ext_recover.AND..NOT.exst) &
|
2005-06-17 21:27:38 +08:00
|
|
|
CALL errore ('openfilq', 'file '//trim(prefix)//'.com not found', 1)
|
2003-10-24 23:57:43 +08:00
|
|
|
!
|
2010-08-28 21:48:36 +08:00
|
|
|
! In the USPP case we also need a file in order to store derivatives
|
2005-03-05 01:46:02 +08:00
|
|
|
! of kb projectors
|
2010-08-28 21:48:36 +08:00
|
|
|
!
|
2003-10-24 23:57:43 +08:00
|
|
|
iudvkb3 = 29
|
2007-10-09 00:17:11 +08:00
|
|
|
lrdvkb3 = 2 * npwx * nkb * 3
|
2005-06-17 21:27:38 +08:00
|
|
|
CALL diropn (iudvkb3, 'dvkb3', lrdvkb3, exst)
|
2009-11-17 01:04:25 +08:00
|
|
|
IF (ext_recover.AND..NOT.exst) &
|
2005-06-17 21:27:38 +08:00
|
|
|
CALL errore ('openfilq', 'file '//trim(prefix)//'.dvkb3 not found', 1)
|
2004-09-28 16:50:35 +08:00
|
|
|
ENDIF
|
|
|
|
IF (epsil .OR. zue) THEN
|
2003-10-24 23:57:43 +08:00
|
|
|
iuebar = 30
|
2007-02-08 21:07:07 +08:00
|
|
|
lrebar = 2 * nbnd * npwx * npol
|
2005-06-17 21:27:38 +08:00
|
|
|
CALL diropn (iuebar, 'ebar', lrebar, exst)
|
2009-11-17 01:04:25 +08:00
|
|
|
IF (ext_recover.AND..NOT.exst) &
|
2005-06-17 21:27:38 +08:00
|
|
|
CALL errore ('openfilq','file '//trim(prefix)//'.ebar not found', 1)
|
2004-09-28 16:50:35 +08:00
|
|
|
ENDIF
|
|
|
|
!
|
2005-03-05 01:46:02 +08:00
|
|
|
! files used by raman calculation
|
|
|
|
!
|
|
|
|
IF (lraman .OR.elop) THEN
|
|
|
|
iuchf = 31
|
2007-02-08 21:07:07 +08:00
|
|
|
lrchf = 2 * nbnd * npwx * npol
|
2005-06-17 21:27:38 +08:00
|
|
|
CALL diropn (iuchf, 'cwf', lrchf, exst)
|
2005-03-05 01:46:02 +08:00
|
|
|
|
|
|
|
iud2w = 32
|
2007-02-08 21:07:07 +08:00
|
|
|
lrd2w = 2 * nbnd * npwx * npol
|
2005-06-17 21:27:38 +08:00
|
|
|
CALL diropn (iud2w, 'd2w', lrd2w, exst)
|
2005-03-05 01:46:02 +08:00
|
|
|
|
|
|
|
iuba2 = 33
|
2007-02-08 21:07:07 +08:00
|
|
|
lrba2 = 2 * nbnd * npwx * npol
|
2005-06-17 21:27:38 +08:00
|
|
|
CALL diropn(iuba2, 'ba2', lrba2, exst)
|
2005-03-05 01:46:02 +08:00
|
|
|
ENDIF
|
|
|
|
|
2004-09-28 16:50:35 +08:00
|
|
|
RETURN
|
|
|
|
!
|
|
|
|
END SUBROUTINE openfilq
|