diff --git a/src/opt_group.f90 b/src/opt_group.f90 index 45029f2..c3edc8a 100644 --- a/src/opt_group.f90 +++ b/src/opt_group.f90 @@ -37,16 +37,27 @@ module opt_group call parse_group(arg_pos) - call get_group !Now call the transformation functions for the group - if(displace) call displace_group + if(refine) then + call get_group + call refine_group + end if - if(remesh_size > 0) call remesh_group + if(displace)then + call get_group + call displace_group + end if - if(delete) call delete_group + if(delete)then + call get_group + call delete_group + end if - if(refine) call refine_group + if(remesh_size > 0)then + call get_group + call remesh_group + end if end subroutine group @@ -360,7 +371,11 @@ module opt_group return end select - !Allocate variables to arbitrary size + !Reset group if needed + if(allocated(element_index)) deallocate(element_index,atom_index) + + group_ele_num = 0 + group_atom_num = 0 allocate(element_index(1024), atom_index(1024)) !Check the type to see whether we need to find the elements within the group select case(trim(adjustl(type)))