open_input_file modified to automatically detect xml. There is no nedd

for arg -xmlinput now.
all routines calling find_free_unit or trimcheck have been
modified. 


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@7926 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
marsamos 2011-07-04 15:27:16 +00:00
parent 9566f7a717
commit f83cfca2a0
42 changed files with 272 additions and 178 deletions

View File

@ -24,6 +24,8 @@ MODULE input
!
LOGICAL :: has_been_read = .FALSE.
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
CONTAINS
!
!-------------------------------------------------------------------------
@ -46,7 +48,7 @@ MODULE input
!
CHARACTER(LEN=2) :: prog
CHARACTER(LEN=iotk_attlenx) :: attr
LOGICAL :: xmlinput
LOGICAL :: lxmlinput
!
!
prog = 'CP'
@ -56,13 +58,13 @@ MODULE input
!
CALL xml_input_dump()
!
CALL open_input_file( xmlinput, attr)
CALL open_input_file( lxmlinput, attr)
!
END IF
!
CALL mp_bcast( xmlinput, meta_ionode_id )
CALL mp_bcast( lxmlinput, meta_ionode_id )
!
IF ( xmlinput ) THEN
IF ( lxmlinput ) THEN
!
CALL read_xml ( 'CP', attr )
!
@ -77,7 +79,7 @@ MODULE input
CALL read_cards ( prog )
!
END IF
IF ( meta_ionode) CALL close_input_file( xmlinput )
IF ( meta_ionode) CALL close_input_file( lxmlinput )
lneb = ( TRIM( calculation ) == 'neb' )
!
@ -108,7 +110,7 @@ MODULE input
pseudo_dir_ => pseudo_dir, &
outdir_ => outdir, &
prefix_ => prefix, &
tmp_dir, trimcheck
tmp_dir
USE ions_base, ONLY : nsp_ => nsp, nat_ => nat
!
IMPLICIT NONE

View File

@ -20,12 +20,14 @@ SUBROUTINE d3_readin()
USE phcom
USE d3com
USE noncollin_module, ONLY : noncolin
USE io_files, ONLY : tmp_dir, prefix, trimcheck
USE io_files, ONLY : tmp_dir, prefix
USE io_global, ONLY : ionode, ionode_id
USE mp, ONLY : mp_bcast
!
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
INTEGER :: ios, ipol, iter, na, it, ii
! counters
CHARACTER(len=256) :: outdir

View File

@ -44,7 +44,7 @@ SUBROUTINE phq_readin()
USE partial, ONLY : atomo, nat_todo
USE output, ONLY : fildyn, fildvscf, fildrho
USE disp, ONLY : nq1, nq2, nq3
USE io_files, ONLY : tmp_dir, prefix, trimcheck
USE io_files, ONLY : tmp_dir, prefix
USE noncollin_module, ONLY : i_cons, noncolin
USE ldaU, ONLY : lda_plus_u
USE control_flags, ONLY : iverbosity, modenum
@ -62,6 +62,8 @@ SUBROUTINE phq_readin()
!
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
INTEGER :: ios, ipol, iter, na, it
! integer variable for I/O control
! counter on polarizations

View File

@ -53,7 +53,7 @@ program pp_punch
use grid_dimensions, ONLY : nrxx
USE constants, ONLY : rytoev
use io_global, ONLY : stdout, ionode, ionode_id
use io_files, ONLY : psfile, pseudo_dir, trimcheck
use io_files, ONLY : psfile, pseudo_dir
use io_files, ONLY : prefix, tmp_dir, outdir
use ions_base, ONLY : ntype => nsp
use iotk_module
@ -141,6 +141,9 @@ program pp_punch
!
implicit none
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
integer :: i, kunittmp, ios
character(len=200) :: pp_file

View File

@ -15,12 +15,15 @@ SUBROUTINE cg_readin()
USE cgcom
USE control_flags, ONLY : gamma_only
USE uspp, ONLY : okvan
USE io_files, ONLY : tmp_dir, prefix, trimcheck
USE io_files, ONLY : tmp_dir, prefix
USE io_global, ONLY : ionode, ionode_id
USE noncollin_module, ONLY : noncolin
USE mp, ONLY : mp_bcast
!
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
INTEGER :: iunit =5
CHARACTER(len=256) :: outdir
NAMELIST /inputph/ prefix, fildyn, trans, epsil, raman, nmodes, &

View File

@ -88,69 +88,9 @@ MODULE io_files
INTEGER :: iunwf = 114
INTEGER :: nwordwpp = 2
INTEGER :: nwordwf = 2
!
INTEGER, EXTERNAL :: find_free_unit
CONTAINS
!
!-----------------------------------------------------------------------
FUNCTION trimcheck ( directory )
!-----------------------------------------------------------------------
!
! ... verify if directory ends with /, add one if needed;
! ... trim white spaces and put the result in trimcheck
!
IMPLICIT NONE
!
CHARACTER (LEN=*), INTENT(IN) :: directory
CHARACTER (LEN=256) :: trimcheck
INTEGER :: l
!
l = LEN_TRIM( directory )
IF ( l == 0 ) CALL errore( 'trimcheck', ' input name empty', 1)
!
IF ( directory(l:l) == '/' ) THEN
trimcheck = TRIM ( directory)
ELSE
IF ( l < LEN( trimcheck ) ) THEN
trimcheck = TRIM ( directory ) // '/'
ELSE
CALL errore( 'trimcheck', ' input name too long', l )
END IF
END IF
!
RETURN
!
END FUNCTION trimcheck
!
!--------------------------------------------------------------------------
FUNCTION find_free_unit()
!--------------------------------------------------------------------------
!
IMPLICIT NONE
!
INTEGER :: find_free_unit
INTEGER :: iunit
LOGICAL :: opnd
!
!
unit_loop: DO iunit = 99, 1, -1
!
INQUIRE( UNIT = iunit, OPENED = opnd )
!
IF ( .NOT. opnd ) THEN
!
find_free_unit = iunit
!
RETURN
!
END IF
!
END DO unit_loop
!
CALL errore( 'find_free_unit()', 'free unit not found ?!?', 1 )
!
RETURN
!
END FUNCTION find_free_unit
!
!--------------------------------------------------------------------------
SUBROUTINE delete_if_present( filename, in_warning )

