From e9521f43f36fc1e9c7abc1a915cce447ac1369ff Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Wed, 5 Feb 2020 11:33:59 -0500 Subject: [PATCH] Fix to formatting and cell neighbor loop algorithm --- src/opt_delete.f90 | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/opt_delete.f90 b/src/opt_delete.f90 index c178ab2..89123fc 100644 --- a/src/opt_delete.f90 +++ b/src/opt_delete.f90 @@ -42,12 +42,13 @@ module opt_delete call get_command_argument(arg_pos, textholder, arg_len) if(arg_len==0) stop "Missing argument to delete overlap command" print *, textholder - read(*, textholder) rc_off - + read(textholder, *) rc_off case default print *, "Command ", trim(adjustl(textholder)), " is not accepted for option delete" stop 3 end select + + arg_pos = arg_pos + 1 end subroutine parse_delete subroutine delete_overlap @@ -79,6 +80,13 @@ module opt_delete do ci = -1, 1, 1 do cj = -1, 1, 1 do ck = -1, 1, 1 + + if (any((c + (/ ck, cj, ci /)) == 0)) cycle + + if( (c(1) + ck > cell_num(1)).or.(c(2) + cj > cell_num(2)).or. & + (c(3) + ci > cell_num(3))) cycle + + do num_nei = 1, num_in_cell(c(1) + ck, c(2) + cj, c(3) + ci) nei = cell_list(num_nei,c(1) + ck, c(2) + cj, c(3) + ci) @@ -108,10 +116,10 @@ module opt_delete end do end if - !Now delete all the atoms - call delete_atoms(delete_num, for_delete(1:delete_num)) - end do atom_loop + print *, "Overlap command deletes ", delete_num, " atoms" + !Now delete all the atoms + call delete_atoms(delete_num, for_delete(1:delete_num)) end subroutine delete_overlap end module opt_delete \ No newline at end of file