(git:d18deda)
Loading...
Searching...
No Matches
linear_systems.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2025 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!> \par History
12!> none
13!> \author JGH (30-5-2001)
14! **************************************************************************************************
16
17 USE kinds, ONLY: dp
18#include "../base/base_uses.f90"
19
20 IMPLICIT NONE
21
22 PRIVATE
23
24 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'linear_systems'
25
26 PUBLIC :: solve_system
27
28CONTAINS
29
30! **************************************************************************************************
31!> \brief ...
32!> \param matrix ...
33!> \param mysize ...
34!> \param eigenvectors ...
35! **************************************************************************************************
36 SUBROUTINE solve_system(matrix, mysize, eigenvectors)
37
38 REAL(kind=dp), INTENT(INOUT) :: matrix(:, :)
39 INTEGER, INTENT(IN) :: mysize
40 REAL(kind=dp), INTENT(INOUT) :: eigenvectors(:, :)
41
42 INTEGER :: info, lda, ldb, nrhs, ipiv(mysize)
43
44 lda = SIZE(matrix, 1)
45 ldb = SIZE(eigenvectors, 1)
46 nrhs = SIZE(eigenvectors, 2)
47
48 CALL dgesv(mysize, nrhs, matrix, lda, ipiv, &
49 eigenvectors, ldb, info)
50 IF (info /= 0) THEN
51 cpabort("Error in inversion")
52 END IF
53
54 END SUBROUTINE solve_system
55
56END MODULE linear_systems
57
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Provides interfaces to LAPACK routines for factorisation and linear system solving.
subroutine, public solve_system(matrix, mysize, eigenvectors)
...