diff --git a/src/opt_delete.f90 b/src/opt_delete.f90 index e099a76..e693510 100644 --- a/src/opt_delete.f90 +++ b/src/opt_delete.f90 @@ -82,6 +82,7 @@ module opt_delete integer, dimension(3) :: cell_num integer, allocatable :: num_in_cell(:,:,:), which_cell(:,:) integer, allocatable :: cell_list(:,:,:,:) + logical :: deleted_atom(atom_num) allocate(which_cell(3,atom_num)) @@ -90,6 +91,7 @@ module opt_delete !Now loop over every atom and figure out if it has neighbors within the rc_off delete_num = 0 + deleted_atom=.false. atom_loop: do i = 1, atom_num !c is the position of the cell that the atom belongs to @@ -113,7 +115,7 @@ module opt_delete !Check to make sure the atom isn't the same index as the atom we are checking !and that the neighbor hasn't already been deleted - if((nei /= i).and.(nei/= 0)) then + if((nei /= i).and.(.not.deleted_atom(nei))) then !Now check to see if it is in the cutoff radius, if it is add it to the delete code if (norm2(r_atom(:,nei)-r_atom(:,i)) < rc_off) then @@ -121,8 +123,10 @@ module opt_delete delete_num = delete_num + 1 if(first) then for_delete(delete_num) = min(i,nei) + deleted_atom(min(i,nei)) = .true. else for_delete(delete_num) = max(i,nei) + deleted_atom(max(i,nei)) = .true. end if !Now zero out the larger index