Some general-purpose routines for file and directory handling:

create_directory, check_tempdir, check_file_exist, clean_tempdir,
moved from input.f90 or xml_io_base into module "io_files"
This commit is contained in:
Paolo Giannozzi 2018-03-14 21:23:26 +01:00
parent 576682d11e
commit 99515484f3
30 changed files with 183 additions and 221 deletions

View File

@ -27,11 +27,11 @@ MODULE cp_restart
USE io_files, ONLY : xmlpun, qexml_version, qexml_version_init
USE xml_io_base, ONLY : write_wfc
#endif
USE xml_io_base, ONLY : read_wfc, write_rho, read_print_counter, create_directory
USE xml_io_base, ONLY : read_wfc, write_rho, read_print_counter
!
USE kinds, ONLY : DP
USE io_global, ONLY : ionode, ionode_id, stdout
USE io_files, ONLY : prefix, iunpun
USE io_files, ONLY : prefix, iunpun, create_directory
USE mp, ONLY : mp_bcast
USE parser, ONLY : version_compare
USE matrix_inversion

View File

@ -31,9 +31,8 @@ MODULE cp_restart_new
qexsd_init_forces,qexsd_init_stress, qexsd_xf, &
qexsd_init_outputElectricField, input_obj => qexsd_input_obj
USE io_files, ONLY : iunpun, xmlpun_schema, prefix, tmp_dir, qexsd_fmt,&
qexsd_version
qexsd_version, create_directory
USE io_base, ONLY : write_wfc, read_wfc, write_rhog
USE xml_io_base,ONLY: create_directory
!
USE io_global, ONLY : ionode, ionode_id, stdout
USE mp, ONLY : mp_bcast

View File

