|
|
|
@ -29,7 +29,7 @@ module opt_group
|
|
|
|
|
remesh_size=0
|
|
|
|
|
displace=.false.
|
|
|
|
|
delete=.false.
|
|
|
|
|
! max_remesh=.false.
|
|
|
|
|
max_remesh=.false.
|
|
|
|
|
refine = .false.
|
|
|
|
|
|
|
|
|
|
if(allocated(element_index)) deallocate(element_index)
|
|
|
|
@ -262,7 +262,9 @@ module opt_group
|
|
|
|
|
!This command is used to remesh the group to a desired element size
|
|
|
|
|
|
|
|
|
|
integer :: i, j, k, ix, iy, iz, inod, ibasis, ie, type_interp(max_basisnum*max_esize**3), add_atom_num, orig_atom_num, &
|
|
|
|
|
current_esize, dof, max_lat(3), r_lat(3), ele(3,8), vlat(3), bd_in_lat(6), bd_in_array(3), old_ele, old_atom
|
|
|
|
|
current_esize, dof, max_lat(3), r_lat(3), ele(3,8), vlat(3), bd_in_lat(6), bd_in_array(3), old_ele, old_atom, &
|
|
|
|
|
max_loops, working_esize
|
|
|
|
|
|
|
|
|
|
real(kind=dp) :: r_interp(3, max_basisnum*max_esize**3), ori_inv(3,3), r(3), &
|
|
|
|
|
r_new_node(3,max_basisnum, max_ng_node), orient(3,3), group_in_lat(3,8)
|
|
|
|
|
logical, allocatable :: lat_points(:,:,:)
|
|
|
|
@ -352,48 +354,58 @@ module opt_group
|
|
|
|
|
old_atom = atom_num
|
|
|
|
|
old_ele = ele_num
|
|
|
|
|
|
|
|
|
|
!Now run remeshing algorithm, not the most optimized or efficient but gets the job done
|
|
|
|
|
|
|
|
|
|
ele = (remesh_size-1)*cubic_cell
|
|
|
|
|
|
|
|
|
|
!Now run remeshing algorithm, not the most optimized or efficient but gets the job done
|
|
|
|
|
!Figure out new looping boundaries
|
|
|
|
|
bd_in_array(1) = bd_in_lat(2) - bd_in_lat(1) + 10
|
|
|
|
|
bd_in_array(2) = bd_in_lat(4) - bd_in_lat(3) + 10
|
|
|
|
|
bd_in_array(3) = bd_in_lat(6) - bd_in_lat(5) + 10
|
|
|
|
|
|
|
|
|
|
zloop: do iz = 1, bd_in_array(3)
|
|
|
|
|
yloop: do iy = 1, bd_in_array(2)
|
|
|
|
|
xloop: do ix = 1, bd_in_array(1)
|
|
|
|
|
if (lat_points(ix, iy,iz)) then
|
|
|
|
|
|
|
|
|
|
!Check to see if the element overshoots the bound
|
|
|
|
|
if (iz+remesh_size-1 > bd_in_array(3)) then
|
|
|
|
|
exit zloop
|
|
|
|
|
else if (iy+remesh_size-1 > bd_in_array(2)) then
|
|
|
|
|
cycle zloop
|
|
|
|
|
else if (ix+remesh_size-1 > bd_in_array(1)) then
|
|
|
|
|
cycle yloop
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if (all(lat_points(ix:ix+remesh_size-1,iy:iy+remesh_size-1,iz:iz+remesh_size-1))) then
|
|
|
|
|
do inod = 1, 8
|
|
|
|
|
vlat = ele(:,inod) + (/ix, iy, iz /)
|
|
|
|
|
do i = 1, 3
|
|
|
|
|
vlat(i) = vlat(i) + bd_in_lat(2*i-1)-5
|
|
|
|
|
if (max_remesh) then
|
|
|
|
|
max_loops = (remesh_size-2)/2
|
|
|
|
|
else
|
|
|
|
|
max_loops = 1
|
|
|
|
|
end if
|
|
|
|
|
do j = 1, max_loops
|
|
|
|
|
working_esize = remesh_size - 2*(j-1)
|
|
|
|
|
ele = (working_esize-1)*cubic_cell
|
|
|
|
|
zloop: do iz = 1, bd_in_array(3)
|
|
|
|
|
yloop: do iy = 1, bd_in_array(2)
|
|
|
|
|
xloop: do ix = 1, bd_in_array(1)
|
|
|
|
|
if (lat_points(ix, iy,iz)) then
|
|
|
|
|
r_new_node(:,:,:) = 0.0_dp
|
|
|
|
|
|
|
|
|
|
!Check to see if the element overshoots the bound
|
|
|
|
|
if (iz+working_esize-1 > bd_in_array(3)) then
|
|
|
|
|
exit zloop
|
|
|
|
|
else if (iy+working_esize-1 > bd_in_array(2)) then
|
|
|
|
|
cycle zloop
|
|
|
|
|
else if (ix+working_esize-1 > bd_in_array(1)) then
|
|
|
|
|
cycle yloop
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if (all(lat_points(ix:ix+working_esize-1,iy:iy+working_esize-1,iz:iz+working_esize-1))) then
|
|
|
|
|
do inod = 1, ng_node(remesh_type)
|
|
|
|
|
vlat = ele(:,inod) + (/ix, iy, iz /)
|
|
|
|
|
do i = 1, 3
|
|
|
|
|
vlat(i) = vlat(i) + bd_in_lat(2*i-1)-5
|
|
|
|
|
end do
|
|
|
|
|
r_new_node(:,1,inod) = matmul(orient, matmul(fcc_mat, vlat))*remesh_lat_pam
|
|
|
|
|
end do
|
|
|
|
|
r_new_node(:,1,inod) = matmul(orient, matmul(fcc_mat, vlat))*remesh_lat_pam
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
lat_points(ix:ix+remesh_size-1,iy:iy+remesh_size-1,iz:iz+remesh_size-1) = .false.
|
|
|
|
|
!Add the element, for the sbox we just set it to the same sbox that we get the orientation from.
|
|
|
|
|
!In this case it is from the sbox of the first atom in the group.
|
|
|
|
|
call add_element(remesh_ele_type, remesh_size, remesh_type, sbox_atom(atom_index(1)),r_new_node)
|
|
|
|
|
lat_points(ix:ix+working_esize-1,iy:iy+working_esize-1,iz:iz+working_esize-1) = .false.
|
|
|
|
|
!Add the element, for the sbox we just set it to the same sbox that we get the orientation from.
|
|
|
|
|
!In this case it is from the sbox of the first atom in the group.
|
|
|
|
|
call add_element(remesh_ele_type, working_esize, remesh_type, sbox_atom(atom_index(1)),r_new_node)
|
|
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
end if
|
|
|
|
|
end if
|
|
|
|
|
end do xloop
|
|
|
|
|
end do yloop
|
|
|
|
|
end do zloop
|
|
|
|
|
end do xloop
|
|
|
|
|
end do yloop
|
|
|
|
|
end do zloop
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
!Now we have to add any leftover lattice points as atoms
|
|
|
|
|
do iz = 1, bd_in_array(3)
|
|
|
|
|