added research of argument -input_images when not parsing input file

to be tested in parallel.


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@7465 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
marsamos 2011-02-01 10:44:58 +00:00
parent 97361f4a84
commit 9bc501b6cd
2 changed files with 59 additions and 4 deletions

View File

@ -55,6 +55,57 @@ SUBROUTINE input_file_name_getarg(myname,lfound)
!
END SUBROUTINE input_file_name_getarg
!
SUBROUTINE input_images_getarg(input_images,lfound)
!-----------------------------------------------------------------------------
!
! check for presence of command-line option "-inp myname" or "--inp myname"
! where "myname" is the name of the input file. Returns the name and if it
! has been found.
!
USE kinds, ONLY : DP
!
USE io_global, ONLY : stdout
!
IMPLICIT NONE
!
INTEGER, intent(out) :: input_images
LOGICAL, intent(out) :: lfound
!
CHARACTER(len=256) :: myname
INTEGER :: iiarg, nargs, iargc, i, i0
!
!
#if defined(__ABSOFT)
# define getarg getarg_
# define iargc iargc_
#endif
!
nargs = iargc()
lfound = .false.
input_images = 0
!
DO iiarg = 1, nargs
CALL getarg( iiarg, myname)
!
IF ( TRIM( myname ) == '-input_images' .OR. &
TRIM( myname ) == '--input_images' ) THEN
!
CALL getarg( ( iiarg + 1 ) , myname )
!
READ(myname,*) input_images
!
lfound = .true.
RETURN
!
END IF
!
ENDDO
!
RETURN
!
END SUBROUTINE input_images_getarg
!----------------------------------------------------------------------------
SUBROUTINE close_io_units(myunit)
!-----------------------------------------------------------------------------

View File

@ -58,7 +58,7 @@ PROGRAM sm
INTEGER :: root = 0
!
CHARACTER(len=256) :: parsing_file_name
LOGICAL :: lfound
LOGICAL :: lfound_parsing_file, lfound_input_images
!
unit_tmp = 45
!
@ -74,18 +74,22 @@ PROGRAM sm
!
! ... open input file
!
CALL input_file_name_getarg(parsing_file_name,lfound)
CALL input_file_name_getarg(parsing_file_name,lfound_parsing_file)
!
engine_prefix = "pw_"
!
if(lfound) then
if(lfound_parsing_file) then
write(0,*) "parsing_file_name: ", trim(parsing_file_name)
call path_gen_inputs(trim(parsing_file_name),engine_prefix,input_images,root,neb_comm)
!
else
!
write(0,*) "NO input file found, assuming nothing to parse."
write(0,*) "Searching pre-build neb and engine input file."
write(0,*) "Searching argument -input_images or --input_images"
CALL input_images_getarg(input_images,lfound_input_images)
write(0,*) "Number of input images: ", input_images
!
IF(lfound_input_images==.false.) CALL errore('string_methods', 'Nor file to parse nor input images found',1)
!
endif
!