diff --git a/README.md b/README.md index 8d13121..ea92157 100644 --- a/README.md +++ b/README.md @@ -219,6 +219,14 @@ 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. +**Delete** + +``` +delete +``` + +This command deletes all selected atoms and elements within the group. + ### Option overwrite ``` diff --git a/src/opt_group.f90 b/src/opt_group.f90 index 08167a6..65ab778 100644 --- a/src/opt_group.f90 +++ b/src/opt_group.f90 @@ -11,7 +11,7 @@ module opt_group integer :: group_ele_num, group_atom_num, remesh_size character(len=15) :: type, shape !Type indicates what element type is selected and shape is the group shape real(kind=dp) :: block_bd(6), disp_vec(3) - logical :: displace + logical :: displace, delete integer, allocatable :: element_index(:), atom_index(:) @@ -27,6 +27,9 @@ module opt_group group_ele_num = 0 group_atom_num = 0 remesh_size=0 + displace=.false. + delete=.false. + if(allocated(element_index)) deallocate(element_index) if(allocated(atom_index)) deallocate(atom_index) @@ -38,6 +41,8 @@ module opt_group if(displace) call displace_group if(remesh_size > 0) call remesh_group + + if(delete) call delete_group end subroutine group subroutine parse_group(arg_pos) @@ -101,6 +106,9 @@ module opt_group call get_command_argument(arg_pos, textholder, arglen) if (arglen==0) stop "Missing remesh element size in group command" read(textholder, *) remesh_size + case('delete') + arg_pos = arg_pos + 1 + delete=.true. case default !If it isn't an available option to opt_disl then we just exit exit @@ -246,4 +254,17 @@ module opt_group end subroutine remesh_group + + subroutine delete_group + !This subroutine deletes all atoms/elements within a group + + print *, "Deleting group containing ", group_atom_num, " atoms and ", group_ele_num, " elements." + + !Delete atoms + call delete_atoms(group_atom_num, atom_index) + + !Delete elements + call delete_elements(group_ele_num, element_index) + + end subroutine delete_group end module opt_group \ No newline at end of file