View File

@ -31,7 +31,7 @@ MODULE kernel_table
!! kernel_table rather than passing variables around all over the place.
USE kinds, ONLY : dp
USE io_files, ONLY : find_free_unit, pseudo_dir
USE io_files, ONLY : pseudo_dir
USE constants, ONLY : pi
use wrappers, ONLY : md5_from_file
implicit none
@ -72,6 +72,7 @@ MODULE kernel_table
CHARACTER(LEN=30) :: double_format = "(1p4e23.14)"
CHARACTER(len=32) :: vdw_kernel_md5_cksum = 'NOT SET'
!
INTEGER, EXTERNAL :: find_free_unit
! --------------------------------------------------------------------------
CONTAINS
@ -87,8 +88,6 @@ CONTAINS
subroutine initialize_kernel_table()
USE io_files, ONLY : find_free_unit
integer :: q1_i, q2_i !! Indexing variables
integer :: kernel_file !! The unit number for the kernel file

View File

@ -7,13 +7,13 @@
!
!
!----------------------------------------------------------------------------
SUBROUTINE open_input_file_x(xmlinput,attr,unit)
SUBROUTINE open_input_file_x(lxmlinput,attr,unit)
!-----------------------------------------------------------------------------
!
! ... this subroutine opens the input file standard input ( unit 5 )
! ... Use "-input filename" to read input from file "filename":
! ... may be useful if you have trouble reading from standard input
! ... or xml input
! ... or xml input. xml input can be opened on a different unit than 5.
! ... ---------------------------------------------------------------
!
USE kinds, ONLY : DP
@ -24,76 +24,147 @@ SUBROUTINE open_input_file_x(xmlinput,attr,unit)
!
IMPLICIT NONE
!
LOGICAL, intent(inout), optional :: xmlinput
INTEGER, EXTERNAL :: find_free_unit
!
LOGICAL, intent(inout), optional :: lxmlinput
CHARACTER (len=*), intent(inout), optional :: attr
INTEGER, intent(in), optional :: unit
!
LOGICAL :: xmlinput_loc,checkxml
LOGICAL :: lxmlinput_loc,lcheckxml
INTEGER :: unit_loc
!
INTEGER :: iiarg, nargs, iargc, ierr
CHARACTER (len=50) :: arg
!
INTEGER :: stderr=6, stdin=5
CHARACTER(LEN=256) :: dummy, input_file, temp_file
INTEGER :: stdtmp
LOGICAL :: lfound
!
#if defined(__ABSOFT)
# define getarg getarg_
# define iargc iargc_
#endif
!
xmlinput_loc = .false.
lxmlinput_loc = .false.
unit_loc = 5
checkxml = .false.
lcheckxml = .false.
!
IF(present(attr).and.(.not.present(xmlinput))) THEN
IF(present(attr).and.(.not.present(lxmlinput))) THEN
!
CALL errore('open_input_file', 'xmlinput not present in routine call')
!
ELSEIF(present(xmlinput).and.(.not.present(attr))) THEN
ELSEIF(present(lxmlinput).and.(.not.present(attr))) THEN
!
CALL errore('open_input_file', 'attr not present in routine call')
!
ENDIF
!
IF (present(attr).and.(present(xmlinput))) checkxml = .true.
IF (present(attr).and.(present(lxmlinput))) lcheckxml = .true.
!
IF(PRESENT(unit)) unit_loc = unit
!
xmlinputunit = unit_loc
!
! ... check if use xml input or not
!
xmlinput_loc = .false.
lxmlinput_loc = .false.
!
!
! ... Input from file ?
!
temp_file="input_tmp.in"
!
lfound=.false.
stdtmp = find_free_unit()
OPEN(UNIT = stdtmp, FILE = trim(temp_file))
!
nargs = iargc()
!
IF (checkxml) THEN
DO iiarg = 1, ( nargs - 1 )
!
CALL getarg( iiarg, arg )
!
IF ( trim( arg ) == '-xmlinput') THEN
CALL getarg( ( iiarg + 1 ) , arg )
xmlinput_loc = .true.
WRITE(stdout, '(5x,a)') "Waiting for xml input..."
CALL iotk_open_read( unit_loc, arg, attr = attr, qe_syntax = .true., ierr = ierr)
IF (ierr /= 0) CALL errore('open_input_file','error opening xml file', abs(ierr))
EXIT
ENDIF
!
ENDDO
ierr = -1
!
DO iiarg = 1, ( nargs - 1 )
!
xmlinput = xmlinput_loc
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 = unit_loc, FILE = input_file, FORM = 'FORMATTED', &
STATUS = 'OLD', IOSTAT = ierr )
! starting copy file
if(ierr==0) then
dummy=""
do while (TRIM(dummy).ne."MAGICALME")
read(unit_loc,fmt='(A256)',END=10) dummy
write(stdtmp,*) trim(dummy)
enddo
10 CONTINUE
endif
!
! TODO: return error code ierr (-1 no file, 0 file opened, > 1 error)
! do not call "errore" here: it may hang in parallel execution
! if this routine ois called by ionode only
!
IF ( ierr > 0 ) WRITE (stderr, &
'(" *** input file ",A," not found ***")' ) TRIM( input_file )
!
lfound=.true.
!
END IF
!
END DO
!
if(lfound) CLOSE(unit_loc)
!
if(.not.lfound) then
! if no file specified then copy from standard input
dummy=""
do while (TRIM(dummy).ne."MAGICALME")
read(stdin,fmt='(A256)',END=20) dummy
write(stdtmp,*) trim(dummy)
enddo
endif
!
!
20 CONTINUE
!
CLOSE(stdtmp)
OPEN ( UNIT = unit_loc, FILE = trim(temp_file) , FORM = 'FORMATTED', &
STATUS = 'OLD', IOSTAT = ierr )
!
!
IF (lcheckxml) THEN
!
CALL test_input_xml(unit_loc,lxmlinput_loc)
!
lxmlinput = lxmlinput_loc
!
IF(lxmlinput_loc) then
CLOSE(unit_loc)
WRITE(stdout, '(5x,a)') "Waiting for xml input..."
CALL iotk_open_read( unit_loc, "input_tmp.in", attr = attr, qe_syntax = .true., ierr = ierr)
IF (ierr /= 0) CALL errore('open_input_file','error opening xml file', abs(ierr))
ENDIF
!
ENDIF
!
IF (.not.xmlinput_loc) THEN
CALL input_from_file(unit_loc)
WRITE(stdout, '(5x,a)') "Waiting for input..."
IF(.not.lxmlinput_loc) THEN
CLOSE(unit_loc)
OPEN ( UNIT = unit_loc, FILE = "input_tmp.in" , FORM = 'FORMATTED', &
STATUS = 'OLD', IOSTAT = ierr )
WRITE(stdout, '(5x,a)') "Waiting for input..."
ENDIF
!
RETURN
!
END SUBROUTINE open_input_file_x
SUBROUTINE close_input_file_x(xmlinput,unit)
SUBROUTINE close_input_file_x(lxmlinput,unit)
!
! ... this subroutine close the input file for the specified unit
! ... ( default is unit 5 )
@ -107,21 +178,21 @@ SUBROUTINE close_input_file_x(xmlinput,unit)
!
IMPLICIT NONE
!
LOGICAL, intent(inout), optional :: xmlinput
LOGICAL, intent(inout), optional :: lxmlinput
INTEGER, intent(in), optional :: unit
!
LOGICAL :: xmlinput_loc
LOGICAL :: lxmlinput_loc
LOGICAL :: opened
INTEGER :: unit_loc, ierr
!
!
unit_loc = 5
xmlinput_loc = .false.
lxmlinput_loc = .false.
!
IF (present(xmlinput)) xmlinput_loc = xmlinput
IF (present(lxmlinput)) lxmlinput_loc = lxmlinput
IF(present(unit)) unit_loc = unit
!
IF (xmlinput_loc) THEN
IF (lxmlinput_loc) THEN
!
CALL iotk_close_read(unit=unit_loc, ierr = ierr)
IF (ierr /= 0) CALL errore('close_input_file','error closing xml file', abs(ierr) )

