diff --git a/src/opt_orient.f90 b/src/opt_orient.f90 index 21d9d3f..c1bef1e 100644 --- a/src/opt_orient.f90 +++ b/src/opt_orient.f90 @@ -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