diff --git a/src/opt_group.f90 b/src/opt_group.f90 index 3b40f14..59270b5 100644 --- a/src/opt_group.f90 +++ b/src/opt_group.f90 @@ -262,7 +262,7 @@ 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) + 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 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(:,:,:) @@ -303,6 +303,7 @@ module opt_group allocate(lat_points(bd_in_lat(2)-bd_in_lat(1)+10, bd_in_lat(4)-bd_in_lat(3)+10, bd_in_lat(6)-bd_in_lat(5)+10)) lat_points(:,:,:) = .false. + dof = 0 !Now place all group atoms and group interpolated atoms into lat_points do i = 1, group_atom_num @@ -317,6 +318,7 @@ module opt_group stop "Multiple atoms share same position in lat point array, this shouldn't happen" else lat_points(r_lat(1)-bd_in_lat(1)+5, r_lat(2)-bd_in_lat(3)+5, r_lat(3)-bd_in_lat(5)+5) = .true. + dof = dof + 1 end if end do @@ -336,14 +338,20 @@ module opt_group stop "Multiple atoms/interpolated atoms share same position in lat point array, this shouldn't happen" else lat_points(r_lat(1)-bd_in_lat(1)+5, r_lat(2)-bd_in_lat(3)+5, r_lat(3)-bd_in_lat(5)+5) = .true. + dof = dof + 1 end if end do end do + print *, "Group has ", dof, " degrees of freedom to remesh" + !Delete all elements and atoms to make space for new elements and atoms call delete_atoms(group_atom_num, atom_index) call delete_elements(group_ele_num, element_index) + 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 @@ -404,6 +412,8 @@ module opt_group end do end do + + print *, "Remeshing has created ", ele_num-old_ele, " elements and ", atom_num-old_atom, " atoms." end subroutine remesh_group subroutine delete_group