|
|
|
@ -8,7 +8,7 @@ module opt_group
|
|
|
|
|
use box
|
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
|
|
integer :: group_ele_num, group_atom_num
|
|
|
|
|
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, wrap
|
|
|
|
@ -24,6 +24,7 @@ module opt_group
|
|
|
|
|
|
|
|
|
|
group_ele_num = 0
|
|
|
|
|
group_atom_num = 0
|
|
|
|
|
remesh_size=0
|
|
|
|
|
if(allocated(element_index)) deallocate(element_index)
|
|
|
|
|
if(allocated(atom_index)) deallocate(atom_index)
|
|
|
|
|
|
|
|
|
@ -34,6 +35,7 @@ module opt_group
|
|
|
|
|
!Now call the transformation functions for the group
|
|
|
|
|
if(displace) call displace_group
|
|
|
|
|
|
|
|
|
|
if(remesh_size > 0) call remesh_group
|
|
|
|
|
end subroutine group
|
|
|
|
|
|
|
|
|
|
subroutine parse_group(arg_pos)
|
|
|
|
@ -94,6 +96,11 @@ module opt_group
|
|
|
|
|
end do
|
|
|
|
|
case('wrap')
|
|
|
|
|
wrap = .true.
|
|
|
|
|
case('remesh')
|
|
|
|
|
arg_pos = arg_pos + 1
|
|
|
|
|
call get_command_argument(arg_pos, textholder, arglen)
|
|
|
|
|
if (arglen==0) stop "Missing remesh element size in group command"
|
|
|
|
|
read(textholder, *) remesh_size
|
|
|
|
|
case default
|
|
|
|
|
!If it isn't an available option to opt_disl then we just exit
|
|
|
|
|
exit
|
|
|
|
@ -197,4 +204,44 @@ module opt_group
|
|
|
|
|
|
|
|
|
|
end subroutine displace_group
|
|
|
|
|
|
|
|
|
|
subroutine remesh_group
|
|
|
|
|
!This command is used to remesh the group to a desired element size
|
|
|
|
|
|
|
|
|
|
integer :: i, j, ie, type_interp(max_basisnum*max_esize**3), add_atom_num
|
|
|
|
|
real(kind=dp) :: r_interp(3, max_basisnum*max_esize**3)
|
|
|
|
|
|
|
|
|
|
!Refining to atoms and remeshing to elements are different processes so check which code we need to run
|
|
|
|
|
select case(remesh_size)
|
|
|
|
|
|
|
|
|
|
!Refining to atoms
|
|
|
|
|
case(2)
|
|
|
|
|
if(group_ele_num > 0) then
|
|
|
|
|
!Estimate number of atoms we are adding, this doesn't have to be exact
|
|
|
|
|
add_atom_num = group_ele_num*basisnum(lat_ele(element_index(1)))*size_ele(element_index(1))**3
|
|
|
|
|
call grow_ele_arrays(0,add_atom_num)
|
|
|
|
|
|
|
|
|
|
do i = 1, group_ele_num
|
|
|
|
|
ie = element_index(i)
|
|
|
|
|
!Get the interpolated atom positions
|
|
|
|
|
call interpolate_atoms(type_ele(ie), size_ele(ie), lat_ele(ie), r_node(:,:,:,ie), type_interp, r_interp)
|
|
|
|
|
|
|
|
|
|
!Loop over all interpolated atoms and add them to the system, we apply periodic boundaries here as well to make sure
|
|
|
|
|
!they are in the box
|
|
|
|
|
do j = 1, basisnum(lat_ele(ie))*size_ele(ie)**3
|
|
|
|
|
call apply_periodic(r_interp(:,j))
|
|
|
|
|
call add_atom(type_interp(j), r_interp(:,j))
|
|
|
|
|
end do
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
!Once all atoms are added we delete all of the elements
|
|
|
|
|
call delete_elements(group_ele_num, element_index)
|
|
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
!Remeshing to elements, currently not available
|
|
|
|
|
case default
|
|
|
|
|
print *, "Remeshing to elements is currently not available. Please refine to atoms by passing a remsh size of 2"
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end subroutine remesh_group
|
|
|
|
|
end module opt_group
|