From 25f670a8e186b28dc7fc4adf803b57542c64542d Mon Sep 17 00:00:00 2001 From: Vikrant Tripathy Date: Wed, 2 Oct 2024 20:42:45 -0700 Subject: [PATCH] missed file from previous commit --- src/subs/symmetrize.f90 | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/subs/symmetrize.f90 diff --git a/src/subs/symmetrize.f90 b/src/subs/symmetrize.f90 new file mode 100644 index 00000000..4dccc710 --- /dev/null +++ b/src/subs/symmetrize.f90 @@ -0,0 +1,35 @@ +!---------------------------------------------------------! +! Symmetrize either upper or lower square matrix ! +! ! +! Parameters: ! +! UPLO 'U' ! +! 'L' ! +! mat N * N matrix ! +! N size of the matrix ! +!---------------------------------------------------------! + + subroutine symmetrize(UPLO,mat,N) + implicit none + + integer :: iatom, jatom, N + double precision :: mat(N,N) + character :: UPLO + + if (UPLO == 'U') then + do iatom = 2,N + do jatom = 1,iatom - 1 + mat(iatom,jatom) = mat(jatom,iatom) + end do + end do + else if (UPLO == 'L') then + do iatom = 2,N + do jatom = 1,iatom - 1 + mat(jatom,iatom) = mat(iatom,jatom) + end do + end do + else + call QuickErr('UPLO has to be either U or L in symmetrize') + Return + end if + + end subroutine symmetrize