2005-03-21 21:43:38 +08:00
|
|
|
!
|
2007-10-16 00:33:28 +08:00
|
|
|
! Copyright (C) 2001-2007 Quantum-Espresso group
|
2005-03-21 21:43:38 +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-10-07 21:31:54 +08:00
|
|
|
!
|
|
|
|
!-----------------------------------------------------------------------
|
2004-11-03 21:49:16 +08:00
|
|
|
PROGRAM initial_state
|
2004-10-07 21:31:54 +08:00
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! compute forces on atoms as a post-process
|
|
|
|
!
|
|
|
|
! input: namelist "&inputpp", with variables
|
|
|
|
! prefix prefix of input files saved by program pwscf
|
|
|
|
! outdir temporary directory where files resides
|
|
|
|
!
|
2004-11-03 21:49:16 +08:00
|
|
|
USE io_global, ONLY : stdout, ionode, ionode_id
|
2004-10-07 21:31:54 +08:00
|
|
|
USE kinds, ONLY : DP
|
2006-02-02 01:56:16 +08:00
|
|
|
USE io_files, ONLY : nd_nmbr, prefix, tmp_dir, iunwfc, nwordwfc, trimcheck
|
2004-10-07 21:31:54 +08:00
|
|
|
USE ions_base, ONLY : nat
|
|
|
|
USE klist, ONLY : nks, xk
|
|
|
|
USE wvfct, ONLY : npw, igk
|
|
|
|
USE uspp, ONLY : nkb, vkb
|
|
|
|
USE wavefunctions_module, ONLY : evc
|
|
|
|
USE parameters, ONLY : ntypx
|
2004-11-03 21:49:16 +08:00
|
|
|
USE mp, ONLY : mp_bcast
|
|
|
|
!
|
|
|
|
IMPLICIT NONE
|
|
|
|
CHARACTER(len=256) :: outdir
|
|
|
|
INTEGER :: ios, ik, excite(ntypx)
|
|
|
|
NAMELIST / inputpp / outdir, prefix, excite
|
2004-10-07 21:31:54 +08:00
|
|
|
!
|
2004-11-03 21:49:16 +08:00
|
|
|
CALL start_postproc (nd_nmbr)
|
2004-10-07 21:31:54 +08:00
|
|
|
!
|
|
|
|
! set default values for variables in namelist
|
|
|
|
!
|
|
|
|
excite(:) = 0
|
|
|
|
prefix = 'pwscf'
|
2006-10-11 22:42:42 +08:00
|
|
|
CALL get_env( 'ESPRESSO_TMPDIR', outdir )
|
2006-08-09 02:05:16 +08:00
|
|
|
IF ( TRIM( outdir ) == ' ' ) outdir = './'
|
2004-10-07 21:31:54 +08:00
|
|
|
!
|
2007-10-16 00:33:28 +08:00
|
|
|
ios = 0
|
|
|
|
!
|
2004-11-03 21:49:16 +08:00
|
|
|
IF ( ionode ) THEN
|
|
|
|
!
|
2007-10-16 00:33:28 +08:00
|
|
|
READ (5, inputpp, iostat = ios)
|
2004-11-03 21:49:16 +08:00
|
|
|
!
|
2006-02-01 01:22:28 +08:00
|
|
|
tmp_dir = trimcheck (outdir)
|
2004-11-03 21:49:16 +08:00
|
|
|
!
|
|
|
|
END IF
|
2004-10-07 21:31:54 +08:00
|
|
|
!
|
2007-10-16 00:33:28 +08:00
|
|
|
CALL mp_bcast ( ios, ionode_id )
|
|
|
|
!
|
|
|
|
IF ( ios /= 0) &
|
|
|
|
CALL errore ('postforces', 'reading inputpp namelist', ABS (ios) )
|
|
|
|
!
|
2004-10-07 21:31:54 +08:00
|
|
|
! ... Broadcast variables
|
|
|
|
!
|
|
|
|
CALL mp_bcast( tmp_dir, ionode_id )
|
|
|
|
CALL mp_bcast( prefix, ionode_id )
|
|
|
|
CALL mp_bcast( excite, ionode_id )
|
|
|
|
!
|
|
|
|
! Now allocate space for pwscf variables, read and check them.
|
|
|
|
!
|
2004-11-03 21:49:16 +08:00
|
|
|
CALL read_file
|
|
|
|
CALL openfil_pp
|
|
|
|
CALL hinit0
|
|
|
|
CALL hinit1
|
2004-10-07 21:31:54 +08:00
|
|
|
IF ( nks == 1 ) THEN
|
|
|
|
ik = 1
|
|
|
|
CALL davcio( evc, nwordwfc, iunwfc, ik, -1 )
|
|
|
|
IF ( nkb > 0 ) CALL init_us_2( npw, igk, xk(1,ik), vkb )
|
|
|
|
END IF
|
2004-11-03 21:49:16 +08:00
|
|
|
CALL sum_band
|
2004-10-07 21:31:54 +08:00
|
|
|
!
|
2004-11-03 21:49:16 +08:00
|
|
|
CALL do_initial_state (excite)
|
2004-10-07 21:31:54 +08:00
|
|
|
!
|
2004-11-03 21:49:16 +08:00
|
|
|
CALL stop_pp
|
2004-10-07 21:31:54 +08:00
|
|
|
!
|
2004-11-03 21:49:16 +08:00
|
|
|
END PROGRAM initial_state
|