GRAMSCHMIDT_NECI Subroutine

public subroutine GRAMSCHMIDT_NECI(MAT, LEN)

Arguments

Type IntentOptional Attributes Name
real(kind=dp) :: MAT(LEN,LEN)
integer :: LEN

Contents

Source Code


Source Code

    SUBROUTINE GRAMSCHMIDT_NECI(MAT, LEN)
        INTEGER LEN
        HElement_t(dp) MAT(LEN, LEN), DOT
        real(dp) NORM, SNORM
        INTEGER I, J, K
        DO I = 1, LEN
    ! First dot with all lower vectors, and remove their components
            DO J = 1, I - 1
                DOT = 0.0_dp
                NORM = 0.0_dp
                DO K = 1, LEN
#ifdef CMPLX_
                    DOT = DOT + conjg(MAT(K, J)) * MAT(K, I)
#else
                    DOT = DOT + (MAT(K, J)) * MAT(K, I)
#endif
                end do
                DO K = 1, LEN
                    MAT(K, I) = MAT(K, I) - MAT(K, J) * DOT
                end do
            end do
            NORM = 0.0_dp
            DO K = 1, LEN
                NORM = NORM + abs(MAT(K, I))**2
            end do
            SNORM = SQRT(NORM)
    !            write(stdout,*) NORM
            DO K = 1, LEN
    !               write(stdout,*) MAT(K,I),MAT(K,I)/SNORM
                MAT(K, I) = MAT(K, I) / (SNORM)
            end do
        end do
        RETURN
    END SUBROUTINE GRAMSCHMIDT_NECI