2003-01-20 05:58:50 +08:00
|
|
|
!
|
2003-10-03 19:17:13 +08:00
|
|
|
! Copyright (C) 2001-2003 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-11-03 21:49:16 +08:00
|
|
|
#include "f_defs.h"
|
2003-10-03 19:17:13 +08:00
|
|
|
!
|
|
|
|
!-----------------------------------------------------------------------
|
2004-11-03 21:49:16 +08:00
|
|
|
PROGRAM postproc
|
2003-10-03 19:17:13 +08:00
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! This program reads the output file produced by pw.x
|
|
|
|
! extracts and calculates the desired quantity (rho, V, ...)
|
|
|
|
! writes it to a file for further processing or plotting
|
|
|
|
!
|
|
|
|
! DESCRIPTION of the INPUT: see file pwdocs/INPUT_PP
|
|
|
|
!
|
2004-11-03 21:49:16 +08:00
|
|
|
USE kinds, ONLY : DP
|
|
|
|
USE cell_base, ONLY : bg
|
|
|
|
USE ions_base, ONLY : nat, ntyp=>nsp, ityp, tau
|
2004-05-08 18:24:24 +08:00
|
|
|
USE gvect
|
2004-11-03 21:49:16 +08:00
|
|
|
USE ener, ONLY : ef
|
|
|
|
USE vlocal, ONLY : strf
|
|
|
|
USE io_files, ONLY : tmp_dir, nd_nmbr, prefix
|
|
|
|
USE io_global, ONLY : ionode, ionode_id
|
|
|
|
USE mp, ONLY : mp_bcast
|
2003-10-03 19:17:13 +08:00
|
|
|
|
2004-11-03 21:49:16 +08:00
|
|
|
IMPLICIT NONE
|
|
|
|
CHARACTER(len=256) :: filplot
|
2003-10-03 19:17:13 +08:00
|
|
|
|
2004-11-03 21:49:16 +08:00
|
|
|
INTEGER :: plot_num, kpoint, kband, spin_component, ios
|
|
|
|
LOGICAL :: stm_wfc_matching, lsign
|
|
|
|
|
|
|
|
REAL(kind=DP) :: emin, emax, sample_bias, z, dz
|
2003-10-03 19:17:13 +08:00
|
|
|
! directory for temporary files
|
2004-11-03 21:49:16 +08:00
|
|
|
CHARACTER(len=256) :: outdir
|
2003-10-03 19:17:13 +08:00
|
|
|
|
2004-11-03 21:49:16 +08:00
|
|
|
NAMELIST / inputpp / outdir, prefix, plot_num, stm_wfc_matching, &
|
2003-10-03 19:17:13 +08:00
|
|
|
sample_bias, spin_component, z, dz, emin, emax, kpoint, kband,&
|
|
|
|
filplot, lsign
|
2004-05-28 00:12:42 +08:00
|
|
|
|
2004-10-26 17:32:48 +08:00
|
|
|
CHARACTER (LEN=256) :: input_file
|
2004-11-03 21:49:16 +08:00
|
|
|
INTEGER :: nargs, iiarg, ierr, ILEN
|
2004-05-28 18:29:52 +08:00
|
|
|
INTEGER, EXTERNAL :: iargc
|
2004-05-28 00:12:42 +08:00
|
|
|
|
2003-10-03 19:17:13 +08:00
|
|
|
!
|
2004-11-03 21:49:16 +08:00
|
|
|
CALL start_postproc (nd_nmbr)
|
2003-10-03 19:17:13 +08:00
|
|
|
!
|
|
|
|
! set default values for variables in namelist
|
|
|
|
!
|
|
|
|
prefix = 'pwscf'
|
|
|
|
outdir = './'
|
|
|
|
filplot = 'pp.out'
|
|
|
|
plot_num = 0
|
|
|
|
spin_component = 0
|
|
|
|
sample_bias = 0.01d0
|
|
|
|
z = 1.d0
|
|
|
|
dz = 0.05d0
|
2004-11-03 21:49:16 +08:00
|
|
|
stm_wfc_matching = .TRUE.
|
|
|
|
lsign=.FALSE.
|
2003-10-03 19:17:13 +08:00
|
|
|
emin = - 999.0d0
|
|
|
|
emax = ef*13.6058d0
|
2004-05-28 00:12:42 +08:00
|
|
|
|
2004-11-03 21:49:16 +08:00
|
|
|
IF ( ionode ) THEN
|
|
|
|
!
|
|
|
|
! ... Input from file ?
|
2004-05-28 00:12:42 +08:00
|
|
|
!
|
2004-11-03 21:49:16 +08:00
|
|
|
nargs = iargc()
|
|
|
|
!
|
|
|
|
DO iiarg = 1, ( nargs - 1 )
|
2004-05-28 00:12:42 +08:00
|
|
|
!
|
2004-11-03 21:49:16 +08:00
|
|
|
CALL getarg( iiarg, input_file )
|
|
|
|
IF ( TRIM( input_file ) == '-input' .OR. &
|
|
|
|
TRIM( input_file ) == '-inp' .OR. &
|
|
|
|
TRIM( input_file ) == '-in' ) THEN
|
|
|
|
!
|
|
|
|
CALL getarg( ( iiarg + 1 ) , input_file )
|
|
|
|
OPEN ( UNIT = 5, FILE = input_file, FORM = 'FORMATTED', &
|
|
|
|
STATUS = 'OLD', IOSTAT = ierr )
|
|
|
|
CALL errore( 'iosys', 'input file ' // TRIM( input_file ) // &
|
|
|
|
& ' not found' , ierr )
|
|
|
|
!
|
|
|
|
END IF
|
2004-05-28 00:12:42 +08:00
|
|
|
!
|
2004-11-03 21:49:16 +08:00
|
|
|
END DO
|
2004-05-28 00:12:42 +08:00
|
|
|
!
|
2004-11-03 21:49:16 +08:00
|
|
|
! reading the namelist inputpp
|
|
|
|
!
|
|
|
|
READ (5, inputpp, err = 200, iostat = ios)
|
|
|
|
200 CALL errore ('postproc', 'reading inputpp namelist', ABS (ios) )
|
|
|
|
tmp_dir = TRIM(outdir)
|
|
|
|
!
|
|
|
|
END IF
|
2003-10-03 19:17:13 +08:00
|
|
|
!
|
|
|
|
! ... Broadcast variables
|
|
|
|
!
|
|
|
|
CALL mp_bcast( tmp_dir, ionode_id )
|
|
|
|
CALL mp_bcast( prefix, ionode_id )
|
|
|
|
CALL mp_bcast( plot_num, ionode_id )
|
|
|
|
CALL mp_bcast( stm_wfc_matching, ionode_id )
|
|
|
|
CALL mp_bcast( sample_bias, ionode_id )
|
|
|
|
CALL mp_bcast( spin_component, ionode_id )
|
|
|
|
CALL mp_bcast( z, ionode_id )
|
|
|
|
CALL mp_bcast( dz, ionode_id )
|
|
|
|
CALL mp_bcast( emin, ionode_id )
|
|
|
|
CALL mp_bcast( emax, ionode_id )
|
|
|
|
CALL mp_bcast( kband, ionode_id )
|
|
|
|
CALL mp_bcast( kpoint, ionode_id )
|
|
|
|
CALL mp_bcast( filplot, ionode_id )
|
|
|
|
CALL mp_bcast( lsign, ionode_id )
|
2004-11-03 21:49:16 +08:00
|
|
|
!
|
2003-10-03 19:17:13 +08:00
|
|
|
! Check of namelist variables
|
|
|
|
!
|
2004-11-03 21:49:16 +08:00
|
|
|
IF (plot_num < 0 .OR. plot_num > 13) CALL errore ('postproc', &
|
|
|
|
'Wrong plot_num', ABS (plot_num) )
|
2003-10-03 19:17:13 +08:00
|
|
|
|
2004-11-03 21:49:16 +08:00
|
|
|
IF ( (plot_num == 0 .OR. plot_num == 1) .AND. &
|
|
|
|
(spin_component < 0 .OR. spin_component > 2) ) CALL errore &
|
2003-10-03 19:17:13 +08:00
|
|
|
('postproc', 'wrong value of spin_component', 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2004-11-03 21:49:16 +08:00
|
|
|
IF ( (plot_num == 13) .AND. &
|
|
|
|
(spin_component < 0 .OR. spin_component > 3) ) CALL errore &
|
2004-06-14 23:22:24 +08:00
|
|
|
('postproc', 'wrong spin_component', 1)
|
|
|
|
|
|
|
|
|
2004-11-03 21:49:16 +08:00
|
|
|
IF (plot_num == 10) THEN
|
2003-10-03 19:17:13 +08:00
|
|
|
emin = emin / 13.6058d0
|
|
|
|
emax = emax / 13.6058d0
|
2004-11-03 21:49:16 +08:00
|
|
|
END IF
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-10-03 19:17:13 +08:00
|
|
|
!
|
|
|
|
! 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 struc_fact (nat, tau, ntyp, ityp, ngm, g, bg, nr1, nr2, nr3, &
|
2003-10-03 19:17:13 +08:00
|
|
|
strf, eigts1, eigts2, eigts3)
|
2004-11-03 21:49:16 +08:00
|
|
|
CALL init_us_1
|
2003-10-03 19:17:13 +08:00
|
|
|
!
|
|
|
|
! Now do whatever you want
|
|
|
|
!
|
2004-11-03 21:49:16 +08:00
|
|
|
CALL punch_plot (filplot, plot_num, sample_bias, z, dz, &
|
2003-10-03 19:17:13 +08:00
|
|
|
stm_wfc_matching, emin, emax, kpoint, kband, spin_component, lsign)
|
|
|
|
!
|
2004-11-03 21:49:16 +08:00
|
|
|
CALL stop_pp
|
|
|
|
STOP
|
|
|
|
END PROGRAM postproc
|