|
|
@ -54,8 +54,8 @@ module opt_group
|
|
|
|
!Parse the group command
|
|
|
|
!Parse the group command
|
|
|
|
integer, intent(inout) :: arg_pos
|
|
|
|
integer, intent(inout) :: arg_pos
|
|
|
|
|
|
|
|
|
|
|
|
integer :: i,arglen
|
|
|
|
integer :: i, j, arglen, in_num
|
|
|
|
character(len=100) :: textholder
|
|
|
|
character(len=100) :: textholder, type_spec
|
|
|
|
real(kind=dp) bwidth, wheight
|
|
|
|
real(kind=dp) bwidth, wheight
|
|
|
|
|
|
|
|
|
|
|
|
!Parse type and shape command
|
|
|
|
!Parse type and shape command
|
|
|
@ -130,6 +130,117 @@ module opt_group
|
|
|
|
vertices(i,3) = centroid(i) - bwidth
|
|
|
|
vertices(i,3) = centroid(i) - bwidth
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!Read the ID type shape for group
|
|
|
|
|
|
|
|
case('id')
|
|
|
|
|
|
|
|
arg_pos = arg_pos + 1
|
|
|
|
|
|
|
|
!For this type we have to call different options if type is atoms, elements, or both. Both is the most complex.
|
|
|
|
|
|
|
|
select case(trim(adjustl(type)))
|
|
|
|
|
|
|
|
case('atoms')
|
|
|
|
|
|
|
|
!Read number of ids
|
|
|
|
|
|
|
|
call get_command_argument(arg_pos, textholder, arglen)
|
|
|
|
|
|
|
|
if(arglen == 0) then
|
|
|
|
|
|
|
|
print *, "Missing number of input atoms for group id"
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
read(textholder,*) in_num
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!allocate arrays
|
|
|
|
|
|
|
|
allocate(atom_index(in_num))
|
|
|
|
|
|
|
|
!Read ids
|
|
|
|
|
|
|
|
do i = 1, in_num
|
|
|
|
|
|
|
|
arg_pos = arg_pos + 1
|
|
|
|
|
|
|
|
call get_command_argument(arg_pos, textholder, arglen)
|
|
|
|
|
|
|
|
if(arglen == 0) then
|
|
|
|
|
|
|
|
print *, "Missing atom id in group atom id"
|
|
|
|
|
|
|
|
stop 3
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
read(textholder,*) atom_index(i)
|
|
|
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
group_atom_num = in_num
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case('elements')
|
|
|
|
|
|
|
|
!Read number of ids
|
|
|
|
|
|
|
|
call get_command_argument(arg_pos, textholder, arglen)
|
|
|
|
|
|
|
|
if(arglen == 0) then
|
|
|
|
|
|
|
|
print *, "Missing number of input elements for group id"
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
read(textholder, *) in_num
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!allocate arrays
|
|
|
|
|
|
|
|
allocate(element_index(in_num))
|
|
|
|
|
|
|
|
!Read ids
|
|
|
|
|
|
|
|
do i = 1, in_num
|
|
|
|
|
|
|
|
arg_pos = arg_pos + 1
|
|
|
|
|
|
|
|
call get_command_argument(arg_pos, textholder, arglen)
|
|
|
|
|
|
|
|
if(arglen == 0) then
|
|
|
|
|
|
|
|
print *, "Missing element id in group element id"
|
|
|
|
|
|
|
|
stop 3
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
read(textholder,*) element_index(i)
|
|
|
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
group_ele_num = in_num
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case('both')
|
|
|
|
|
|
|
|
!We repeat this code twice, once for the atoms and once for the elements
|
|
|
|
|
|
|
|
allocate(element_index(1024),atom_index(1024))
|
|
|
|
|
|
|
|
do i = 1, 2
|
|
|
|
|
|
|
|
!Read the first id type (either atoms or elements)
|
|
|
|
|
|
|
|
call get_command_argument(arg_pos, type_spec, arglen)
|
|
|
|
|
|
|
|
if (arglen == 0) then
|
|
|
|
|
|
|
|
print *, "Missing type specifier in group id command"
|
|
|
|
|
|
|
|
stop 3
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!Now read the first in_num
|
|
|
|
|
|
|
|
arg_pos = arg_pos + 1
|
|
|
|
|
|
|
|
call get_command_argument(arg_pos, textholder, arglen)
|
|
|
|
|
|
|
|
if(arglen == 0) then
|
|
|
|
|
|
|
|
print *, "Missing input number in group_id"
|
|
|
|
|
|
|
|
stop 3
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
read(textholder, *) in_num
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select case(trim(adjustl(type_spec)))
|
|
|
|
|
|
|
|
case('atoms','atom')
|
|
|
|
|
|
|
|
if (group_atom_num > 0) then
|
|
|
|
|
|
|
|
print *, "Atoms specifier used more than once in group id command with type both, either use type ", &
|
|
|
|
|
|
|
|
"atoms or include elements identifier"
|
|
|
|
|
|
|
|
stop 3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do j = 1, in_num
|
|
|
|
|
|
|
|
arg_pos = arg_pos + 1
|
|
|
|
|
|
|
|
call get_command_argument(arg_pos, textholder, arglen)
|
|
|
|
|
|
|
|
if (arglen == 0) then
|
|
|
|
|
|
|
|
print *, "Missing atom id in group atom id"
|
|
|
|
|
|
|
|
stop 3
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
read(textholder, *) atom_index(j)
|
|
|
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
group_atom_num = in_num
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case('elements','element')
|
|
|
|
|
|
|
|
if (group_ele_num > 0) then
|
|
|
|
|
|
|
|
print *, "Elements specifier used more than once in group id command with type both, either use type ", &
|
|
|
|
|
|
|
|
"elements or include atoms identifier"
|
|
|
|
|
|
|
|
stop 3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do j = 1, in_num
|
|
|
|
|
|
|
|
arg_pos = arg_pos + 1
|
|
|
|
|
|
|
|
call get_command_argument(arg_pos, textholder, arglen)
|
|
|
|
|
|
|
|
if (arglen == 0) then
|
|
|
|
|
|
|
|
print *, "Missing element id in group element id"
|
|
|
|
|
|
|
|
stop 3
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
read(textholder, *) element_index(j)
|
|
|
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
group_ele_num = in_num
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
if(i ==1) arg_pos = arg_pos + 1
|
|
|
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
end select
|
|
|
|
case default
|
|
|
|
case default
|
|
|
|
print *, "Group shape ", trim(adjustl(shape)), " is not currently accepted. Please check documentation ", &
|
|
|
|
print *, "Group shape ", trim(adjustl(shape)), " is not currently accepted. Please check documentation ", &
|
|
|
|
"for accepted group shapes."
|
|
|
|
"for accepted group shapes."
|
|
|
@ -183,6 +294,9 @@ module opt_group
|
|
|
|
print *, "Group has block shape with boundaries: ", block_bd
|
|
|
|
print *, "Group has block shape with boundaries: ", block_bd
|
|
|
|
case ('crack')
|
|
|
|
case ('crack')
|
|
|
|
print *, "Group has crack shape with dim1", dim1, "and dim2", dim2, "and vertices ", vertices
|
|
|
|
print *, "Group has crack shape with dim1", dim1, "and dim2", dim2, "and vertices ", vertices
|
|
|
|
|
|
|
|
case('id')
|
|
|
|
|
|
|
|
print *, 'Group contains ', group_ele_num, " elements and ", group_atom_num, " atoms."
|
|
|
|
|
|
|
|
return
|
|
|
|
end select
|
|
|
|
end select
|
|
|
|
|
|
|
|
|
|
|
|
!Allocate variables to arbitrary size
|
|
|
|
!Allocate variables to arbitrary size
|
|
|
@ -274,7 +388,6 @@ module opt_group
|
|
|
|
real(kind=dp) :: r_interp(3, max_basisnum*max_esize**3)
|
|
|
|
real(kind=dp) :: r_interp(3, max_basisnum*max_esize**3)
|
|
|
|
|
|
|
|
|
|
|
|
!Refining to atoms
|
|
|
|
!Refining to atoms
|
|
|
|
|
|
|
|
|
|
|
|
if(group_ele_num > 0) then
|
|
|
|
if(group_ele_num > 0) then
|
|
|
|
orig_atom_num = atom_num
|
|
|
|
orig_atom_num = atom_num
|
|
|
|
!Estimate number of atoms we are adding, this doesn't have to be exact
|
|
|
|
!Estimate number of atoms we are adding, this doesn't have to be exact
|
|
|
|