From 65c2b380cd4936b066938dbeae866cefb7bfdd31 Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Wed, 27 May 2020 14:53:44 -0400 Subject: [PATCH] Added flip option to group to invert group selection --- README.md | 24 +++++++++++++++++++----- src/opt_group.f90 | 11 +++++++---- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 93955f4..4c4e5ed 100644 --- a/README.md +++ b/README.md @@ -185,15 +185,15 @@ This option creates a circular planar vacancy cluster of radius `radius` normal `-group select_type group_shape shape_arguments additional keywords` -This option selects a group of either elements, nodes, atoms and applies some transformation to them. +This option selects a group of either elements or atoms and applies some transformation to them. -`select_type` - Either `nodes`, `atoms`, `elements`, `nodes/atoms`, `all`. When using the option `nodes` only nodes which are within the group are selected, `elements` selects elements based on whether the element center is within the group, `nodes/atoms` selects both nodes and atoms for the group. `all` selects elements based on the element center and atoms based on their position. + `select_type` - Either `atoms`, `elements`, or 'both'. `elements` selects elements based on whether the element center is within the group. `both` selects elements based on the element center and atoms based on their position. `group_shape` - Specifies what shape the group takes and dictates which options must be passed. Each shape requires different arguments and these arguments are represented by the placeholder `shape_arguments`. The accepted group shapes and arguments are below: *Block:* -`-group nodes block xlo xhi ylo yhi zlo zhi` +`-group atoms block xlo xhi ylo yhi zlo zhi` This selects a group residing in a block with edges perpendicular to the simulation cell. The block boundaries are given by `xlo xhi ylo yhi zlo zhi`. @@ -201,7 +201,7 @@ This selects a group residing in a block with edges perpendicular to the simulat *Wedge:* -`-group nodes wedge dim1 dim2 bx by bz bw` +`-group atoms wedge dim1 dim2 bx by bz bw` This selects a group which are within a wedge shape. The options are given as follows: `dim1` - The dimension containing the plane normal of the wedge base. `dim2` - The thickness dimension. Wedge groups are currently required to span the entire cell thickness in one dimensions which is normal to the triangular face. This through thickness dimension is dim2. @@ -210,7 +210,7 @@ This selects a group which are within a wedge shape. The options are given as fo *Notch:* -`-group nodes notch dim1 dim2 bx by bz bw tr` +`-group atoms notch dim1 dim2 bx by bz bw tr` This shape is similar to a wedge shape except instead of becoming atomically sharp, it finishes in a rounded tip with tip radius `tr`. Options are as follows. `dim1` - The dimension containing the plane normal of the wedge base. `dim2` - The thickness dimension. Wedge groups are currently required to span the entire cell thickness in one dimensions which is normal to the triangular face. This through thickness dimension is dim2. @@ -266,7 +266,21 @@ random n This command selects `n` random atoms and `n` random elements within your group bounds. If using group type `atoms` or `elements` then only `n` random atoms or elements are selected. This random atoms/elements then form the new group. +**Nodes** +``` +nodes +``` + +This keyword changes the selection criteria when using `elements` or `both` to element nodes instead of element centroids. + +**Flip** + +``` +flip +``` + +This keyword changes the group selection criteria from the atoms/elements inside a region to the atoms/elements outside the group. ### Option overwrite ``` diff --git a/src/opt_group.f90 b/src/opt_group.f90 index f0bb067..080d0e6 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,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))