View File

@ -23,7 +23,7 @@ MODULE open_close_input_file_interf
!
!
INTERFACE open_input_file
SUBROUTINE open_input_file_x(xmlinput,attr,unit)
SUBROUTINE open_input_file_x(lxmlinput,attr,unit)
!
! ... this subroutine opens the input file standard input ( unit 5 )
! ... Use "-input filename" to read input from file "filename":
@ -39,7 +39,7 @@ MODULE open_close_input_file_interf
!
IMPLICIT NONE
!
LOGICAL, intent(inout), optional :: xmlinput
LOGICAL, intent(inout), optional :: lxmlinput
CHARACTER (len=iotk_attlenx), intent(inout), optional :: attr
INTEGER, intent(in), optional :: unit
!
@ -48,7 +48,7 @@ END INTERFACE
!
!
INTERFACE close_input_file
SUBROUTINE close_input_file_x(xmlinput,unit)
SUBROUTINE close_input_file_x(lxmlinput,unit)
!
! ... this subroutine close the input file for the specified unit
! ... ( default is unit 5 )
@ -62,7 +62,7 @@ SUBROUTINE close_input_file_x(xmlinput,unit)
!
IMPLICIT NONE
!
LOGICAL, intent(inout), optional :: xmlinput
LOGICAL, intent(inout), optional :: lxmlinput
INTEGER, intent(in), optional :: unit
!
END SUBROUTINE close_input_file_x

View File

@ -36,8 +36,7 @@ path_to_engine_fix_atom_pos.o \
path_to_engine_mp.o \
path_variables.o \
set_defaults.o \
stop_run_path.o \
test_input_file.o
stop_run_path.o
QEMODS=../Modules/libqemod.a
PWOBJS= ../PW/libpw.a

View File

@ -12,7 +12,6 @@ PROGRAM neb
! ... Nudged Elastic Band / Strings Method algorithm
!
USE io_global, ONLY : meta_ionode_id, xmlinputunit
USE io_files, ONLY : find_free_unit
USE parameters, ONLY : ntypx, npk, lmaxx
USE control_flags, ONLY : conv_elec, conv_ions, lpath, gamma_only
USE environment, ONLY : environment_start, environment_end

View File

@ -1,10 +1,11 @@
subroutine path_gen_inputs(parse_file_name,engine_prefix,nimage,root,comm)
!
USE io_files, only : find_free_unit
USE mp_global, only : mp_rank
implicit none
!
INTEGER, EXTERNAL :: find_free_unit
!
character(len=*), intent(in) :: parse_file_name
character(len=*), intent(in) :: engine_prefix
integer, intent(out) :: nimage

View File

@ -11,8 +11,6 @@ MODULE path_io_units_module
!
! ... this module contains the I/O units and files used by "path"-routines
!
USE io_files, ONLY : find_free_unit
!
IMPLICIT NONE
!
!
@ -38,6 +36,7 @@ MODULE path_io_units_module
INTEGER :: iuncrd = 2027 ! unit for saving coordinates in pw.x input format
INTEGER :: iunnewimage = 28 ! unit for parallelization among images
!
INTEGER, EXTERNAL :: find_free_unit
!
CONTAINS
!

View File

@ -37,7 +37,6 @@ SUBROUTINE set_engine_io_units()
!-----------------------------------------------------------------------------
!
USE io_global, ONLY : stdout, xmlinputunit, ionode
USE io_files, ONLY : find_free_unit
!
if(ionode) stdout = find_free_unit()
!

