LCOV - code coverage report
Current view: top level - src/common - linear_systems.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:4dc10b3) Lines: 8 9 88.9 %
Date: 2024-11-21 06:45:46 Functions: 1 1 100.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------------------------!
       2             : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3             : !   Copyright 2000-2024 CP2K developers group <https://cp2k.org>                                   !
       4             : !                                                                                                  !
       5             : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6             : !--------------------------------------------------------------------------------------------------!
       7             : 
       8             : ! **************************************************************************************************
       9             : !> \brief Provides interfaces to LAPACK routines for factorisation and
      10             : !>      linear system solving
      11             : !> \note
      12             : !>      We are using LAPACK interfaces, so please make sure in IBM/AIX you have
      13             : !>      the lapack library before essl: "xlf90 ... -llapack -lessl" !!!
      14             : !> \par History
      15             : !>      none
      16             : !> \author JGH (30-5-2001)
      17             : ! **************************************************************************************************
      18             : MODULE linear_systems
      19             : 
      20             :    USE kinds,                           ONLY: dp
      21             :    USE lapack,                          ONLY: lapack_sgesv
      22             : #include "../base/base_uses.f90"
      23             : 
      24             :    IMPLICIT NONE
      25             : 
      26             :    PRIVATE
      27             : 
      28             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'linear_systems'
      29             : 
      30             :    PUBLIC :: solve_system
      31             : 
      32             : CONTAINS
      33             : 
      34             : ! **************************************************************************************************
      35             : !> \brief ...
      36             : !> \param matrix ...
      37             : !> \param mysize ...
      38             : !> \param eigenvectors ...
      39             : ! **************************************************************************************************
      40      659034 :    SUBROUTINE solve_system(matrix, mysize, eigenvectors)
      41             : 
      42             :       REAL(KIND=dp), INTENT(INOUT)                       :: matrix(:, :)
      43             :       INTEGER, INTENT(IN)                                :: mysize
      44             :       REAL(KIND=dp), INTENT(INOUT)                       :: eigenvectors(:, :)
      45             : 
      46     1318068 :       INTEGER                                            :: info, lda, ldb, nrhs, ipiv(mysize)
      47             : 
      48      659034 :       lda = SIZE(matrix, 1)
      49      659034 :       ldb = SIZE(eigenvectors, 1)
      50      659034 :       nrhs = SIZE(eigenvectors, 2)
      51             : 
      52             :       CALL lapack_sgesv(mysize, nrhs, matrix, lda, ipiv, &
      53      659034 :                         eigenvectors, ldb, info)
      54      659034 :       IF (info /= 0) THEN
      55           0 :          CPABORT("Error in inversion")
      56             :       END IF
      57             : 
      58      659034 :    END SUBROUTINE solve_system
      59             : 
      60             : END MODULE linear_systems
      61             : 

Generated by: LCOV version 1.15