Add check for orientation to make sure it's right handed and orthogonal

master
Alex Selimov 4 years ago
parent 9038242b98
commit d2f3c9e3ec

@ -20,6 +20,7 @@ module opt_orient
integer, intent(inout) :: arg_pos
integer :: i, ibasis, inod
logical :: isortho, isrighthanded
real(kind=dp) :: inv_sub_box_ori(3,3,sub_box_num)
!First parse the orient command
@ -70,6 +71,7 @@ module opt_orient
integer, intent(inout) :: arg_pos
integer :: i, arg_len
logical :: isortho, isrighthanded
character(len=8) :: ori_string
!Pull out the new user orientation
@ -82,6 +84,15 @@ module opt_orient
!Normalize the orientation matrix
new_orient = matrix_normal(new_orient,3)
!Check right hand rule and orthogonality
call check_right_ortho(new_orient, isortho, isrighthanded)
if (.not.isortho) then
stop "Directions in orient are not orthogonal"
else if (.not.isrighthanded) then
stop "Directions in orient are not righthanded"
end if
arg_pos = arg_pos + 1
end subroutine parse_orient

Loading…
Cancel
Save