LCOV - code coverage report
Current view: top level - src - pexsi_interface.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:71c3ab0) Lines: 0.0 % 57 0
Test Date: 2026-07-25 06:35:44 Functions: 0.0 % 9 0

            Line data    Source code
       1              : !--------------------------------------------------------------------------------------------------!
       2              : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3              : !   Copyright 2000-2026 CP2K developers group <https://cp2k.org>                                   !
       4              : !                                                                                                  !
       5              : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6              : !--------------------------------------------------------------------------------------------------!
       7              : 
       8              : ! **************************************************************************************************
       9              : !> \brief Interface to the PEXSI library, providing wrappers for all PEXSI
      10              : !>        routines that are called inside CP2K. Requires PEXSI version 0.10.x.
      11              : !> \par History
      12              : !>       2014.12 created [Patrick Seewald]
      13              : !> \author Patrick Seewald
      14              : ! **************************************************************************************************
      15              : MODULE pexsi_interface
      16              : 
      17              : #if defined(__PEXSI)
      18              :    USE f_ppexsi_interface, ONLY: f_ppexsi_dft_driver, &
      19              :                                  f_ppexsi_load_real_hs_matrix, &
      20              :                                  f_ppexsi_options, &
      21              :                                  f_ppexsi_plan_finalize, &
      22              :                                  f_ppexsi_plan_initialize, &
      23              :                                  f_ppexsi_retrieve_real_dft_matrix, &
      24              :                                  f_ppexsi_set_default_options
      25              : #endif
      26              : #if defined(__HAS_IEEE_EXCEPTIONS)
      27              :    USE ieee_exceptions, ONLY: ieee_get_halting_mode, &
      28              :                               ieee_set_halting_mode, &
      29              :                               ieee_all
      30              : #endif
      31              :    USE kinds, ONLY: int_8, &
      32              :                     real_8
      33              :    USE ISO_C_BINDING, ONLY: C_INTPTR_T
      34              :    USE message_passing, ONLY: mp_comm_type
      35              : #include "./base/base_uses.f90"
      36              : 
      37              :    IMPLICIT NONE
      38              : 
      39              :    PRIVATE
      40              : 
      41              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'pexsi_interface'
      42              : 
      43              :    PUBLIC :: cp_pexsi_options, cp_pexsi_plan_initialize, &
      44              :              cp_pexsi_load_real_hs_matrix, cp_pexsi_dft_driver, &
      45              :              cp_pexsi_retrieve_real_dft_matrix, cp_pexsi_plan_finalize, &
      46              :              cp_pexsi_set_options, cp_pexsi_get_options, cp_pexsi_set_default_options
      47              : 
      48              :    TYPE cp_pexsi_options
      49              :       PRIVATE
      50              : #if defined(__PEXSI)
      51              :       TYPE(f_ppexsi_options) :: options
      52              : #else
      53              :       INTEGER :: unused = -1
      54              : #endif
      55              :    END TYPE cp_pexsi_options
      56              : 
      57              : CONTAINS
      58              : 
      59              : ! **************************************************************************************************
      60              : !> \brief Set PEXSI internal options
      61              : !> \param pexsi_options ...
      62              : !> \param temperature ...
      63              : !> \param gap ...
      64              : !> \param deltaE ...
      65              : !> \param numPole ...
      66              : !> \param isInertiaCount ...
      67              : !> \param maxPEXSIIter ...
      68              : !> \param muMin0 ...
      69              : !> \param muMax0 ...
      70              : !> \param mu0 ...
      71              : !> \param muInertiaTolerance ...
      72              : !> \param muInertiaExpansion ...
      73              : !> \param muPEXSISafeGuard ...
      74              : !> \param numElectronPEXSITolerance ...
      75              : !> \param matrixType ...
      76              : !> \param isSymbolicFactorize ...
      77              : !> \param ordering ...
      78              : !> \param rowOrdering ...
      79              : !> \param npSymbFact ...
      80              : !> \param verbosity ...
      81              : ! **************************************************************************************************
      82            0 :    SUBROUTINE cp_pexsi_set_options(pexsi_options, temperature, gap, deltaE, numPole, &
      83              :                                    isInertiaCount, maxPEXSIIter, muMin0, muMax0, mu0, &
      84              :                                    muInertiaTolerance, muInertiaExpansion, &
      85              :                                    muPEXSISafeGuard, numElectronPEXSITolerance, &
      86              :                                    matrixType, isSymbolicFactorize, ordering, rowOrdering, &
      87              :                                    npSymbFact, verbosity)
      88              : 
      89              :       TYPE(cp_pexsi_options), INTENT(INOUT)    :: pexsi_options
      90              :       REAL(KIND=real_8), INTENT(IN), OPTIONAL  :: temperature, gap, deltaE
      91              :       INTEGER, INTENT(IN), OPTIONAL            :: numPole, isInertiaCount, &
      92              :                                                   maxPEXSIIter
      93              :       REAL(KIND=real_8), INTENT(IN), OPTIONAL  :: muMin0, muMax0, mu0, &
      94              :                                                   muInertiaTolerance, muInertiaExpansion, muPEXSISafeGuard, &
      95              :                                                   numElectronPEXSITolerance
      96              :       INTEGER, INTENT(IN), OPTIONAL            :: matrixType, &
      97              :                                                   isSymbolicFactorize, &
      98              :                                                   ordering, rowOrdering, npSymbFact, &
      99              :                                                   verbosity
     100              : 
     101              : #if defined(__PEXSI)
     102              :       IF (PRESENT(temperature)) pexsi_options%options%temperature = temperature
     103              :       IF (PRESENT(gap)) pexsi_options%options%gap = gap
     104              :       IF (PRESENT(deltaE)) pexsi_options%options%deltaE = deltaE
     105              :       IF (PRESENT(numPole)) pexsi_options%options%numPole = numPole
     106              :       IF (PRESENT(isInertiaCount)) pexsi_options%options%isInertiaCount = isInertiaCount
     107              :       IF (PRESENT(maxPEXSIIter)) pexsi_options%options%maxPEXSIIter = maxPEXSIIter
     108              :       IF (PRESENT(muMin0)) pexsi_options%options%muMin0 = muMin0
     109              :       IF (PRESENT(muMax0)) pexsi_options%options%muMax0 = muMax0
     110              :       IF (PRESENT(mu0)) pexsi_options%options%mu0 = mu0
     111              :       IF (PRESENT(muInertiaTolerance)) THEN
     112              :          pexsi_options%options%muInertiaTolerance = muInertiaTolerance
     113              :       END IF
     114              :       IF (PRESENT(muInertiaExpansion)) THEN
     115              :          pexsi_options%options%muInertiaExpansion = muInertiaExpansion
     116              :       END IF
     117              :       IF (PRESENT(muPEXSISafeGuard)) THEN
     118              :          pexsi_options%options%muPEXSISafeGuard = muPEXSISafeGuard
     119              :       END IF
     120              :       IF (PRESENT(numElectronPEXSITolerance)) THEN
     121              :          pexsi_options%options%numElectronPEXSITolerance = numElectronPEXSITolerance
     122              :       END IF
     123              :       IF (PRESENT(matrixType)) pexsi_options%options%matrixType = matrixType
     124              :       IF (PRESENT(isSymbolicFactorize)) THEN
     125              :          pexsi_options%options%isSymbolicFactorize = isSymbolicFactorize
     126              :       END IF
     127              :       IF (PRESENT(ordering)) pexsi_options%options%ordering = ordering
     128              :       IF (PRESENT(rowOrdering)) pexsi_options%options%rowOrdering = rowOrdering
     129              :       IF (PRESENT(npSymbFact)) pexsi_options%options%npSymbFact = npSymbFact
     130              :       IF (PRESENT(verbosity)) pexsi_options%options%verbosity = verbosity
     131              : #else
     132              :       MARK_USED(pexsi_options)
     133              :       MARK_USED(temperature)
     134              :       MARK_USED(gap)
     135              :       MARK_USED(deltaE)
     136              :       MARK_USED(numPole)
     137              :       MARK_USED(isInertiaCount)
     138              :       MARK_USED(maxPEXSIIter)
     139              :       MARK_USED(muMin0)
     140              :       MARK_USED(muMax0)
     141              :       MARK_USED(mu0)
     142              :       MARK_USED(muInertiaTolerance)
     143              :       MARK_USED(muInertiaExpansion)
     144              :       MARK_USED(muPEXSISafeGuard)
     145              :       MARK_USED(numElectronPEXSITolerance)
     146              :       MARK_USED(matrixType)
     147              :       MARK_USED(isSymbolicFactorize)
     148              :       MARK_USED(ordering)
     149              :       MARK_USED(rowOrdering)
     150              :       MARK_USED(npSymbFact)
     151              :       MARK_USED(verbosity)
     152            0 :       CPABORT("Requires linking to the PEXSI library.")
     153              : #endif
     154              : 
     155              :       ! Additional PEXSI parameters and their defaults not made available here
     156              :       ! because CP2K should always use PEXSI's defaults:
     157              :       ! isConstructCommPattern (=?, pexsi does not even use it)
     158              :       ! symmetric (=1)
     159              :       ! transpose (=0)
     160            0 :    END SUBROUTINE cp_pexsi_set_options
     161              : 
     162              : ! **************************************************************************************************
     163              : !> \brief Access PEXSI internal options
     164              : !> \param pexsi_options ...
     165              : !> \param temperature ...
     166              : !> \param gap ...
     167              : !> \param deltaE ...
     168              : !> \param numPole ...
     169              : !> \param isInertiaCount ...
     170              : !> \param maxPEXSIIter ...
     171              : !> \param muMin0 ...
     172              : !> \param muMax0 ...
     173              : !> \param mu0 ...
     174              : !> \param muInertiaTolerance ...
     175              : !> \param muInertiaExpansion ...
     176              : !> \param muPEXSISafeGuard ...
     177              : !> \param numElectronPEXSITolerance ...
     178              : !> \param matrixType ...
     179              : !> \param isSymbolicFactorize ...
     180              : !> \param ordering ...
     181              : !> \param rowOrdering ...
     182              : !> \param npSymbFact ...
     183              : !> \param verbosity ...
     184              : ! **************************************************************************************************
     185            0 :    SUBROUTINE cp_pexsi_get_options(pexsi_options, temperature, gap, deltaE, numPole, &
     186              :                                    isInertiaCount, maxPEXSIIter, muMin0, muMax0, mu0, &
     187              :                                    muInertiaTolerance, muInertiaExpansion, &
     188              :                                    muPEXSISafeGuard, numElectronPEXSITolerance, &
     189              :                                    matrixType, isSymbolicFactorize, ordering, rowOrdering, &
     190              :                                    npSymbFact, verbosity)
     191              :       TYPE(cp_pexsi_options), INTENT(IN)       :: pexsi_options
     192              :       REAL(KIND=real_8), INTENT(OUT), OPTIONAL :: temperature, gap, deltaE
     193              :       INTEGER, INTENT(OUT), OPTIONAL           :: numPole, isInertiaCount, &
     194              :                                                   maxPEXSIIter
     195              :       REAL(KIND=real_8), INTENT(OUT), OPTIONAL :: muMin0, muMax0, mu0, &
     196              :                                                   muInertiaTolerance, muInertiaExpansion, muPEXSISafeGuard, &
     197              :                                                   numElectronPEXSITolerance
     198              :       INTEGER, INTENT(OUT), OPTIONAL           :: matrixType, &
     199              :                                                   isSymbolicFactorize, &
     200              :                                                   ordering, rowOrdering, npSymbFact, &
     201              :                                                   verbosity
     202              : 
     203              : #if defined(__PEXSI)
     204              :       IF (PRESENT(temperature)) temperature = pexsi_options%options%temperature
     205              :       IF (PRESENT(gap)) gap = pexsi_options%options%gap
     206              :       IF (PRESENT(deltaE)) deltaE = pexsi_options%options%deltaE
     207              :       IF (PRESENT(numPole)) numPole = pexsi_options%options%numPole
     208              :       IF (PRESENT(isInertiaCount)) isInertiaCount = pexsi_options%options%isInertiaCount
     209              :       IF (PRESENT(maxPEXSIIter)) maxPEXSIIter = pexsi_options%options%maxPEXSIIter
     210              :       IF (PRESENT(muMin0)) muMin0 = pexsi_options%options%muMin0
     211              :       IF (PRESENT(muMax0)) muMax0 = pexsi_options%options%muMax0
     212              :       IF (PRESENT(mu0)) mu0 = pexsi_options%options%mu0
     213              :       IF (PRESENT(muInertiaTolerance)) THEN
     214              :          muInertiaTolerance = pexsi_options%options%muInertiaTolerance
     215              :       END IF
     216              :       IF (PRESENT(muInertiaExpansion)) THEN
     217              :          muInertiaExpansion = pexsi_options%options%muInertiaExpansion
     218              :       END IF
     219              :       IF (PRESENT(muPEXSISafeGuard)) THEN
     220              :          muPEXSISafeGuard = pexsi_options%options%muPEXSISafeGuard
     221              :       END IF
     222              :       IF (PRESENT(numElectronPEXSITolerance)) THEN
     223              :          numElectronPEXSITolerance = pexsi_options%options%numElectronPEXSITolerance
     224              :       END IF
     225              :       IF (PRESENT(matrixType)) matrixType = pexsi_options%options%matrixType
     226              :       IF (PRESENT(isSymbolicFactorize)) THEN
     227              :          isSymbolicFactorize = pexsi_options%options%isSymbolicFactorize
     228              :       END IF
     229              :       IF (PRESENT(ordering)) ordering = pexsi_options%options%ordering
     230              :       IF (PRESENT(rowOrdering)) rowOrdering = pexsi_options%options%rowOrdering
     231              :       IF (PRESENT(npSymbFact)) npSymbFact = pexsi_options%options%npSymbFact
     232              :       IF (PRESENT(verbosity)) verbosity = pexsi_options%options%verbosity
     233              : #else
     234              :       MARK_USED(pexsi_options)
     235              :       ! assign intent-out arguments to silence compiler warnings
     236            0 :       IF (PRESENT(temperature)) temperature = 0.0_real_8
     237            0 :       IF (PRESENT(gap)) gap = 0.0_real_8
     238            0 :       IF (PRESENT(deltaE)) deltaE = 0.0_real_8
     239            0 :       IF (PRESENT(numPole)) numPole = -1
     240            0 :       IF (PRESENT(isInertiaCount)) isInertiaCount = -1
     241            0 :       IF (PRESENT(maxPEXSIIter)) maxPEXSIIter = -1
     242            0 :       IF (PRESENT(muMin0)) muMin0 = 0.0_real_8
     243            0 :       IF (PRESENT(muMax0)) muMax0 = 0.0_real_8
     244            0 :       IF (PRESENT(mu0)) mu0 = 0.0_real_8
     245            0 :       IF (PRESENT(muInertiaTolerance)) muInertiaTolerance = 0.0_real_8
     246            0 :       IF (PRESENT(muInertiaExpansion)) muInertiaExpansion = 0.0_real_8
     247            0 :       IF (PRESENT(muPEXSISafeGuard)) muPEXSISafeGuard = 0.0_real_8
     248            0 :       IF (PRESENT(numElectronPEXSITolerance)) numElectronPEXSITolerance = 0.0_real_8
     249            0 :       IF (PRESENT(matrixType)) matrixType = -1
     250            0 :       IF (PRESENT(isSymbolicFactorize)) isSymbolicFactorize = -1
     251            0 :       IF (PRESENT(ordering)) ordering = -1
     252            0 :       IF (PRESENT(rowOrdering)) rowOrdering = -1
     253            0 :       IF (PRESENT(npSymbFact)) npSymbFact = -1
     254            0 :       IF (PRESENT(verbosity)) verbosity = -1
     255            0 :       CPABORT("Requires linking to the PEXSI library.")
     256              : #endif
     257            0 :    END SUBROUTINE cp_pexsi_get_options
     258              : 
     259              : ! **************************************************************************************************
     260              : !> \brief ...
     261              : !> \param pexsi_options ...
     262              : ! **************************************************************************************************
     263            0 :    SUBROUTINE cp_pexsi_set_default_options(pexsi_options)
     264              :       TYPE(cp_pexsi_options), INTENT(OUT)      :: pexsi_options
     265              : 
     266              : #if defined(__PEXSI)
     267              :       CALL f_ppexsi_set_default_options(pexsi_options%options)
     268              : #else
     269            0 :       CPABORT("Requires linking to the PEXSI library.")
     270              : #endif
     271            0 :    END SUBROUTINE cp_pexsi_set_default_options
     272              : 
     273              : ! **************************************************************************************************
     274              : !> \brief ...
     275              : !> \param comm ...
     276              : !> \param numProcRow ...
     277              : !> \param numProcCol ...
     278              : !> \param outputFileIndex ...
     279              : !> \return ...
     280              : ! **************************************************************************************************
     281            0 :    FUNCTION cp_pexsi_plan_initialize(comm, numProcRow, numProcCol, outputFileIndex)
     282              :       TYPE(mp_comm_type), INTENT(IN) :: comm
     283              :       INTEGER, INTENT(IN)                      :: numProcRow, numProcCol, &
     284              :                                                   outputFileIndex
     285              :       INTEGER(KIND=C_INTPTR_T)                 :: cp_pexsi_plan_initialize
     286              : 
     287              : #if defined(__PEXSI)
     288              :       CHARACTER(LEN=*), PARAMETER              :: routineN = 'cp_pexsi_plan_initialize'
     289              :       INTEGER                                  :: info, handle
     290              : 
     291              :       CALL timeset(routineN, handle)
     292              :       cp_pexsi_plan_initialize = f_ppexsi_plan_initialize(comm%get_handle(), numProcRow, &
     293              :                                                           numProcCol, outputFileIndex, info)
     294              :       IF (info /= 0) THEN
     295              :          CPABORT("Pexsi returned an error. Consider logPEXSI0 for details.")
     296              :       END IF
     297              :       CALL timestop(handle)
     298              : #else
     299              :       MARK_USED(comm)
     300              :       MARK_USED(numProcRow)
     301              :       MARK_USED(numProcCol)
     302              :       MARK_USED(outputFileIndex)
     303            0 :       cp_pexsi_plan_initialize = 0
     304            0 :       CPABORT("Requires linking to the PEXSI library.")
     305              : #endif
     306            0 :    END FUNCTION cp_pexsi_plan_initialize
     307              : 
     308              : ! **************************************************************************************************
     309              : !> \brief ...
     310              : !> \param plan ...
     311              : !> \param pexsi_options ...
     312              : !> \param nrows ...
     313              : !> \param nnz ...
     314              : !> \param nnzLocal ...
     315              : !> \param numColLocal ...
     316              : !> \param colptrLocal ...
     317              : !> \param rowindLocal ...
     318              : !> \param HnzvalLocal ...
     319              : !> \param isSIdentity ...
     320              : !> \param SnzvalLocal ...
     321              : ! **************************************************************************************************
     322            0 :    SUBROUTINE cp_pexsi_load_real_hs_matrix(plan, pexsi_options, nrows, nnz, &
     323              :                                            nnzLocal, numColLocal, colptrLocal, &
     324              :                                            rowindLocal, HnzvalLocal, isSIdentity, &
     325              :                                            SnzvalLocal)
     326              :       INTEGER(KIND=C_INTPTR_T), INTENT(IN)     :: plan
     327              :       TYPE(cp_pexsi_options), INTENT(IN)       :: pexsi_options
     328              :       INTEGER, INTENT(IN)                      :: nrows, nnz, nnzLocal, &
     329              :                                                   numColLocal, colptrLocal(*), &
     330              :                                                   rowindLocal(*)
     331              :       REAL(KIND=real_8), INTENT(IN)            :: HnzvalLocal(*)
     332              :       INTEGER, INTENT(IN)                      :: isSIdentity
     333              :       REAL(KIND=real_8), INTENT(IN)            :: SnzvalLocal(*)
     334              : 
     335              : #if defined(__PEXSI)
     336              :       CHARACTER(LEN=*), PARAMETER              :: routineN = 'cp_pexsi_load_real_symmetric_hs_matrix'
     337              :       INTEGER                                  :: handle, info
     338              : 
     339              :       CALL timeset(routineN, handle)
     340              :       CALL f_ppexsi_load_real_hs_matrix(plan, pexsi_options%options, nrows, nnz, nnzLocal, &
     341              :                                         numColLocal, colptrLocal, rowindLocal, &
     342              :                                         HnzvalLocal, isSIdentity, SnzvalLocal, info)
     343              :       IF (info /= 0) THEN
     344              :          CPABORT("Pexsi returned an error. Consider logPEXSI0 for details.")
     345              :       END IF
     346              :       CALL timestop(handle)
     347              : #else
     348              :       MARK_USED(plan)
     349              :       MARK_USED(pexsi_options)
     350              :       MARK_USED(nrows)
     351              :       MARK_USED(nnz)
     352              :       MARK_USED(nnzLocal)
     353              :       MARK_USED(numColLocal)
     354              :       MARK_USED(isSIdentity)
     355            0 :       CPABORT("Requires linking to the PEXSI library.")
     356              : 
     357              :       ! MARK_USED macro does not work on assumed shape variables
     358              :       IF (.FALSE.) THEN
     359              :          DO
     360              :             IF (colptrLocal(1) > rowindLocal(1) .OR. HnzvalLocal(1) > SnzvalLocal(1)) EXIT
     361              :          END DO
     362              :       END IF
     363              : #endif
     364            0 :    END SUBROUTINE cp_pexsi_load_real_hs_matrix
     365              : 
     366              : ! **************************************************************************************************
     367              : !> \brief ...
     368              : !> \param plan ...
     369              : !> \param pexsi_options ...
     370              : !> \param numElectronExact ...
     371              : !> \param muPEXSI ...
     372              : !> \param numElectronPEXSI ...
     373              : !> \param muMinInertia ...
     374              : !> \param muMaxInertia ...
     375              : !> \param numTotalInertiaIter ...
     376              : !> \param numTotalPEXSIIter ...
     377              : ! **************************************************************************************************
     378            0 :    SUBROUTINE cp_pexsi_dft_driver(plan, pexsi_options, numElectronExact, muPEXSI, &
     379              :                                   numElectronPEXSI, muMinInertia, muMaxInertia, &
     380              :                                   numTotalInertiaIter, numTotalPEXSIIter)
     381              :       INTEGER(KIND=C_INTPTR_T), INTENT(IN)     :: plan
     382              :       TYPE(cp_pexsi_options), INTENT(IN)       :: pexsi_options
     383              :       REAL(KIND=real_8), INTENT(IN)            :: numElectronExact
     384              :       REAL(KIND=real_8), INTENT(out)           :: muPEXSI, numElectronPEXSI, &
     385              :                                                   muMinInertia, muMaxInertia
     386              :       INTEGER, INTENT(out)                     :: numTotalInertiaIter, &
     387              :                                                   numTotalPEXSIIter
     388              : 
     389              : #if defined(__PEXSI)
     390              :       CHARACTER(LEN=*), PARAMETER              :: routineN = 'cp_pexsi_dft_driver'
     391              :       INTEGER                                  :: handle, info
     392              : #if defined(__HAS_IEEE_EXCEPTIONS)
     393              :       LOGICAL, DIMENSION(5)                    :: halt
     394              : #endif
     395              : 
     396              :       CALL timeset(routineN, handle)
     397              : 
     398              :       ! Unfortuntatelly, some PEXSI kernels raise IEEE754 exceptions.
     399              :       ! Therefore, we disable floating point traps temporarily.
     400              : #if defined(__HAS_IEEE_EXCEPTIONS)
     401              :       CALL ieee_get_halting_mode(IEEE_ALL, halt)
     402              :       CALL ieee_set_halting_mode(IEEE_ALL, .FALSE.)
     403              : #endif
     404              : 
     405              :       CALL f_ppexsi_dft_driver(plan, pexsi_options%options, numElectronExact, muPEXSI, &
     406              :                                numElectronPEXSI, muMinInertia, muMaxInertia, &
     407              :                                numTotalInertiaIter, numTotalPEXSIIter, info)
     408              : 
     409              : #if defined(__HAS_IEEE_EXCEPTIONS)
     410              :       CALL ieee_set_halting_mode(IEEE_ALL, halt)
     411              : #endif
     412              : 
     413              :       IF (info /= 0) THEN
     414              :          CPABORT("Pexsi returned an error. Consider logPEXSI0 for details.")
     415              :       END IF
     416              :       CALL timestop(handle)
     417              : #else
     418              :       MARK_USED(plan)
     419              :       MARK_USED(numelectronexact)
     420              :       MARK_USED(pexsi_options)
     421              :       ! assign intent-out arguments to silence compiler warnings
     422            0 :       muPEXSI = 0.0_real_8
     423            0 :       numElectronPEXSI = 0.0_real_8
     424            0 :       muMinInertia = 0.0_real_8
     425            0 :       muMaxInertia = 0.0_real_8
     426            0 :       numTotalInertiaIter = -1
     427            0 :       numTotalPEXSIIter = -1
     428            0 :       CPABORT("Requires linking to the PEXSI library.")
     429              : #endif
     430            0 :    END SUBROUTINE cp_pexsi_dft_driver
     431              : 
     432              : ! **************************************************************************************************
     433              : !> \brief ...
     434              : !> \param plan ...
     435              : !> \param DMnzvalLocal ...
     436              : !> \param EDMnzvalLocal ...
     437              : !> \param FDMnzvalLocal ...
     438              : !> \param totalEnergyH ...
     439              : !> \param totalEnergyS ...
     440              : !> \param totalFreeEnergy ...
     441              : ! **************************************************************************************************
     442            0 :    SUBROUTINE cp_pexsi_retrieve_real_dft_matrix(plan, DMnzvalLocal, EDMnzvalLocal, &
     443              :                                                 FDMnzvalLocal, totalEnergyH, &
     444              :                                                 totalEnergyS, totalFreeEnergy)
     445              :       INTEGER(KIND=C_INTPTR_T), INTENT(IN)     :: plan
     446              :       REAL(KIND=real_8), INTENT(out)           :: DMnzvalLocal(*), EDMnzvalLocal(*), &
     447              :                                                   FDMnzvalLocal(*), totalEnergyH, totalEnergyS, &
     448              :                                                   totalFreeEnergy
     449              : 
     450              : #if defined(__PEXSI)
     451              :       CHARACTER(LEN=*), PARAMETER              :: routineN = 'cp_pexsi_retrieve_real_symmetric_dft_matrix'
     452              :       INTEGER                                  :: handle, info
     453              : 
     454              :       CALL timeset(routineN, handle)
     455              :       CALL f_ppexsi_retrieve_real_dft_matrix(plan, DMnzvalLocal, EDMnzvalLocal, &
     456              :                                              FDMnzvalLocal, totalEnergyH, &
     457              :                                              totalEnergyS, totalFreeEnergy, info)
     458              :       IF (info /= 0) THEN
     459              :          CPABORT("Pexsi returned an error. Consider logPEXSI0 for details.")
     460              :       END IF
     461              :       CALL timestop(handle)
     462              : #else
     463              :       MARK_USED(plan)
     464              :       ! assign intent-out arguments to silence compiler warnings
     465            0 :       DMnzvalLocal(1) = 0.0_real_8
     466            0 :       EDMnzvalLocal(1) = 0.0_real_8
     467            0 :       FDMnzvalLocal(1) = 0.0_real_8
     468            0 :       totalEnergyH = 0.0_real_8
     469            0 :       totalEnergyS = 0.0_real_8
     470            0 :       totalFreeEnergy = 0.0_real_8
     471              : 
     472            0 :       CPABORT("Requires linking to the PEXSI library.")
     473              : #endif
     474            0 :    END SUBROUTINE cp_pexsi_retrieve_real_dft_matrix
     475              : 
     476              : ! **************************************************************************************************
     477              : !> \brief ...
     478              : !> \param plan ...
     479              : ! **************************************************************************************************
     480            0 :    SUBROUTINE cp_pexsi_plan_finalize(plan)
     481              :       INTEGER(KIND=C_INTPTR_T), INTENT(IN)     :: plan
     482              : 
     483              : #if defined(__PEXSI)
     484              :       CHARACTER(LEN=*), PARAMETER              :: routineN = 'cp_pexsi_plan_finalize'
     485              :       INTEGER                                  :: info, handle
     486              : 
     487              :       CALL timeset(routineN, handle)
     488              :       CALL f_ppexsi_plan_finalize(plan, info)
     489              :       IF (info /= 0) THEN
     490              :          CPABORT("Pexsi returned an error. Consider logPEXSI0 for details.")
     491              :       END IF
     492              :       CALL timestop(handle)
     493              : #else
     494              :       MARK_USED(plan)
     495            0 :       CPABORT("Requires linking to the PEXSI library.")
     496              : #endif
     497            0 :    END SUBROUTINE cp_pexsi_plan_finalize
     498              : 
     499            0 : END MODULE pexsi_interface
        

Generated by: LCOV version 2.0-1