Added -ow option which allows for automatic overwriting
This commit is contained in:
parent
9ebdfff0a1
commit
a942b8e2a1
10
README.md
10
README.md
@ -217,4 +217,12 @@ This command wraps atoms back into the simulation cell as though periodic bounda
|
||||
remesh esize
|
||||
```
|
||||
|
||||
This command remeshes the atoms/elements within the group to the new element size `esize`. Currently only accepts an `esize` of 2 which refines it to full atomistics.
|
||||
This command remeshes the atoms/elements within the group to the new element size `esize`. Currently only accepts an `esize` of 2 which refines it to full atomistics.
|
||||
|
||||
### Option overwrite
|
||||
|
||||
```
|
||||
-ow
|
||||
```
|
||||
|
||||
If this option is passed then all files are automatically overwritten without asking the user.
|
@ -12,7 +12,11 @@ subroutine call_option(option, arg_pos)
|
||||
call dislocation(option, arg_pos)
|
||||
case('-group')
|
||||
call group(arg_pos)
|
||||
case('-ow')
|
||||
arg_pos = arg_pos + 1
|
||||
continue
|
||||
case default
|
||||
print *, 'Option ', trim(adjustl(option)), ' is not currently accepted.'
|
||||
print *, 'Option ', trim(adjustl(option)), ' is not currently accepted. Skipping to next argument'
|
||||
arg_pos = arg_pos + 1
|
||||
end select
|
||||
end subroutine call_option
|
@ -9,7 +9,7 @@ module io
|
||||
|
||||
integer :: outfilenum = 0, infilenum = 0
|
||||
character(len=100) :: outfiles(10), infiles(10)
|
||||
|
||||
logical :: force_overwrite
|
||||
|
||||
public
|
||||
contains
|
||||
@ -38,7 +38,7 @@ module io
|
||||
|
||||
!Check to see if file exists, if it does then ask user if they would like to overwrite the file
|
||||
inquire(file=trim(temp_outfile), exist=file_exists)
|
||||
if (file_exists) then
|
||||
if (file_exists.and.(.not.(force_overwrite))) then
|
||||
if (overwrite == 'r') print *, "File ", trim(temp_outfile), " already exists. Would you like to overwrite? (Y/N)"
|
||||
read(*,*) overwrite
|
||||
if((scan(overwrite, "n") > 0).or.(scan(overwrite, "N") > 0)) then
|
||||
|
12
src/main.f90
12
src/main.f90
@ -37,11 +37,23 @@ program main
|
||||
!Call initialization functions
|
||||
call lattice_init
|
||||
call box_init
|
||||
force_overwrite=.false.
|
||||
|
||||
end_mode_arg = 0
|
||||
|
||||
! Command line parsing
|
||||
arg_num = command_argument_count()
|
||||
|
||||
!Check to see if overwrite flag is passed
|
||||
do i = 1, arg_num
|
||||
call get_command_argument(i,argument)
|
||||
select case(trim(adjustl(argument)))
|
||||
|
||||
case('-ow')
|
||||
force_overwrite = .true.
|
||||
print *, "Overwrite flag passed, output files will be overwritten"
|
||||
end select
|
||||
end do
|
||||
!Determine if a mode is being used and what it is. The first argument has to be the mode
|
||||
!if a mode is being used
|
||||
call get_command_argument(1, argument)
|
||||
|
Loading…
x
Reference in New Issue
Block a user