View File

@ -32,7 +32,7 @@ SUBROUTINE open_dvscf_star_q( q_index )
USE phcom
USE el_phon
USE io_global, ONLY : stdout , ionode
use io_files, only: prefix, tmp_dir, nd_nmbr, diropn, find_free_unit
use io_files, only: prefix, tmp_dir, nd_nmbr, diropn
USE io_global, ONLY : stdout, ionode, ionode_id
USE mp_global, ONLY : my_pool_id, npool, kunit, me_pool, root_pool
USE mp, ONLY : mp_barrier
@ -46,6 +46,9 @@ SUBROUTINE open_dvscf_star_q( q_index )
USE xml_io_base, ONLY : create_directory
! USE noncollin_module, ONLY : nspin
implicit none
!
INTEGER, EXTERNAL :: find_free_unit
!
integer :: q_index
!

View File

@ -47,7 +47,7 @@ SUBROUTINE phq_readin()
USE partial, ONLY : atomo, nat_todo, nat_todo_input
USE output, ONLY : fildyn, fildvscf, fildrho
USE disp, ONLY : nq1, nq2, nq3
USE io_files, ONLY : tmp_dir, prefix, trimcheck
USE io_files, ONLY : tmp_dir, prefix
USE noncollin_module, ONLY : i_cons, noncolin
USE ldaU, ONLY : lda_plus_u
USE control_flags, ONLY : iverbosity, modenum, twfcollect
@ -63,6 +63,8 @@ SUBROUTINE phq_readin()
!
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
INTEGER :: ios, ipol, iter, na, it, ierr
! integer variable for I/O control
! counter on polarizations

View File

@ -10,7 +10,7 @@
PROGRAM bands
!-----------------------------------------------------------------------
!
USE io_files, ONLY : prefix, tmp_dir, trimcheck
USE io_files, ONLY : prefix, tmp_dir
USE mp_global, ONLY : npool, nproc, nproc_pool, nproc_file, &
nproc_pool_file, mp_startup
USE control_flags, ONLY : twfcollect
@ -23,6 +23,8 @@ PROGRAM bands
!
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
CHARACTER (len=256) :: filband, filp, outdir
LOGICAL :: lsigma(4), lsym, lp, no_overlap
INTEGER :: spin_component, firstk, lastk

View File

@ -48,7 +48,7 @@ PROGRAM dos
! file, degauss=DeltaE (in Ry) and ngauss=0 will be used
!
USE io_global, ONLY : stdout, ionode, ionode_id
USE io_files, ONLY : prefix, tmp_dir, trimcheck
USE io_files, ONLY : prefix, tmp_dir
USE constants, ONLY : rytoev
USE kinds, ONLY : DP
USE klist, ONLY : xk, wk, degauss, ngauss, lgauss, nks, nkstot
@ -61,6 +61,9 @@ PROGRAM dos
USE environment, ONLY : environment_start
!
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
CHARACTER(len=256) :: fildos, outdir
REAL(DP) :: E, DOSofE (2), DOSint, Elw, Eup, DeltaE, Emin, Emax, &
degauss1

View File

@ -21,7 +21,7 @@
!
PUBLIC :: grid_build, grid_destroy
PUBLIC :: focc, wgrid, alpha
!
CONTAINS
!---------------------------------------------
@ -139,7 +139,7 @@ PROGRAM epsilon
USE mp, ONLY : mp_bcast
USE iotk_module
USE xml_io_base
USE io_files, ONLY : tmp_dir, prefix, outdir, trimcheck
USE io_files, ONLY : tmp_dir, prefix, outdir
USE constants, ONLY : RYTOEV
USE ener, ONLY : ef
USE klist, ONLY : lgauss
@ -151,6 +151,8 @@ PROGRAM epsilon
!
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
! input variables
!
INTEGER :: nw,nbndmin,nbndmax

View File

@ -17,7 +17,7 @@ PROGRAM initial_state
!
USE io_global, ONLY : stdout, ionode, ionode_id
USE kinds, ONLY : DP
USE io_files, ONLY : prefix, tmp_dir, iunwfc, nwordwfc, trimcheck
USE io_files, ONLY : prefix, tmp_dir, iunwfc, nwordwfc
USE ions_base, ONLY : nat
USE klist, ONLY : nks, xk
USE wvfct, ONLY : npw, igk
@ -29,6 +29,9 @@ PROGRAM initial_state
USE environment,ONLY : environment_start
!
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
CHARACTER(len=256) :: outdir
INTEGER :: ios, ik, excite(ntypx)
NAMELIST / inputpp / outdir, prefix, excite

View File

@ -177,19 +177,22 @@ PROGRAM PAWplot
USE cell_base, ONLY : bg
USE gvect, ONLY : ngm, nl
USE scf, ONLY : rho
USE io_files, ONLY : tmp_dir, prefix, trimcheck
USE io_files, ONLY : tmp_dir, prefix
USE noncollin_module, ONLY : noncolin
USE paw_variables, ONLY : okpaw
USE paw_postproc_, ONLY : PAW_make_ae_charge_
!
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
LOGICAL, EXTERNAL :: matches
!
CHARACTER(len=256) :: outdir, filplot
CHARACTER(len=16) :: plot
INTEGER :: spin_component, nx,ny,nz, flag, ios, is
REAL(dp) :: e1(3), e2(3), e3(3), x0(3)
REAL(dp), ALLOCATABLE :: rhoplot(:), rhopaw(:,:), r(:,:)
COMPLEX(dp), ALLOCATABLE :: rhog(:)
LOGICAL, EXTERNAL :: matches
LOGICAL :: onedim, twodim, tredim
!
NAMELIST / inputpp / outdir, prefix, spin_component, &

View File

