From 4c75fac13ce1cfe0038e36ba17f830cf4661fe6c Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Sun, 13 Sep 2020 15:47:55 -0400 Subject: [PATCH] Working change group type command --- src/opt_group.f90 | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/opt_group.f90 b/src/opt_group.f90 index eea9424..03dfd68 100644 --- a/src/opt_group.f90 +++ b/src/opt_group.f90 @@ -28,6 +28,7 @@ module opt_group group_atom_num = 0 remesh_size=0 random_num=0 + group_type=0 displace=.false. delete=.false. max_remesh=.false. @@ -61,6 +62,11 @@ module opt_group call remesh_group end if + if(group_type > 0) then + call get_group + call change_group_type + end if + end subroutine group subroutine parse_group(arg_pos) @@ -371,6 +377,11 @@ module opt_group read(textholder, *) random_num case('flip') flip=.true. + case('type') + arg_pos = arg_pos + 1 + call get_command_argument(arg_pos, textholder, arglen) + if (arglen==0) stop "Missing atom type for group" + call add_atom_type(textholder, group_type) case default !If it isn't an available option to opt_disl then we just exit exit @@ -851,11 +862,29 @@ module opt_group end subroutine delete_group - subroutine change_group + subroutine change_group_type !This subroutine changes all atoms and nodes at atoms within a group to a specific type + integer :: i, j, ltype,ibasis, inod, basis_type(10) + + print *, "Changing ", group_atom_num, " atoms and ", group_ele_num, " elements to atom type ", group_type + + !Change all atom group types + do i = 1, group_atom_num + j = atom_index(i) + type_atom(j) = group_type + end do + + !Map to a new lattice type for all element + do i =1, group_ele_num + j = element_index(i) + ltype = lat_ele(j) + do ibasis = 1, basisnum(ltype) + basis_type(ibasis) = group_type + end do + call lattice_map(basisnum(ltype), basis_type, ng_node(ltype), lapa(ltype), lat_ele(j)) + end do - print *, "Changing ", group_atom_num " atoms and ", group_ele_num, " elements to atom type ", group_type - end subroutine change_group + end subroutine change_group_type function in_group(r) !This subroutine determines if a point is within the group boundaries