@ -485,7 +485,8 @@ SUBROUTINE read_fpmd( lforces, lcharge, lbinary, cunit, punit, funit, dunit, &
USE kinds, ONLY: DP
USE constants, ONLY: bohr => BOHR_RADIUS_ANGS
USE xml_io_base
USE io_files, ONLY: check_file_exist
USE xml_io_base,ONLY: restart_dir
USE iotk_module
IMPLICIT NONE
@ -545,11 +546,11 @@ SUBROUTINE read_fpmd( lforces, lcharge, lbinary, cunit, punit, funit, dunit, &
END IF
!
!
IF ( check_file_exst ( TRIM(filename)//'.dat' ) ) THEN
IF ( check_file_exist ( TRIM(filename)//'.dat' ) ) THEN
!
CALL read_density( TRIM(filename)//'.dat', dunit, nr1, nr2, nr3, rho, lbinary )
!
ELSEIF ( check_file_exst ( TRIM(filename)//'.xml' ) ) THEN
ELSEIF ( check_file_exist ( TRIM(filename)//'.xml' ) ) THEN
!
CALL read_density( TRIM(filename)//'.xml', dunit, nr1, nr2, nr3, rho, lbinary )
!

View File

@ -62,11 +62,11 @@ SUBROUTINE init_run()
USE efield_module, ONLY : allocate_efield, allocate_efield2
USE cg_module, ONLY : allocate_cg
USE wannier_module, ONLY : allocate_wannier
USE io_files, ONLY : tmp_dir, prefix
USE io_files, ONLY : tmp_dir, prefix, create_directory
USE io_global, ONLY : ionode, stdout
USE printout_base, ONLY : printout_base_init
USE wave_types, ONLY : wave_descriptor_info
USE xml_io_base, ONLY : restart_dir, create_directory
USE xml_io_base, ONLY : restart_dir
USE orthogonalize_base, ONLY : mesure_diag_perf, mesure_mmul_perf
USE ions_base, ONLY : ions_reference_positions, cdmi
USE mp_bands, ONLY : nbgrp

View File

@ -179,7 +179,6 @@ cp_restart_new.o : ../../Modules/run_info.o
cp_restart_new.o : ../../Modules/tsvdw.o
cp_restart_new.o : ../../Modules/uspp.o
cp_restart_new.o : ../../Modules/wrappers.o
cp_restart_new.o : ../../Modules/xml_io_base.o
cp_restart_new.o : ../../UtilXlib/mp.o
cp_restart_new.o : ../../iotk/src/iotk_module.o
cp_restart_new.o : cp_interfaces.o

View File

@ -10,7 +10,7 @@ IFLAGS=-I../../include
# location of needed modules
MODFLAGS= $(BASEMOD_FLAGS) \
$(MOD_FLAG)../../PW/src \
$(MOD_FLAG)../../KS_Solvers/CGq\
$(MOD_FLAG)../../KS_Solvers/CG \
$(MOD_FLAG)../../KS_Solvers/Davidson \
$(MOD_FLAG)../../LR_Modules \
$(MOD_FLAG)../../PHonon/PH

View File

@ -76,7 +76,6 @@ phq_readin.o : ../../Modules/paw_variables.o
phq_readin.o : ../../Modules/run_info.o
phq_readin.o : ../../Modules/uspp.o
phq_readin.o : ../../Modules/wannier_gw.o
phq_readin.o : ../../Modules/xml_io_base.o
phq_readin.o : ../../PHonon/PH/dfile_star.o
phq_readin.o : ../../PHonon/PH/elph.o
phq_readin.o : ../../PHonon/PH/ph_restart.o

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
USE io_files, ONLY : tmp_dir, prefix, create_directory
USE noncollin_module, ONLY : i_cons, noncolin
USE ldaU, ONLY : lda_plus_u
USE control_flags, ONLY : iverbosity, modenum, twfcollect,io_level
@ -61,7 +61,6 @@ SUBROUTINE phq_readin()
USE ramanm, ONLY : eth_rps, eth_ns, lraman, elop, dek
USE freq_ph, ONLY : fpol, fiu, nfs
USE ph_restart, ONLY : ph_readfile
USE xml_io_base, ONLY : create_directory
USE el_phon, ONLY : elph,elph_mat,elph_simple,elph_nbnd_min, elph_nbnd_max, &
el_ph_sigma, el_ph_nsigma, el_ph_ngauss,auxdvscf
USE dfile_star, ONLY : drho_star, dvscf_star

View File

@ -10,6 +10,7 @@ MODULE io_files
!=----------------------------------------------------------------------------=!
!
USE parameters, ONLY: ntypx
USE io_global, ONLY: ionode, ionode_id, stdout
!
! ... I/O related variables: file names, units, utilities
! ... IMPORTANT: when directory names are set, they must always end with "/"
@ -17,6 +18,9 @@ MODULE io_files
IMPLICIT NONE
!
SAVE
PUBLIC :: create_directory, check_tempdir, clean_tempdir, check_file_exist, &
delete_if_present, check_writable
!
! ... directory for all temporary files
CHARACTER(len=256) :: tmp_dir = './'
! ... directory for large files on each node. Default: same as tmp_dir
@ -46,9 +50,7 @@ MODULE io_files
!
CHARACTER (LEN=13), PARAMETER :: xmlpun = 'data-file.xml'
!
!
CHARACTER (LEN=20), PARAMETER :: xmlpun_schema = 'data-file-schema.xml'
!
!
! ... The units where various variables are saved
! ... Only units that are kept open during the run should be listed here
@ -65,6 +67,7 @@ MODULE io_files
!
INTEGER :: iunexit = 26 ! unit for a soft exit
INTEGER :: iunupdate = 27 ! unit for saving old positions (extrapolation)
! NEB
INTEGER :: iunnewimage = 28 ! unit for parallelization among images
INTEGER :: iunlock = 29 ! as above (locking file)
!
@ -94,13 +97,140 @@ MODULE io_files
INTEGER :: nwordwf = 2
!
CONTAINS
!
!------------------------------------------------------------------------
SUBROUTINE create_directory( dirname )
!------------------------------------------------------------------------
!
USE wrappers, ONLY : f_mkdir_safe
USE mp, ONLY : mp_barrier, mp_bcast
USE mp_images, ONLY : me_image, intra_image_comm
!
CHARACTER(LEN=*), INTENT(IN) :: dirname
!
INTEGER :: ierr
!
CHARACTER(LEN=6), EXTERNAL :: int_to_char
!
IF ( ionode ) ierr = f_mkdir_safe( TRIM( dirname ) )
CALL mp_bcast ( ierr, ionode_id, intra_image_comm )
!
CALL errore( 'create_directory', &
'unable to create directory ' // TRIM( dirname ), ierr )
!
! ... syncronize all jobs (not sure it is really useful)
!
CALL mp_barrier( intra_image_comm )
!
! ... check whether the scratch directory is writable
!
IF ( ionode ) ierr = check_writable ( dirname, me_image )
CALL mp_bcast( ierr, ionode_id, intra_image_comm )
!
CALL errore( 'create_directory:', &
TRIM( dirname ) // ' non existent or non writable', ierr )
!
RETURN
!
END SUBROUTINE create_directory
!
!-----------------------------------------------------------------------
SUBROUTINE check_tempdir ( tmp_dir, exst, pfs )
!-----------------------------------------------------------------------
!
! ... Verify if tmp_dir exists, creates it if not
! ... On output:
! ... exst= .t. if tmp_dir exists
! ... pfs = .t. if tmp_dir visible from all procs of an image
!
USE wrappers, ONLY : f_mkdir_safe
USE mp_images, ONLY : intra_image_comm, nproc_image, me_image
USE mp, ONLY : mp_barrier, mp_bcast, mp_sum
!
IMPLICIT NONE
!
CHARACTER(len=*), INTENT(in) :: tmp_dir
LOGICAL, INTENT(out) :: exst, pfs
!
INTEGER :: ios, image, proc, nofi
CHARACTER (len=256) :: file_path, filename
CHARACTER(len=6), EXTERNAL :: int_to_char
!
! ... create tmp_dir on ionode
! ... f_mkdir_safe returns -1 if tmp_dir already exists
! ... 0 if created
! ... 1 if cannot be created
!
IF ( ionode ) ios = f_mkdir_safe( TRIM(tmp_dir) )
CALL mp_bcast ( ios, ionode_id, intra_image_comm )
exst = ( ios == -1 )
IF ( ios > 0 ) CALL errore ('check_tempdir','tmp_dir cannot be opened',1)
!
! ... let us check now if tmp_dir is visible on all nodes
! ... if not, a local tmp_dir is created on each node
!
ios = f_mkdir_safe( TRIM(tmp_dir) )
CALL mp_sum ( ios, intra_image_comm )
pfs = ( ios == -nproc_image ) ! actually this is true only if .not.exst
!
RETURN
!
END SUBROUTINE check_tempdir
!
!-----------------------------------------------------------------------
SUBROUTINE clean_tempdir( tmp_dir )
!-----------------------------------------------------------------------
!
IMPLICIT NONE
!
CHARACTER(len=*), INTENT(in) :: tmp_dir
!
CHARACTER (len=256) :: file_path, filename
!
! ... remove temporary files from tmp_dir ( only by the master node )
!
file_path = trim( tmp_dir ) // trim( prefix )
IF ( ionode ) THEN
CALL delete_if_present( trim( file_path ) // '.update' )
CALL delete_if_present( trim( file_path ) // '.md' )
CALL delete_if_present( trim( file_path ) // '.bfgs' )
ENDIF
!
RETURN
!
END SUBROUTINE clean_tempdir
!
!------------------------------------------------------------------------
FUNCTION check_file_exist( filename )
!------------------------------------------------------------------------
!
USE mp, ONLY : mp_bcast
USE mp_images, ONLY : intra_image_comm
!
IMPLICIT NONE
!
LOGICAL :: check_file_exist
CHARACTER(LEN=*) :: filename
!
LOGICAL :: lexists
!
IF ( ionode ) THEN
!
INQUIRE( FILE = TRIM( filename ), EXIST = lexists )
!
ENDIF
!
CALL mp_bcast ( lexists, ionode_id, intra_image_comm )
!
check_file_exist = lexists
RETURN
!
END FUNCTION check_file_exist
!
!--------------------------------------------------------------------------
SUBROUTINE delete_if_present( filename, in_warning )
!--------------------------------------------------------------------------
!
USE io_global, ONLY : ionode, stdout
!
IMPLICIT NONE
!
CHARACTER(LEN=*), INTENT(IN) :: filename
@ -189,7 +319,6 @@ subroutine diropn (unit, extension, recl, exst, tmp_dir_)
! the record length in direct-access I/O is given by the number of
! real*8 words times DIRECT_IO_FACTOR (may depend on the compiler)
!
USE kinds
implicit none
!
! first the input variables
@ -340,7 +469,7 @@ SUBROUTINE davcio( vect, nword, unit, nrec, io )
! ... direct-access vector input/output
! ... read/write nword words starting from the address specified by vect
!
USE kinds, ONLY : DP
USE kinds , ONLY : DP
!
IMPLICIT NONE
!

View File

@ -138,9 +138,12 @@ io_base.o : ../UtilXlib/mp.o
io_base.o : kind.o
io_base.o : mp_wave.o
io_base.o : qeh5_module.o
io_files.o : ../UtilXlib/mp.o
io_files.o : io_global.o
io_files.o : kind.o
io_files.o : mp_images.o
io_files.o : parameters.o
io_files.o : wrappers.o
ions_base.o : cell_base.o
ions_base.o : constants.o
ions_base.o : io_global.o
@ -477,7 +480,6 @@ xml_io_base.o : mp_global.o
xml_io_base.o : mp_images.o
xml_io_base.o : mp_wave.o
xml_io_base.o : parser.o
xml_io_base.o : wrappers.o
xsf.o : constants.o
xsf.o : kind.o
ylmr2.o : constants.o

View File

@ -18,9 +18,11 @@ MODULE xml_io_base
USE iotk_module
!
USE kinds, ONLY : DP
USE io_files, ONLY : tmp_dir, prefix, iunpun, xmlpun
USE io_files, ONLY : tmp_dir, prefix, iunpun, xmlpun, check_file_exist, &
create_directory
USE io_global, ONLY : ionode, ionode_id, stdout
USE mp, ONLY : mp_bcast
USE mp, ONLY : mp_bcast, mp_sum, mp_get, mp_put, mp_max, mp_rank, &
mp_size
USE parser, ONLY : version_compare
!
IMPLICIT NONE
@ -33,47 +35,9 @@ MODULE xml_io_base
PUBLIC :: attr
!
PUBLIC :: read_wfc, write_wfc, read_rho, write_rho, &
save_print_counter, read_print_counter
PUBLIC :: create_directory, check_file_exst, restart_dir
save_print_counter, read_print_counter, restart_dir
!
CONTAINS
!
!------------------------------------------------------------------------
SUBROUTINE create_directory( dirname )
!------------------------------------------------------------------------
!
USE wrappers, ONLY : f_mkdir_safe
USE mp, ONLY : mp_barrier
USE mp_images, ONLY : me_image, intra_image_comm
USE io_files, ONLY : check_writable
!
CHARACTER(LEN=*), INTENT(IN) :: dirname
!
INTEGER :: ierr
!
CHARACTER(LEN=6), EXTERNAL :: int_to_char
!
IF ( ionode ) ierr = f_mkdir_safe( TRIM( dirname ) )
CALL mp_bcast ( ierr, ionode_id, intra_image_comm )
!
CALL errore( 'create_directory', &
'unable to create directory ' // TRIM( dirname ), ierr )
!
! ... syncronize all jobs (not sure it is really useful)
!
CALL mp_barrier( intra_image_comm )
!
! ... check whether the scratch directory is writable
!
IF ( ionode ) ierr = check_writable ( dirname, me_image )
CALL mp_bcast( ierr, ionode_id, intra_image_comm )
!
CALL errore( 'create_directory:', &
TRIM( dirname ) // ' non existent or non writable', ierr )
!
RETURN
!
END SUBROUTINE create_directory
!
!------------------------------------------------------------------------
FUNCTION restart_dir( outdir, runit )
@ -111,7 +75,6 @@ MODULE xml_io_base
FUNCTION check_restartfile( outdir, ndr )
!------------------------------------------------------------------------
!
USE io_global, ONLY : ionode, ionode_id
USE mp_images, ONLY : intra_image_comm
!
IMPLICIT NONE
@ -142,42 +105,12 @@ MODULE xml_io_base
END FUNCTION check_restartfile
!
!------------------------------------------------------------------------
FUNCTION check_file_exst( filename )
!------------------------------------------------------------------------
!
USE io_global, ONLY : ionode, ionode_id
USE mp_images, ONLY : intra_image_comm
!
IMPLICIT NONE
!
LOGICAL :: check_file_exst
CHARACTER(LEN=*) :: filename
!
LOGICAL :: lexists
!
IF ( ionode ) THEN
!
INQUIRE( FILE = TRIM( filename ), EXIST = lexists )
!
ENDIF
!
CALL mp_bcast ( lexists, ionode_id, intra_image_comm )
!
check_file_exst = lexists
RETURN
!
END FUNCTION check_file_exst
!
!
!------------------------------------------------------------------------
SUBROUTINE save_print_counter( iter, outdir, wunit )
!------------------------------------------------------------------------
!
! ... a counter indicating the last successful printout iteration is saved
!
USE io_global, ONLY : ionode, ionode_id
USE mp_images, ONLY : intra_image_comm
USE mp, ONLY : mp_bcast
!
IMPLICIT NONE
!
@ -228,9 +161,7 @@ MODULE xml_io_base
! ... the counter indicating the last successful printout iteration
! ... is read here
!
USE io_global, ONLY : ionode, ionode_id
USE mp_images, ONLY : intra_image_comm
USE mp, ONLY : mp_bcast
!
IMPLICIT NONE
!
@ -281,8 +212,6 @@ MODULE xml_io_base
! ... set working variables for k-point index (ikt) and
! ... k-points number (nkt)
!
USE mp, ONLY : mp_sum, mp_get, mp_max, mp_rank, mp_size
!
IMPLICIT NONE
!
INTEGER, INTENT(IN) :: ik, nk, kunit
@ -411,7 +340,6 @@ MODULE xml_io_base
! ... $dirname directory - $dirname must exist and end with '/'
!
USE fft_base, ONLY : dfftp
USE io_global,ONLY : ionode
USE mp_bands, ONLY : intra_bgrp_comm, inter_bgrp_comm
!
IMPLICIT NONE
@ -481,7 +409,6 @@ MODULE xml_io_base
! ... files saved into the '.save' directory
!
USE fft_base, ONLY : dfftp
USE io_global, ONLY : ionode
!
IMPLICIT NONE
!
@ -539,7 +466,6 @@ MODULE xml_io_base
! ... all processors, avoiding an overall collect of the charge density
! ... on a single proc.
!
USE mp, ONLY : mp_get, mp_sum, mp_rank, mp_size
#if defined __HDF5
USE hdf5_qe, ONLY : write_rho_hdf5, h5fclose_f, &
prepare_for_writing_final, add_attributes_hdf5, rho_hdf5_write
@ -704,9 +630,7 @@ MODULE xml_io_base
! ... Reads charge density rho, one plane at a time, to avoid
! ... collecting the entire charge density on a single processor
!
USE io_global, ONLY : ionode, ionode_id
USE mp_images, ONLY : intra_image_comm
USE mp, ONLY : mp_put, mp_sum, mp_rank, mp_size
#if defined __HDF5
USE hdf5_qe, ONLY : read_rho_hdf5, read_attributes_hdf5, &
prepare_for_reading_final, h5fclose_f, rho_hdf5_write, hdf5_type
@ -741,12 +665,12 @@ MODULE xml_io_base
!
#if defined(__HDF5)
rho_file_hdf5 = TRIM( rho_file_base ) // '.hdf5'
exst = check_file_exst(TRIM(rho_file_hdf5))
exst = check_file_exist(TRIM(rho_file_hdf5))
IF ( .NOT. exst ) CALL errore ('read_rho_xml', 'searching for '// TRIM(rho_file_hdf5),10)
#else
rhounit = find_free_unit ( )
rho_file = TRIM( rho_file_base ) // ".dat"
exst = check_file_exst( TRIM(rho_file) )
exst = check_file_exist( TRIM(rho_file) )
!
IF ( .NOT. exst ) CALL errore('read_rho_xml', 'searching for '//TRIM(rho_file), 10)
#endif
@ -853,7 +777,6 @@ MODULE xml_io_base
!------------------------------------------------------------------------
!
USE mp_wave, ONLY : mergewf
USE mp, ONLY : mp_get, mp_size, mp_rank, mp_sum
USE control_flags, ONLY : lwfnscf, lwfpbe0nscf ! Lingzhu Kong
#if defined __HDF5
!USE hdf5_qe, ONLY : evc_hdf5, read_data_hdf5, write_data_hdf5, &
@ -1024,7 +947,6 @@ MODULE xml_io_base
!------------------------------------------------------------------------
!
USE mp_wave, ONLY : splitwf
USE mp, ONLY : mp_put, mp_size, mp_rank, mp_sum
#if defined __HDF5
USE hdf5_qe

View File

@ -27,7 +27,7 @@ SUBROUTINE compute_scf( fii, lii, stat )
USE ener, ONLY : etot, ef
USE force_mod, ONLY : force
USE io_files, ONLY : prefix, tmp_dir, wfc_dir, iunupdate, seqopn, &
exit_file, iunexit, delete_if_present
exit_file, delete_if_present
USE path_io_units_module, ONLY : iunpath
USE path_formats, ONLY : scf_fmt, scf_fmt_para
USE path_variables, ONLY : pos, pes, grad_pes, dim1, pending_image, &

View File

@ -18,7 +18,7 @@ SUBROUTINE ioneb()
USE kinds, ONLY : DP
USE constants, ONLY : autoev, eV_to_kelvin
USE io_global, ONLY : stdout
USE io_files, ONLY : tmp_dir
USE io_files, ONLY : tmp_dir
USE path_variables, ONLY : lsteep_des, lquick_min, &
lbroyden, lbroyden2, llangevin, &
lneb, lsmd, restart
@ -210,7 +210,7 @@ SUBROUTINE verify_neb_tmpdir( tmp_dir )
!
USE wrappers, ONLY : f_mkdir
USE path_input_parameters_module, ONLY : restart_mode
USE io_files, ONLY : prefix, xmlpun, delete_if_present
USE io_files, ONLY : prefix, xmlpun, check_tempdir, delete_if_present
USE path_variables, ONLY : num_of_images
USE mp_world, ONLY : world_comm, mpime, nproc
USE io_global, ONLY : meta_ionode

View File

@ -91,9 +91,8 @@ SUBROUTINE check_initial_status(auxdyn)
USE io_rho_xml, ONLY : write_scf
USE mp_images, ONLY : nimage, intra_image_comm
USE io_global, ONLY : ionode, ionode_id
USE io_files, ONLY : prefix
USE io_files, ONLY : prefix , create_directory
USE mp, ONLY : mp_bcast
USE xml_io_base, ONLY : create_directory
USE mp_global, ONLY : mp_global_end
USE el_phon, ONLY : elph_mat
! YAMBO >

View File

@ -55,7 +55,7 @@ SUBROUTINE elph_tetra_lambda()
USE lsda_mod, ONLY : nspin
USE ktetra, ONLY : ntetra, tetra, opt_tetra_dos_t
USE output, ONLY : fildyn
USE xml_io_base, ONLY : create_directory
USE io_files, ONLY : create_directory
!
IMPLICIT NONE
!
@ -518,7 +518,7 @@ SUBROUTINE elph_tetra_gamma()
USE ktetra, ONLY : ntetra, tetra, opt_tetra_dos_t
USE mp_images, ONLY : me_image, nproc_image, intra_image_comm
USE output, ONLY : fildyn
USE xml_io_base, ONLY : create_directory
USE io_files, ONLY : create_directory
USE ions_base, ONLY : ityp, amass
!
IMPLICIT NONE

View File

@ -489,14 +489,13 @@ SUBROUTINE elphsum ( )
USE modes, ONLY : u, nirr
USE dynmat, ONLY : dyn, w2
USE io_global, ONLY : stdout, ionode, ionode_id
USE xml_io_base, ONLY : create_directory
USE mp_pools, ONLY : my_pool_id, npool, kunit
USE mp_images, ONLY : intra_image_comm
USE mp, ONLY : mp_bcast
USE control_ph, ONLY : tmp_dir_phq, xmldyn, current_iq
USE save_ph, ONLY : tmp_dir_save
USE io_files, ONLY : prefix, tmp_dir, seqopn
USE io_files, ONLY : prefix, tmp_dir, seqopn, create_directory
!
USE lr_symm_base, ONLY : minus_q, nsymq, rtau
USE qpoint, ONLY : xq, nksq
USE control_lr, ONLY : lgamma

View File

@ -177,7 +177,6 @@ check_initial_status.o : ../../Modules/ions_base.o
check_initial_status.o : ../../Modules/mp_global.o
check_initial_status.o : ../../Modules/mp_images.o
check_initial_status.o : ../../Modules/wrappers.o
check_initial_status.o : ../../Modules/xml_io_base.o
check_initial_status.o : ../../PW/src/io_rho_xml.o
check_initial_status.o : ../../PW/src/pwcom.o
check_initial_status.o : ../../PW/src/scf_mod.o
@ -674,12 +673,12 @@ elph_scdft_mod.o : phcom.o
elph_tetra_mod.o : ../../LR_Modules/lrcom.o
elph_tetra_mod.o : ../../Modules/cell_base.o
elph_tetra_mod.o : ../../Modules/constants.o
elph_tetra_mod.o : ../../Modules/io_files.o
elph_tetra_mod.o : ../../Modules/io_global.o
elph_tetra_mod.o : ../../Modules/ions_base.o
elph_tetra_mod.o : ../../Modules/kind.o
elph_tetra_mod.o : ../../Modules/mp_images.o
elph_tetra_mod.o : ../../Modules/mp_pools.o
elph_tetra_mod.o : ../../Modules/xml_io_base.o
elph_tetra_mod.o : ../../PW/src/pwcom.o
elph_tetra_mod.o : ../../PW/src/symm_base.o
elph_tetra_mod.o : ../../PW/src/tetra.o
@ -705,7 +704,6 @@ elphon.o : ../../Modules/paw_variables.o
elphon.o : ../../Modules/recvec.o
elphon.o : ../../Modules/uspp.o
elphon.o : ../../Modules/wavefunctions.o
elphon.o : ../../Modules/xml_io_base.o
elphon.o : ../../PW/src/buffers.o
elphon.o : ../../PW/src/pwcom.o
elphon.o : ../../PW/src/start_k.o
@ -998,7 +996,6 @@ phq_readin.o : ../../Modules/noncol.o
phq_readin.o : ../../Modules/paw_variables.o
phq_readin.o : ../../Modules/run_info.o
phq_readin.o : ../../Modules/uspp.o
phq_readin.o : ../../Modules/xml_io_base.o
phq_readin.o : ../../PW/src/ldaU.o
phq_readin.o : ../../PW/src/pwcom.o
phq_readin.o : ../../PW/src/start_k.o
@ -1586,11 +1583,11 @@ write_rec.o : ph_restart.o
write_rec.o : phcom.o
yambo.o : ../../LR_Modules/lrcom.o
yambo.o : ../../Modules/cell_base.o
yambo.o : ../../Modules/io_files.o
yambo.o : ../../Modules/io_global.o
yambo.o : ../../Modules/ions_base.o
yambo.o : ../../Modules/kind.o
yambo.o : ../../Modules/mp_images.o
yambo.o : ../../Modules/xml_io_base.o
yambo.o : ../../PW/src/pwcom.o
yambo.o : ../../UtilXlib/mp.o
yambo.o : elph.o

View File

@ -1271,7 +1271,7 @@ MODULE ph_restart
! and opens the appropriate file for reading or writing
!
USE io_global, ONLY : ionode, ionode_id
USE xml_io_base, ONLY : create_directory
USE io_files, ONLY : create_directory
USE freq_ph, ONLY : fpol
USE mp_images, ONLY : intra_image_comm
USE mp, ONLY : mp_bcast

View File

@ -50,7 +50,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, x_q, wq, nqs, lgamma_iq
USE io_files, ONLY : tmp_dir, prefix
USE io_files, ONLY : tmp_dir, prefix, create_directory, check_tempdir
USE noncollin_module, ONLY : i_cons, noncolin
USE ldaU, ONLY : lda_plus_u
USE control_flags, ONLY : iverbosity, modenum, twfcollect
@ -66,7 +66,6 @@ SUBROUTINE phq_readin()
USE freq_ph, ONLY : fpol, fiu, nfs
USE cryst_ph, ONLY : magnetic_sym
USE ph_restart, ONLY : ph_readfile
USE xml_io_base, ONLY : create_directory
USE el_phon, ONLY : elph,elph_mat,elph_simple,elph_nbnd_min, elph_nbnd_max, &
el_ph_sigma, el_ph_nsigma, el_ph_ngauss,auxdvscf
USE dfile_star, ONLY : drho_star, dvscf_star

View File

@ -80,7 +80,7 @@ SUBROUTINE elph_yambo_eval_and_IO( )
USE modes, ONLY : u,nmodes
USE dynmat, ONLY : w2,dyn
USE io_global, ONLY : ionode, ionode_id
USE xml_io_base, ONLY : create_directory
USE io_files, ONLY : create_directory
USE mp_images, ONLY : intra_image_comm
USE mp, ONLY : mp_bcast
USE control_lr, ONLY : lgamma

View File

@ -68,7 +68,7 @@
PROGRAM bgw2pw
USE environment, ONLY : environment_start, environment_end
USE io_files, ONLY : prefix, tmp_dir
USE io_files, ONLY : prefix, tmp_dir, create_directory
USE io_global, ONLY : ionode, ionode_id
USE kinds, ONLY : DP
USE mp, ONLY : mp_bcast
@ -193,7 +193,6 @@ SUBROUTINE write_evc ( input_file_name, real_or_complex, &
USE mp_world, ONLY : world_comm, nproc
USE mp_pools, ONLY : kunit, npool, my_pool_id, intra_pool_comm
USE symm_base, ONLY : s, nsym
USE xml_io_base, ONLY : create_directory
#if defined (__OLDXML)
USE qexml_module, ONLY : qexml_kpoint_dirname, qexml_wfc_filename
#endif
@ -670,7 +669,6 @@ SUBROUTINE write_cd ( input_file_name, real_or_complex, output_dir_name )
USE scf, ONLY : rho
USE symm_base, ONLY : s, nsym
USE wavefunctions_module, ONLY : psic
USE xml_io_base, ONLY : create_directory
IMPLICIT NONE

View File

@ -72,7 +72,7 @@ SUBROUTINE impexp ()
!-----------------------------------------------------------------------
USE kinds, ONLY : DP
USE io_files, ONLY : tmp_dir, prefix, psfile, pseudo_dir, xmlpun
USE io_files, ONLY : tmp_dir, prefix, psfile, pseudo_dir, xmlpun, create_directory
USE ions_base, ONLY : nsp
USE io_global, ONLY : ionode, ionode_id
USE mp, ONLY : mp_bcast
@ -80,7 +80,7 @@ SUBROUTINE impexp ()
USE io_rho_xml, ONLY : write_scf
USE scf, ONLY : rho
USE lsda_mod, ONLY : nspin
USE xml_io_base, ONLY : rho_binary, create_directory
USE xml_io_base, ONLY : rho_binary
USE wrappers, ONLY: f_copy

View File

@ -6,11 +6,6 @@
! or http://www.gnu.org/copyleft/gpl.txt .
!
!----------------------------------------------------------------------------
! TB
! included gate related stuff, search for 'TB'
!----------------------------------------------------------------------------
!
!----------------------------------------------------------------------------
SUBROUTINE iosys()
!-----------------------------------------------------------------------------
!
@ -96,7 +91,8 @@ SUBROUTINE iosys()
USE io_files, ONLY : input_drho, output_drho, &
psfile, tmp_dir, wfc_dir, &
prefix_ => prefix, &
pseudo_dir_ => pseudo_dir
pseudo_dir_ => pseudo_dir, &
check_tempdir, clean_tempdir
!
USE force_mod, ONLY : lforce, lstres, force
!
@ -1892,72 +1888,3 @@ SUBROUTINE convert_tau (tau_format, nat_, tau)
END SELECT
!
END SUBROUTINE convert_tau
!-----------------------------------------------------------------------
SUBROUTINE check_tempdir ( tmp_dir, exst, pfs )
!-----------------------------------------------------------------------
!
! ... Verify if tmp_dir exists, creates it if not
! ... On output:
! ... exst= .t. if tmp_dir exists
! ... pfs = .t. if tmp_dir visible from all procs of an image
!
USE wrappers, ONLY : f_mkdir_safe
USE io_global, ONLY : ionode, ionode_id
USE mp_images, ONLY : intra_image_comm, nproc_image, me_image
USE mp, ONLY : mp_barrier, mp_bcast, mp_sum
!
IMPLICIT NONE
!
CHARACTER(len=*), INTENT(in) :: tmp_dir
LOGICAL, INTENT(out) :: exst, pfs
!
INTEGER :: ios, image, proc, nofi
CHARACTER (len=256) :: file_path, filename
CHARACTER(len=6), EXTERNAL :: int_to_char
!
! ... create tmp_dir on ionode
! ... f_mkdir_safe returns -1 if tmp_dir already exists
! ... 0 if created
! ... 1 if cannot be created
!
IF ( ionode ) ios = f_mkdir_safe( TRIM(tmp_dir) )
CALL mp_bcast ( ios, ionode_id, intra_image_comm )
exst = ( ios == -1 )
IF ( ios > 0 ) CALL errore ('check_tempdir','tmp_dir cannot be opened',1)
!
! ... let us check now if tmp_dir is visible on all nodes
! ... if not, a local tmp_dir is created on each node
!
ios = f_mkdir_safe( TRIM(tmp_dir) )
CALL mp_sum ( ios, intra_image_comm )
pfs = ( ios == -nproc_image ) ! actually this is true only if .not.exst
!
RETURN
!
END SUBROUTINE check_tempdir
!
!-----------------------------------------------------------------------
SUBROUTINE clean_tempdir( tmp_dir )
!-----------------------------------------------------------------------
!
USE io_files, ONLY : prefix, delete_if_present
USE io_global, ONLY : ionode
!
IMPLICIT NONE
!
CHARACTER(len=*), INTENT(in) :: tmp_dir
!
CHARACTER (len=256) :: file_path, filename
!
! ... remove temporary files from tmp_dir ( only by the master node )
!
file_path = trim( tmp_dir ) // trim( prefix )
IF ( ionode ) THEN
CALL delete_if_present( trim( file_path ) // '.update' )
CALL delete_if_present( trim( file_path ) // '.md' )
CALL delete_if_present( trim( file_path ) // '.bfgs' )
ENDIF
!
RETURN
!
END SUBROUTINE clean_tempdir

View File

@ -11,7 +11,8 @@ MODULE io_rho_xml
!----------------------------------------------------------------------------
!
USE kinds, ONLY : DP
USE xml_io_base, ONLY : create_directory, write_rho, read_rho
USE io_files, ONLY : create_directory
USE xml_io_base, ONLY : write_rho, read_rho
#if !defined (__OLDXML)
USE io_base, ONLY : write_rhog, read_rhog
#endif

View File

@ -960,7 +960,6 @@ input.o : ../../Modules/ions_base.o
input.o : ../../Modules/kernel_table.o
input.o : ../../Modules/kind.o
input.o : ../../Modules/mm_dispersion.o
input.o : ../../Modules/mp_images.o
input.o : ../../Modules/mp_pools.o
input.o : ../../Modules/noncol.o
input.o : ../../Modules/qes_types.o
@ -972,9 +971,7 @@ input.o : ../../Modules/recvec.o
input.o : ../../Modules/run_info.o
input.o : ../../Modules/tsvdw.o
input.o : ../../Modules/wannier_new.o
input.o : ../../Modules/wrappers.o
input.o : ../../Modules/wyckoff.o
input.o : ../../UtilXlib/mp.o
input.o : ../../dft-d3/api.o
input.o : ../../dft-d3/dftd3_qe.o
input.o : Coul_cut_2D.o
@ -1451,7 +1448,6 @@ punch.o : ../../Modules/ions_base.o
punch.o : ../../Modules/kernel_table.o
punch.o : ../../Modules/wavefunctions.o
punch.o : ../../Modules/wrappers.o
punch.o : ../../Modules/xml_io_base.o
punch.o : a2fmod.o
punch.o : io_rho_xml.o
punch.o : pw_restart.o
@ -1551,6 +1547,7 @@ pw_restart.o : buffers.o
pw_restart.o : esm.o
pw_restart.o : extfield.o
pw_restart.o : exx.o
pw_restart.o : exx_base.o
pw_restart.o : io_rho_xml.o
pw_restart.o : ldaU.o
pw_restart.o : martyna_tuckerman.o
@ -1593,7 +1590,6 @@ pw_restart_new.o : ../../Modules/uspp.o
pw_restart_new.o : ../../Modules/version.o
pw_restart_new.o : ../../Modules/wavefunctions.o
pw_restart_new.o : ../../UtilXlib/mp.o
pw_restart_new.o : ../../iotk/src/iotk_module.o
pw_restart_new.o : Coul_cut_2D.o
pw_restart_new.o : atomic_wfc_mod.o
pw_restart_new.o : bp_mod.o

View File

@ -43,13 +43,12 @@ SUBROUTINE potinit()
USE ldaU, ONLY : lda_plus_u, Hubbard_lmax, eth, &
niter_with_fixed_ns
USE noncollin_module, ONLY : noncolin, report
USE io_files, ONLY : tmp_dir, prefix, input_drho
USE io_files, ONLY : tmp_dir, prefix, input_drho, check_file_exist
USE spin_orb, ONLY : domag, lforcet
USE mp, ONLY : mp_sum
USE mp_bands , ONLY : intra_bgrp_comm, root_bgrp
USE io_global, ONLY : ionode, ionode_id
USE io_rho_xml, ONLY : read_scf
USE xml_io_base, ONLY : check_file_exst
#if defined __OLDXML
USE xml_io_base, ONLY : read_rho
#else
@ -79,7 +78,7 @@ SUBROUTINE potinit()
#else
filename = TRIM(dirname) // 'charge-density.dat'
#endif
exst = check_file_exst( TRIM(filename) )
exst = check_file_exist( TRIM(filename) )
!
IF ( starting_pot == 'file' .AND. exst ) THEN
!

View File

@ -14,12 +14,11 @@ SUBROUTINE punch( what )
!
USE io_global, ONLY : stdout, ionode
USE io_files, ONLY : iunpun, iunwfc, nwordwfc, diropn, &
tmp_dir, prefix
tmp_dir, prefix, create_directory
USE control_flags, ONLY : io_level, twfcollect, io_level, lscf
USE klist, ONLY : nks
USE io_files, ONLY : xmlpun_schema, psfile, pseudo_dir
USE wrappers, ONLY : f_copy
USE xml_io_base, ONLY : create_directory
USE spin_orb, ONLY : lforcet
USE scf, ONLY : rho
USE lsda_mod, ONLY : nspin

View File

@ -16,9 +16,9 @@ MODULE cond_restart
USE iotk_module
!
USE kinds, ONLY : DP
USE xml_io_base, ONLY : create_directory, attr
USE xml_io_base, ONLY : attr
USE io_files, ONLY : tmp_dir, xmlpun, iunpun, qexml_version, &
qexml_version_init
qexml_version_init, create_directory
USE io_global, ONLY : ionode, ionode_id
USE mp_global, ONLY : intra_image_comm
USE mp, ONLY : mp_bcast

View File

@ -16,7 +16,7 @@ SUBROUTINE lr_readin
USE lr_variables
USE lr_dav_variables
USE kinds, ONLY : DP
USE io_files, ONLY : tmp_dir, prefix, wfc_dir
USE io_files, ONLY : tmp_dir, prefix, wfc_dir, create_directory
USE lsda_mod, ONLY : current_spin, nspin, isk, lsda
USE control_flags, ONLY : twfcollect,use_para_diag, &
& tqr, lkpoint_dir, gamma_only, &
@ -52,7 +52,6 @@ SUBROUTINE lr_readin
USE martyna_tuckerman, ONLY : do_comp_mt
USE esm, ONLY : do_comp_esm
USE qpoint, ONLY : xq
USE xml_io_base, ONLY : create_directory
USE io_rho_xml, ONLY : write_scf
USE noncollin_module, ONLY : noncolin
USE mp_bands, ONLY : ntask_groups

View File

@ -427,7 +427,6 @@ lr_readin.o : ../../Modules/paw_variables.o
lr_readin.o : ../../Modules/plugin_flags.o
lr_readin.o : ../../Modules/recvec.o
lr_readin.o : ../../Modules/uspp.o
lr_readin.o : ../../Modules/xml_io_base.o
lr_readin.o : ../../PW/src/esm.o
lr_readin.o : ../../PW/src/exx.o
lr_readin.o : ../../PW/src/io_rho_xml.o