@ -20,7 +20,7 @@ PROGRAM plan_avg
USE gvecs, ONLY : dual
USE klist, ONLY : nkstot, xk
USE ions_base, ONLY : nat, ntyp=>nsp, ityp, tau, atm, zv
USE io_files, ONLY : tmp_dir, prefix, trimcheck
USE io_files, ONLY : tmp_dir, prefix
USE io_global, ONLY : ionode, ionode_id
USE wvfct, ONLY : nbnd, ecutwfc
USE mp, ONLY : mp_bcast
@ -29,6 +29,9 @@ PROGRAM plan_avg
USE environment, ONLY : environment_start
!
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
INTEGER :: ninter
CHARACTER(len=256) :: filplot, outdir
REAL(DP), ALLOCATABLE :: averag (:,:,:), plan (:,:,:)

View File

@ -20,12 +20,15 @@ PROGRAM pmw
!
USE kinds, ONLY : DP
USE io_global, ONLY : stdout, ionode, ionode_id
USE io_files, ONLY : prefix, tmp_dir, trimcheck
USE io_files, ONLY : prefix, tmp_dir
USE mp, ONLY : mp_bcast
USE mp_global, ONLY : mp_startup
USE environment,ONLY : environment_start
!
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
CHARACTER(len=256) :: outdir
INTEGER :: ios
INTEGER :: first_band, last_band

View File

@ -26,6 +26,7 @@ PROGRAM pp
!
IMPLICIT NONE
!
CHARACTER(len=256) :: filplot
INTEGER :: plot_num
!
@ -64,7 +65,7 @@ SUBROUTINE extract (filplot,plot_num)
USE grid_dimensions, ONLY : nr1, nr2, nr3
USE klist, ONLY : two_fermi_energies
USE vlocal, ONLY : strf
USE io_files, ONLY : tmp_dir, prefix, trimcheck
USE io_files, ONLY : tmp_dir, prefix
USE io_global, ONLY : ionode, ionode_id
USE mp_global, ONLY : nproc, nproc_pool, nproc_file, nproc_pool_file
USE control_flags, ONLY : twfcollect
@ -73,6 +74,9 @@ SUBROUTINE extract (filplot,plot_num)
USE mp, ONLY : mp_bcast
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
CHARACTER(len=256), INTENT(out) :: filplot
INTEGER, INTENT(out) :: plot_num

View File

@ -128,17 +128,18 @@ PROGRAM projwfc
USE constants, ONLY : rytoev
USE kinds, ONLY : DP
USE klist, ONLY : degauss, ngauss, lgauss
USE io_files, ONLY : nd_nmbr, prefix, tmp_dir, trimcheck
USE io_files, ONLY : nd_nmbr, prefix, tmp_dir
USE noncollin_module, ONLY : noncolin
USE mp, ONLY : mp_bcast
USE mp_global, ONLY : mp_startup, nproc_ortho
USE environment, ONLY : environment_start
!
! for GWW
USE io_files, ONLY : find_free_unit
!
!
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
CHARACTER (len=256) :: filpdos, filproj, io_choice, outdir
REAL (DP) :: Emin, Emax, DeltaE, degauss1, smoothing
INTEGER :: ngauss1, ios
@ -343,7 +344,7 @@ SUBROUTINE projwave( filproj, lsym, lgww )
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: nd_nmbr, prefix, tmp_dir, nwordwfc, iunwfc, find_free_unit
USE io_files, ONLY: nd_nmbr, prefix, tmp_dir, nwordwfc, iunwfc
USE spin_orb, ONLY: lspinorb
USE wavefunctions_module, ONLY: evc
!
@ -351,6 +352,8 @@ SUBROUTINE projwave( filproj, lsym, lgww )
!
IMPLICIT NONE
!
INTEGER, EXTERNAL :: find_free_unit
!
CHARACTER (len=*) :: filproj
INTEGER :: ik, ibnd, i, j, k, na, nb, nt, isym, n, m, m1, l, nwfc,&
nwfc1, lmax_wfc, is, ios, iunproj
@ -2123,7 +2126,7 @@ SUBROUTINE pprojwave( filproj, lsym )
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: nd_nmbr, prefix, tmp_dir, nwordwfc, iunwfc, find_free_unit
USE io_files, ONLY: nd_nmbr, prefix, tmp_dir, nwordwfc, iunwfc
USE spin_orb, ONLY: lspinorb
USE mp, ONLY: mp_bcast
USE mp_global, ONLY : npool, nproc_pool, me_pool, root_pool, &
@ -2138,6 +2141,8 @@ SUBROUTINE pprojwave( filproj, lsym )
!
IMPLICIT NONE
!
INTEGER, EXTERNAL :: find_free_unit
!
COMPLEX(DP), PARAMETER :: zero = ( 0.0d0, 0.0d0 )
COMPLEX(DP), PARAMETER :: one = ( 1.0d0, 0.0d0 )

View File

@ -17,7 +17,7 @@ PROGRAM pw2gw
! This subroutine writes files containing plane wave coefficients
! and other stuff needed by GW codes
USE io_files, ONLY : prefix, outdir, tmp_dir, trimcheck
USE io_files, ONLY : prefix, outdir, tmp_dir
USE io_global, ONLY : ionode, ionode_id
USE mp, ONLY : mp_bcast
USE mp_global, ONLY : kunit, nproc, mp_startup
@ -25,6 +25,9 @@ PROGRAM pw2gw
USE us, ONLY : spline_ps
!
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
INTEGER :: ios
INTEGER :: kunittmp
LOGICAL :: use_gmaps

View File

