eigen_diag.F90 2.54 KB
Newer Older
1 2 3 4 5 6
!--------------------------------------------------------------------------------
! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
! This file is part of FLEUR and available as free software under the conditions
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------

7 8
MODULE m_eigen_diag
  USE m_juDFT
9 10 11 12
  USE m_available_solvers
  IMPLICIT NONE
  PRIVATE
  PUBLIC :: eigen_diag
Daniel Wortmann's avatar
Daniel Wortmann committed
13

14
CONTAINS
Daniel Wortmann's avatar
Daniel Wortmann committed
15

16
  SUBROUTINE eigen_diag(solver,hmat,smat,ne,eig,ev,ikpt,jsp,iter)
17
    USE m_lapack_diag
18
    USE m_magma
19
    USE m_elpa
20
    USE m_elpa_onenode
21
    USE m_scalapack
22
    USE m_elemental
23
!    USE m_chase_diag
24
    USE m_types_mpimat
Daniel Wortmann's avatar
Daniel Wortmann committed
25
    USE m_types_gpumat
26
!    USE m_matrix_copy
Daniel Wortmann's avatar
Daniel Wortmann committed
27
    USE m_cusolver_diag
28
    USE m_judft_usage
29
    USE m_writeout
30
    IMPLICIT NONE
31
    INTEGER,                   INTENT(INOUT) :: solver
32 33 34 35
    CLASS(t_mat),              INTENT(INOUT) :: smat,hmat
    CLASS(t_mat), ALLOCATABLE, INTENT(OUT)   :: ev
    INTEGER,                   INTENT(INOUT) :: ne
    REAL,                      INTENT(OUT)   :: eig(:)
36

37 38 39 40 41
    !Only for chase
    INTEGER,OPTIONAL,          INTENT(IN)    :: ikpt
    INTEGER,OPTIONAL,          INTENT(IN)    :: jsp
    INTEGER,OPTIONAL,          INTENT(IN)    :: iter

42
    !Locals  
43
    LOGICAL :: parallel
44

45
    SELECT TYPE(smat)
46
       CLASS IS (t_mpimat)
47
       parallel=.TRUE.
48
       CLASS default
49 50
       parallel=.FALSE.
    END SELECT
51

52 53
    solver=select_solver(solver,parallel)

54 55
    CALL timestart("Diagonalization")
    !Select the solver
56 57
    CALL add_usage_data("diag-solver", solver)
    SELECT CASE (solver)
58
    CASE (diag_elpa)
59
       CALL elpa_diag(hmat,smat,ne,eig,ev)
60 61
    CASE (diag_elpa_1node)
       CALL elpa_diag_onenode(hmat,smat,ne,eig,ev)
62 63 64 65 66 67
    CASE (diag_elemental)
       !CALL ELEMENTAL(hmat,smat,ne,eig,ev)
    CASE (diag_scalapack)
       CALL scalapack(hmat,smat,ne,eig,ev)
    CASE (diag_magma)
       !CALL magma_diag(hmat,smat,ne,eig,ev)
Daniel Wortmann's avatar
Daniel Wortmann committed
68 69
    CASE (diag_cusolver)
       CALL cusolver_diag(hmat,smat,ne,eig,ev)
70 71
    CASE (diag_lapack)
       CALL lapack_diag(hmat,smat,ne,eig,ev)
72
    CASE (diag_chase)
73
       IF (.NOT.(PRESENT(ikpt).AND.PRESENT(jsp).AND.PRESENT(iter))) CALL judft_error("Optional arguments must be present for chase in eigen_diag")
74
!       CALL chase_diag(hmat,smat,ikpt,jsp,iter,ne,eig,ev)
75
    CASE (diag_debugout)
76 77 78
       CALL diag_writeout(smat,hmat)
    CASE default
       CALL judft_error("No solver available to diagonalize matrix")
79
    END SELECT
80

81 82
  END SUBROUTINE eigen_diag

83

84
END MODULE m_eigen_diag