Add first/last flag

development
Alex Selimov 3 years ago
parent 30dbd3bfc7
commit 5c50ce8765

@ -8,6 +8,7 @@ module opt_delete
implicit none
real(kind=dp) :: rc_off
logical :: first
public
contains
@ -34,6 +35,7 @@ module opt_delete
character(len=100) :: textholder
arg_pos = arg_pos + 1
first = .true.
call get_command_argument(arg_pos, textholder, arg_len)
if(arg_len==0) stop "Missing argument to delete command"
@ -49,6 +51,24 @@ module opt_delete
end select
arg_pos = arg_pos + 1
do while(.true.)
if(arg_pos > command_argument_count()) exit
!Pull out the next argument which should either be a keyword or an option
arg_pos=arg_pos+1
call get_command_argument(arg_pos, textholder)
textholder=adjustl(textholder)
select case(trim(textholder))
case('first')
first=.true.
case('last')
first=.false.
case default
!if it isn't an available option to opt_group then we just exit
exit
end select
end do
end subroutine parse_delete
subroutine delete_overlap
@ -99,7 +119,11 @@ module opt_delete
if (norm2(r_atom(:,nei)-r_atom(:,i)) < rc_off) then
delete_num = delete_num + 1
for_delete(delete_num) = max(i,nei)
if(first) then
for_delete(delete_num) = min(i,nei)
else
for_delete(delete_num) = max(i,nei)
end if
!Now zero out the larger index
if(i < nei) then

Loading…
Cancel
Save