@ -17,7 +17,7 @@ PROGRAM pw2wannier90
USE cell_base, ONLY : at, bg
USE lsda_mod, ONLY : nspin, isk
USE klist, ONLY : nkstot
USE io_files, ONLY : prefix, tmp_dir, trimcheck
USE io_files, ONLY : prefix, tmp_dir
USE noncollin_module, ONLY : noncolin
USE control_flags, ONLY : gamma_only
USE environment,ONLY : environment_start
@ -25,6 +25,9 @@ PROGRAM pw2wannier90
USE wannier
!
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
INTEGER :: ios
CHARACTER(len=4) :: spin_component
CHARACTER(len=256) :: outdir
@ -544,7 +547,6 @@ SUBROUTINE read_nnkp
USE constants, ONLY : eps6, tpi, bohr => BOHR_RADIUS_ANGS
USE cell_base, ONLY : at, bg, alat
USE gvect, ONLY : g, gg
USE io_files, ONLY : find_free_unit
USE klist, ONLY : nkstot, xk
USE mp, ONLY : mp_bcast, mp_sum
USE mp_global, ONLY : intra_pool_comm
@ -553,7 +555,9 @@ SUBROUTINE read_nnkp
USE wannier
IMPLICIT NONE
!
INTEGER, EXTERNAL :: find_free_unit
!
real(DP) :: g_(3), gg_
INTEGER :: ik, ib, ig, ipol, iw, idum, indexb
INTEGER numk, i, j
@ -828,7 +832,6 @@ SUBROUTINE compute_mmn
USE gvecs, ONLY : nls, nlsm
USE klist, ONLY : nkstot, xk
USE io_files, ONLY : nwordwfc, iunwfc
USE io_files, ONLY : find_free_unit
USE gvect, ONLY : g, ngm, gstart
USE cell_base, ONLY : tpiba2, omega, alat, tpiba, at, bg
USE ions_base, ONLY : nat, ntyp => nsp, ityp, tau
@ -844,7 +847,9 @@ SUBROUTINE compute_mmn
USE wannier
IMPLICIT NONE
!
INTEGER, EXTERNAL :: find_free_unit
!
INTEGER :: mmn_tot, ik, ikp, ipol, ib, npwq, i, m, n
INTEGER :: ikb, jkb, ih, jh, na, nt, ijkb0, ind, nbt
INTEGER :: ikevc, ikpevcq
@ -1225,7 +1230,6 @@ SUBROUTINE compute_amn
USE control_flags, ONLY : gamma_only
USE wavefunctions_module, ONLY : evc
USE io_files, ONLY : nwordwfc, iunwfc
USE io_files, ONLY : find_free_unit
USE gvect, ONLY : g, ngm, gstart
USE cell_base, ONLY : tpiba2
USE uspp, ONLY : nkb, vkb
@ -1240,7 +1244,9 @@ SUBROUTINE compute_amn
USE wvfct, ONLY : ecutwfc
IMPLICIT NONE
!
INTEGER, EXTERNAL :: find_free_unit
!
COMPLEX(DP) :: amn, zdotc
real(DP):: ddot
COMPLEX(DP), ALLOCATABLE :: sgf(:,:)
@ -1456,11 +1462,12 @@ SUBROUTINE write_band
USE wvfct, ONLY : nbnd, et
USE klist, ONLY : nkstot
USE constants, ONLY: rytoev
USE io_files, ONLY : find_free_unit
USE wannier
IMPLICIT NONE
!
INTEGER, EXTERNAL :: find_free_unit
!
INTEGER ik, ibnd, ibnd1, ikevc
IF (wan_mode=='standalone') THEN
@ -1493,7 +1500,7 @@ SUBROUTINE write_plot
USE wvfct, ONLY : nbnd, npw, igk, g2kin, ecutwfc
USE control_flags, ONLY : gamma_only
USE wavefunctions_module, ONLY : evc, psic
USE io_files, ONLY : find_free_unit, nwordwfc, iunwfc
USE io_files, ONLY : nwordwfc, iunwfc
USE wannier
USE gvecs, ONLY : nls, nlsm
USE klist, ONLY : nkstot, xk
@ -1504,6 +1511,9 @@ SUBROUTINE write_plot
USE noncollin_module,ONLY : noncolin
IMPLICIT NONE
!
INTEGER, EXTERNAL :: find_free_unit
!
INTEGER ik, ibnd, ibnd1, ikevc, i1, j, spin
CHARACTER*20 wfnname
@ -1648,7 +1658,7 @@ SUBROUTINE write_parity
USE wvfct, ONLY : nbnd, npw, igk, g2kin, ecutwfc
USE control_flags, ONLY : gamma_only
USE wavefunctions_module, ONLY : evc
USE io_files, ONLY : find_free_unit, nwordwfc, iunwfc
USE io_files, ONLY : nwordwfc, iunwfc
USE wannier
USE klist, ONLY : nkstot, xk
USE gvect, ONLY : g, ngm
@ -1656,7 +1666,9 @@ SUBROUTINE write_parity
USE constants, ONLY : eps6
IMPLICIT NONE
!
INTEGER, EXTERNAL :: find_free_unit
!
INTEGER :: ibnd,igv,kgamma,ik,i,ig_idx(32)
INTEGER,DIMENSION(nproc) :: num_G,displ

View File

@ -270,7 +270,7 @@ PROGRAM pw_export
USE pwcom
USE grid_dimensions, ONLY : nr1, nr2, nr3
USE io_global, ONLY : stdout, ionode, ionode_id
USE io_files, ONLY : psfile, pseudo_dir, trimcheck
USE io_files, ONLY : psfile, pseudo_dir
USE io_files, ONLY : prefix, tmp_dir, outdir
USE ions_base, ONLY : ntype => nsp
USE iotk_module
@ -279,6 +279,9 @@ PROGRAM pw_export
USE environment, ONLY : environment_start
!
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
INTEGER :: ik, i, kunittmp, ios
CHARACTER(len=200) :: pp_file

View File

@ -15,7 +15,7 @@ PROGRAM wannier_ham
USE io_global, ONLY: stdout, ionode, ionode_id
USE kinds, ONLY: DP
USE io_files, ONLY : prefix, tmp_dir, trimcheck
USE io_files, ONLY : prefix, tmp_dir
USE wannier_new, ONLY: nwan, use_energy_int
USE mp, ONLY : mp_bcast
USE read_cards_module, ONLY : read_cards
@ -23,6 +23,9 @@ PROGRAM wannier_ham
USE environment, ONLY : environment_start
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
CHARACTER(len=256) :: outdir
INTEGER :: ios
LOGICAL :: plot_bands, u_matrix

View File

@ -16,7 +16,7 @@ PROGRAM wannier_plot
USE io_global, ONLY: stdout, ionode, ionode_id
USE kinds, ONLY : DP
USE io_files, ONLY : prefix, tmp_dir, trimcheck
USE io_files, ONLY : prefix, tmp_dir
USE wannier_new, ONLY : nwan, plot_wan_num, plot_wan_spin
USE mp, ONLY : mp_bcast
USE io_global, ONLY : ionode, stdout
@ -24,6 +24,9 @@ PROGRAM wannier_plot
USE environment, ONLY : environment_start
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
CHARACTER(len=256) :: outdir
INTEGER :: ios,nc(3),n0(3)
NAMELIST /inputpp/ outdir, prefix, nwan, plot_wan_num, plot_wan_spin, nc, n0

View File

@ -22,6 +22,8 @@ MODULE buffers
INTEGER :: nword_
CHARACTER(LEN=80) :: extension_
!
INTEGER, EXTERNAL :: find_free_unit
!
CONTAINS
!-----------------------------------------------------------------------
SUBROUTINE open_buffer (unit, extension, nword, maxrec, exst)
@ -170,7 +172,7 @@ SUBROUTINE close_buffer ( unit, status )
! unit =-1 : deallocate buffer; if "status='keep'" save to file
! (using saved value of extension)
!
USE io_files, ONLY : find_free_unit, diropn
USE io_files, ONLY : diropn
!
IMPLICIT NONE
!
@ -225,7 +227,7 @@ SUBROUTINE init_buffer ( unit, exst, ierr )
! exst : T if the file where to read from is present
! ierr : 0 if everything ok, 1 otherwise
!
USE io_files, ONLY : find_free_unit, diropn
USE io_files, ONLY : diropn
!
IMPLICIT NONE
!

View File

@ -469,7 +469,6 @@ CONTAINS
use funct, ONLY : get_exx_fraction, start_exx, exx_is_active, &
get_screening_parameter
USE smooth_grid_dimensions,ONLY: nrxxs
USE io_files, ONLY : find_free_unit
USE io_global, ONLY : stdout
implicit none
@ -503,7 +502,7 @@ CONTAINS
!It saves all the wavefunctions in a single file called prefix.exx
!
USE wavefunctions_module, ONLY : evc
USE io_files, ONLY : find_free_unit, nwordwfc, iunwfc, iunigk, &
USE io_files, ONLY : nwordwfc, iunwfc, iunigk, &
tmp_dir, prefix
USE io_global, ONLY : stdout
USE buffers, ONLY : get_buffer

View File

@ -78,7 +78,7 @@ SUBROUTINE iosys()
eamp_ => eamp, &
forcefield
!
USE io_files, ONLY : input_drho, output_drho, trimcheck, &
USE io_files, ONLY : input_drho, output_drho, &
psfile, tmp_dir, wfc_dir, &
prefix_ => prefix, &
pseudo_dir_ => pseudo_dir
@ -314,6 +314,8 @@ SUBROUTINE iosys()
!
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
INTEGER :: ia, image, nt, inlc
REAL(DP) :: theta, phi
!

View File

