|
|
|
@ -358,4 +358,48 @@ module subroutines
|
|
|
|
|
return
|
|
|
|
|
end subroutine build_cell_list
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
subroutine check_right_ortho(ori, isortho, isrighthanded)
|
|
|
|
|
!This subroutine checks whether provided orientations in the form:
|
|
|
|
|
! | x1 x2 x3 |
|
|
|
|
|
! | y1 y2 y3 |
|
|
|
|
|
! | z1 z2 z3 |
|
|
|
|
|
!are right handed
|
|
|
|
|
|
|
|
|
|
real(kind=dp), dimension(3,3), intent(in) :: ori
|
|
|
|
|
logical, intent(out) :: isortho, isrighthanded
|
|
|
|
|
|
|
|
|
|
integer :: i, j
|
|
|
|
|
real(kind=dp) :: v(3), v_k(3)
|
|
|
|
|
!Initialize variables
|
|
|
|
|
isortho = .true.
|
|
|
|
|
isrighthanded=.true.
|
|
|
|
|
|
|
|
|
|
do i = 1, 3
|
|
|
|
|
do j = i+1, 3
|
|
|
|
|
|
|
|
|
|
if(abs(dot_product(ori(i,:), ori(j,:))) > lim_zero) then
|
|
|
|
|
isortho = .false.
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
!Check if they are righthanded
|
|
|
|
|
if (j == i+1) then
|
|
|
|
|
v(:) = cross_product(ori(i,:), ori(j,:))
|
|
|
|
|
v_k(:) = v(:) - ori(mod(j, 3)+1,:)
|
|
|
|
|
else if ((i==1).and.(j==3)) then
|
|
|
|
|
v(:) = cross_product(ori(j,:),ori(i,:))
|
|
|
|
|
v_k(:) = v(:) - ori(i+1, :)
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if(norm2(v_k) > 10.0_dp**(-8.0_dp)) then
|
|
|
|
|
isrighthanded=.false.
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
end subroutine check_right_ortho
|
|
|
|
|
|
|
|
|
|
end module subroutines
|