Added keyword for group selection based on nodal position instead of centroid

development
Alex Selimov 5 years ago
parent 32ab5a6058
commit b28875b3e1

@ -11,7 +11,7 @@ module opt_group
integer :: group_ele_num, group_atom_num, remesh_size,normal, dim1, dim2 integer :: group_ele_num, group_atom_num, remesh_size,normal, dim1, dim2
character(len=15) :: type, shape !Type indicates what element type is selected and shape is the group shape 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 real(kind=dp) :: block_bd(6), centroid(3), vertices(3,3),disp_vec(3), tip_radius, bwidth
logical :: displace, delete, max_remesh, refine logical :: displace, delete, max_remesh, refine, group_nodes
integer, allocatable :: element_index(:), atom_index(:) integer, allocatable :: element_index(:), atom_index(:)
@ -334,6 +334,8 @@ module opt_group
max_remesh =.true. max_remesh =.true.
case('delete') case('delete')
delete=.true. delete=.true.
case('nodes')
group_nodes=.true.
case default case default
!If it isn't an available option to opt_disl then we just exit !If it isn't an available option to opt_disl then we just exit
exit exit
@ -363,6 +365,7 @@ module opt_group
!Check the type to see whether we need to find the elements within the group !Check the type to see whether we need to find the elements within the group
select case(trim(adjustl(type))) select case(trim(adjustl(type)))
case('elements', 'both') case('elements', 'both')
if(.not.(group_nodes)) then
do i = 1, ele_num do i = 1, ele_num
r_center(:) = 0.0_dp r_center(:) = 0.0_dp
do inod = 1, ng_node(lat_ele(i)) do inod = 1, ng_node(lat_ele(i))
@ -383,8 +386,27 @@ module opt_group
element_index(group_ele_num) = i element_index(group_ele_num) = i
end if end if
end do end do
else if(group_nodes) then
eleloop:do i = 1, ele_num
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
group_ele_num = group_ele_num + 1
if(group_ele_num > size(element_index)) then
allocate(resize_array(size(element_index) + 1024))
resize_array(1:group_ele_num-1) = element_index
resize_array(group_ele_num:) = 0
call move_alloc(resize_array, element_index)
end if
element_index(group_ele_num) = i
cycle eleloop
end if
end do
end do
end do eleloop
end if
end select end select
!Check the type to see if we need to find the atoms within the group !Check the type to see if we need to find the atoms within the group
select case(trim(adjustl(type))) select case(trim(adjustl(type)))
case('atoms','both') case('atoms','both')

Loading…
Cancel
Save