From d2f3c9e3ecdca19a6999fd1fb1291d4bcf8a2198 Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Wed, 4 Mar 2020 21:06:12 -0500 Subject: [PATCH] Add check for orientation to make sure it's right handed and orthogonal --- src/opt_orient.f90 | 11 +++++++++++ 1 file changed, 11 insertions(+) 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