Add wedge group shape option to opt_group.f90, update the documentation, and add the relevant functions to functions.f90

This commit is contained in:
Alex Selimov 2020-04-07 11:42:37 -04:00
parent 975e2b3fc1
commit 9a484c86f6
3 changed files with 140 additions and 51 deletions

View file

@ -155,8 +155,7 @@ END FUNCTION StrDnCase
end function in_bd_lat
function in_block_bd(v, box_bd)
!This function returns whether a point is within a block in 3d
!This function determines whether a point is within a block in 3d
!Input/output
real(kind=dp), dimension(3), intent(in) :: v
real(kind=dp), dimension(6), intent(in) :: box_bd
@ -180,6 +179,28 @@ END FUNCTION StrDnCase
end do
end function in_block_bd
function in_wedge_bd(r,vertex)
!This code determines whether the 2dimensional projection of a point lies within the 2 dimensional projection of a wedge.
real(kind=dp), intent(in) :: r(3) !This is the point position
real(kind=dp), intent(in) :: vertex(3,3) !These are the relevant vertex positions for the wedge
real(kind=dp) :: v1(3), v2(3), v3(3), c1(3), c2(3) !Vertex vector to point and cross products
integer :: i
logical :: in_wedge_bd
in_wedge_bd = .true.
do i = 1, 3
v1 = vertex(:,mod(i,3)+1) - vertex(:,i)
v2 = r - vertex(:,i)
v3 = vertex(:,mod(i+1,3)+1) - vertex(:,i)
c1 = cross_product(v1,v2)
c2 = cross_product(v1,v3)
if(dot_product(c1,c2) < 0) then
in_wedge_bd=.false.
exit
end if
end do
end function in_wedge_bd
function lcm(a,b)
!This function returns the smallest least common multiple of two numbers