@ -39,7 +39,6 @@ SUBROUTINE mix_rho( input_rhout, rhoin, alphamix, dr2, tr2_min, iter, n_iter, co
USE gvecs, ONLY : ngms
USE lsda_mod, ONLY : nspin
USE control_flags, ONLY : imix, ngm0, tr2, io_level
USE io_files, ONLY : find_free_unit
! ... for PAW:
USE uspp_param, ONLY : nhm
USE scf, ONLY : scf_type, create_scf_type, destroy_scf_type, &
@ -114,6 +113,7 @@ SUBROUTINE mix_rho( input_rhout, rhoin, alphamix, dr2, tr2_min, iter, n_iter, co
!
! ... external functions
!
INTEGER, EXTERNAL :: find_free_unit
!
CALL start_clock( 'mix_rho' )
!

View File

@ -18,7 +18,7 @@ SUBROUTINE pw2casino()
!
USE control_flags, ONLY : istep, nstep
!
USE io_files, ONLY : tmp_dir, find_free_unit
USE io_files, ONLY : tmp_dir
!
USE plugin_flags, ONLY : use_pw2casino
!
@ -28,6 +28,8 @@ SUBROUTINE pw2casino()
!
CHARACTER(len=6), EXTERNAL :: int_to_char
!
INTEGER, EXTERNAL :: find_free_unit
!
INTEGER :: tmp_unit
!
INTEGER :: ios

View File

@ -26,10 +26,12 @@ MODULE pw_restart
USE mp_global, ONLY : my_pool_id, intra_image_comm, intra_pool_comm
USE mp, ONLY : mp_bcast, mp_sum, mp_max
USE parser, ONLY : version_compare
!
!
IMPLICIT NONE
!
CHARACTER(LEN=256), external :: trimcheck
!
SAVE
!
PRIVATE
@ -1614,7 +1616,7 @@ MODULE pw_restart
!
USE ions_base, ONLY : nat, nsp, ityp, amass, atm, tau, if_pos
USE cell_base, ONLY : alat
USE io_files, ONLY : psfile, pseudo_dir, trimcheck
USE io_files, ONLY : psfile, pseudo_dir
!
IMPLICIT NONE
!

View File

@ -21,7 +21,7 @@ SUBROUTINE do_cond(done)
USE uspp, ONLY: okvan
USE symm_base, ONLY: nsym, s, t_rev, time_reversal
USE cond
USE io_files, ONLY: outdir, tmp_dir, prefix, trimcheck
USE io_files, ONLY: outdir, tmp_dir, prefix
!!! RECOVER
USE cond_restart
USE input_parameters, ONLY: max_seconds
@ -36,7 +36,9 @@ SUBROUTINE do_cond(done)
USE environment, ONLY : environment_start
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
LOGICAL, INTENT(OUT) :: done
!
REAL(DP) :: wtot, tk

View File

@ -18,7 +18,7 @@ SUBROUTINE lr_readin
USE lr_variables
USE kinds, ONLY : DP
USE io_files, ONLY : tmp_dir, prefix,trimcheck,wfc_dir
USE io_files, ONLY : tmp_dir, prefix,wfc_dir
USE lsda_mod, ONLY : current_spin, nspin
USE control_flags, ONLY : twfcollect,use_para_diag
USE scf, ONLY : vltot, v, vrs, vnew, &
@ -48,6 +48,8 @@ SUBROUTINE lr_readin
USE vlocal, ONLY : strf
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
CHARACTER(len=256) :: beta_gamma_z_prefix
! fine control of beta_gamma_z file
CHARACTER(len=80) :: disk_io

View File

@ -7,7 +7,7 @@ PROGRAM lr_calculate_spectrum
!
USE kinds, ONLY : dp
USE constants, ONLY : pi,rytoev,evtonm,rytonm
USE io_files, ONLY : tmp_dir, prefix,trimcheck,nd_nmbr
USE io_files, ONLY : tmp_dir, prefix,nd_nmbr
USE global_version, ONLY : version_number
USE io_global, ONLY : stdout,ionode
USE environment, ONLY: environment_start,environment_end
@ -15,6 +15,8 @@ PROGRAM lr_calculate_spectrum
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
!Constants
!
! integer, parameter :: dp=kind(0.d0)

View File

@ -31,6 +31,7 @@ PROGRAM vdw
USE check_stop, ONLY : check_stop_init
!
IMPLICIT NONE
!
REAL (kind=DP) :: charge, vstart
INTEGER :: i
!
@ -127,7 +128,7 @@ SUBROUTINE vdw_init ( )
USE gvect
USE grid_dimensions
USE vlocal, ONLY : strf
USE io_files, ONLY : tmp_dir, prefix, trimcheck
USE io_files, ONLY : tmp_dir, prefix
USE io_global, ONLY : ionode, ionode_id, stdout
USE mp, ONLY : mp_bcast
USE parser, ONLY : read_line
@ -135,7 +136,9 @@ SUBROUTINE vdw_init ( )
USE control_vdw
IMPLICIT NONE
!
CHARACTER(LEN=256), EXTERNAL :: trimcheck
!
INTEGER :: plot_num, kpoint, kband, spin_component, ios, flen
LOGICAL :: stm_wfc_matching, lsign

View File

@ -218,7 +218,7 @@ for diago in david cg ; do
</input>
EOF
$ECHO " running the scf calculation for Si...\c"
$PW_COMMAND -xmlinput si.scf.$diago.xml > si.scf.$diago.out
$PW_COMMAND < si.scf.$diago.xml > si.scf.$diago.out
check_failure $?
$ECHO " done"
@ -346,7 +346,7 @@ EOF
</input>
EOF
$ECHO " running the band-structure calculation for Si...\c"
$PW_COMMAND -xmlinput si.band.$diago.xml > si.band.$diago.out
$PW_COMMAND < si.band.$diago.xml > si.band.$diago.out
check_failure $?
$ECHO " done"
@ -554,7 +554,7 @@ EOF
</input>
EOF
$ECHO " running the scf calculation for Al...\c"
$PW_COMMAND -xmlinput al.scf.$diago.xml > al.scf.$diago.out
$PW_COMMAND < al.scf.$diago.xml > al.scf.$diago.out
check_failure $?
$ECHO " done"
@ -676,7 +676,7 @@ EOF
</input>
EOF
$ECHO " running the band-structure calculation for Al...\c"
$PW_COMMAND -xmlinput al.band.$diago.xml > al.band.$diago.out
$PW_COMMAND < al.band.$diago.xml > al.band.$diago.out
check_failure $?
$ECHO " done"
@ -823,7 +823,7 @@ EOF
</input>
EOF
$ECHO " running the scf calculation for Cu...\c"
$PW_COMMAND -xmlinput cu.scf.$diago.xml > cu.scf.$diago.out
$PW_COMMAND < cu.scf.$diago.xml > cu.scf.$diago.out
check_failure $?
$ECHO " done"
@ -951,7 +951,7 @@ EOF
</input>
EOF
$ECHO " running the band-structure calculation for Cu...\c"
$PW_COMMAND -xmlinput cu.band.$diago.xml > cu.band.$diago.out
$PW_COMMAND < cu.band.$diago.xml > cu.band.$diago.out
check_failure $?
$ECHO " done"
@ -1187,7 +1187,7 @@ EOF
</input>
EOF
$ECHO " running the scf calculation for Ni...\c"
$PW_COMMAND -xmlinput ni.scf.$diago.xml > ni.scf.$diago.out
$PW_COMMAND < ni.scf.$diago.xml > ni.scf.$diago.out
check_failure $?
$ECHO " done"
@ -1329,7 +1329,7 @@ EOF
</input>
EOF
$ECHO " running the band-structure calculation for Ni...\c"
$PW_COMMAND -xmlinput ni.band.$diago.xml > ni.band.$diago.out|
$PW_COMMAND < ni.band.$diago.xml > ni.band.$diago.out|
check_failure $?
$ECHO " done"
done

View File

@ -15,9 +15,11 @@ PROGRAM casino2upf
USE casino_pp
USE upf_module
USE io_files, ONLY : find_free_unit
IMPLICIT NONE
!
INTEGER, EXTERNAL :: find_free_unit
!
CHARACTER(len=256) :: pp_data = 'pp.data'
CHARACTER(len=256), ALLOCATABLE:: wavefile(:)
INTEGER, ALLOCATABLE :: waveunit(:)