diff --git a/README.md b/README.md index 1851f36..5d45ef3 100644 --- a/README.md +++ b/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. \ No newline at end of file +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. \ No newline at end of file diff --git a/src/call_option.f90 b/src/call_option.f90 index befb46c..60551af 100644 --- a/src/call_option.f90 +++ b/src/call_option.f90 @@ -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 \ No newline at end of file diff --git a/src/io.f90 b/src/io.f90 index 8fd139b..26d4250 100644 --- a/src/io.f90 +++ b/src/io.f90 @@ -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 diff --git a/src/main.f90 b/src/main.f90 index 7d24d6d..31f5f58 100644 --- a/src/main.f90 +++ b/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)