-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8e3147
commit 25f670a
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |