Added flip option to group to invert group selection

This commit is contained in:
Alex Selimov 2020-05-27 14:53:44 -04:00
parent 43025d0b67
commit 65c2b380cd
2 changed files with 26 additions and 9 deletions

View file

@ -11,7 +11,7 @@ module opt_group
integer :: group_ele_num, group_atom_num, remesh_size,normal, dim1, dim2, random_num
character(len=15) :: type, shape !Type indicates what element type is selected and shape is the group shape
real(kind=dp) :: block_bd(6), centroid(3), vertices(3,3),disp_vec(3), tip_radius, bwidth
logical :: displace, delete, max_remesh, refine, group_nodes
logical :: displace, delete, max_remesh, refine, group_nodes, flip
integer, allocatable :: element_index(:), atom_index(:)
@ -32,6 +32,7 @@ module opt_group
delete=.false.
max_remesh=.false.
refine = .false.
flip = .false.
if(allocated(element_index)) deallocate(element_index)
if(allocated(atom_index)) deallocate(atom_index)
@ -353,6 +354,8 @@ module opt_group
call get_command_argument(arg_pos, textholder, arglen)
if (arglen==0) stop "Missing number of random atoms in group command"
read(textholder, *) random_num
case('flip')
flip=.true.
case default
!If it isn't an available option to opt_disl then we just exit
exit
@ -398,7 +401,7 @@ module opt_group
end do
end do
if (in_group(r_center)) then
if (in_group(r_center).neqv.flip) then
group_ele_num = group_ele_num + 1
if(group_ele_num > size(element_index)) then
allocate(resize_array(size(element_index) + 1024))
@ -416,7 +419,7 @@ module opt_group
r_center(:) = 0.0_dp
do inod = 1, ng_node(lat_ele(i))
do ibasis = 1, basisnum(lat_ele(i))
if (in_group(r_node(:,ibasis,inod,i))) then
if (in_group(r_node(:,ibasis,inod,i)).neqv.flip) then
group_ele_num = group_ele_num + 1
if(group_ele_num > size(element_index)) then
allocate(resize_array(size(element_index) + 1024))
@ -451,7 +454,7 @@ module opt_group
select case(trim(adjustl(type)))
case('atoms','both')
do i = 1, atom_num
if(in_group(r_atom(:,i))) then
if(in_group(r_atom(:,i)).neqv.flip) then
group_atom_num = group_atom_num + 1
if (group_atom_num > size(atom_index)) then
allocate(resize_array(size(atom_index) + 1024))