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), ALLOCATABLE :: 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 : ALLOCATE (pexsi_options%options)
268 : CALL f_ppexsi_set_default_options(pexsi_options%options)
269 : #else
270 0 : CPABORT("Requires linking to the PEXSI library.")
271 : #endif
272 0 : END SUBROUTINE cp_pexsi_set_default_options
273 :
274 : ! **************************************************************************************************
275 : !> \brief ...
276 : !> \param comm ...
277 : !> \param numProcRow ...
278 : !> \param numProcCol ...
279 : !> \param outputFileIndex ...
280 : !> \return ...
281 : ! **************************************************************************************************
282 0 : FUNCTION cp_pexsi_plan_initialize(comm, numProcRow, numProcCol, outputFileIndex)
283 : TYPE(mp_comm_type), INTENT(IN) :: comm
284 : INTEGER, INTENT(IN) :: numProcRow, numProcCol, &
285 : outputFileIndex
286 : INTEGER(KIND=C_INTPTR_T) :: cp_pexsi_plan_initialize
287 :
288 : #if defined(__PEXSI)
289 : CHARACTER(LEN=*), PARAMETER :: routineN = 'cp_pexsi_plan_initialize'
290 : INTEGER :: info, handle
291 :
292 : CALL timeset(routineN, handle)
293 : cp_pexsi_plan_initialize = f_ppexsi_plan_initialize(comm%get_handle(), numProcRow, &
294 : numProcCol, outputFileIndex, info)
295 : IF (info /= 0) THEN
296 : CPABORT("Pexsi returned an error. Consider logPEXSI0 for details.")
297 : END IF
298 : CALL timestop(handle)
299 : #else
300 : MARK_USED(comm)
301 : MARK_USED(numProcRow)
302 : MARK_USED(numProcCol)
303 : MARK_USED(outputFileIndex)
304 0 : cp_pexsi_plan_initialize = 0
305 0 : CPABORT("Requires linking to the PEXSI library.")
306 : #endif
307 0 : END FUNCTION cp_pexsi_plan_initialize
308 :
309 : ! **************************************************************************************************
310 : !> \brief ...
311 : !> \param plan ...
312 : !> \param pexsi_options ...
313 : !> \param nrows ...
314 : !> \param nnz ...
315 : !> \param nnzLocal ...
316 : !> \param numColLocal ...
317 : !> \param colptrLocal ...
318 : !> \param rowindLocal ...
319 : !> \param HnzvalLocal ...
320 : !> \param isSIdentity ...
321 : !> \param SnzvalLocal ...
322 : ! **************************************************************************************************
323 0 : SUBROUTINE cp_pexsi_load_real_hs_matrix(plan, pexsi_options, nrows, nnz, &
324 : nnzLocal, numColLocal, colptrLocal, &
325 : rowindLocal, HnzvalLocal, isSIdentity, &
326 : SnzvalLocal)
327 : INTEGER(KIND=C_INTPTR_T), INTENT(IN) :: plan
328 : TYPE(cp_pexsi_options), INTENT(IN) :: pexsi_options
329 : INTEGER, INTENT(IN) :: nrows, nnz, nnzLocal, &
330 : numColLocal, colptrLocal(*), &
331 : rowindLocal(*)
332 : REAL(KIND=real_8), INTENT(IN) :: HnzvalLocal(*)
333 : INTEGER, INTENT(IN) :: isSIdentity
334 : REAL(KIND=real_8), INTENT(IN) :: SnzvalLocal(*)
335 :
336 : #if defined(__PEXSI)
337 : CHARACTER(LEN=*), PARAMETER :: routineN = 'cp_pexsi_load_real_symmetric_hs_matrix'
338 : INTEGER :: handle, info
339 :
340 : CALL timeset(routineN, handle)
341 : CALL f_ppexsi_load_real_hs_matrix(plan, pexsi_options%options, nrows, nnz, nnzLocal, &
342 : numColLocal, colptrLocal, rowindLocal, &
343 : HnzvalLocal, isSIdentity, SnzvalLocal, info)
344 : IF (info /= 0) THEN
345 : CPABORT("Pexsi returned an error. Consider logPEXSI0 for details.")
346 : END IF
347 : CALL timestop(handle)
348 : #else
349 : MARK_USED(plan)
350 : MARK_USED(pexsi_options)
351 : MARK_USED(nrows)
352 : MARK_USED(nnz)
353 : MARK_USED(nnzLocal)
354 : MARK_USED(numColLocal)
355 : MARK_USED(isSIdentity)
356 0 : CPABORT("Requires linking to the PEXSI library.")
357 :
358 : ! MARK_USED macro does not work on assumed shape variables
359 : IF (.FALSE.) THEN
360 : DO
361 : IF (colptrLocal(1) > rowindLocal(1) .OR. HnzvalLocal(1) > SnzvalLocal(1)) EXIT
362 : END DO
363 : END IF
364 : #endif
365 0 : END SUBROUTINE cp_pexsi_load_real_hs_matrix
366 :
367 : ! **************************************************************************************************
368 : !> \brief ...
369 : !> \param plan ...
370 : !> \param pexsi_options ...
371 : !> \param numElectronExact ...
372 : !> \param muPEXSI ...
373 : !> \param numElectronPEXSI ...
374 : !> \param muMinInertia ...
375 : !> \param muMaxInertia ...
376 : !> \param numTotalInertiaIter ...
377 : !> \param numTotalPEXSIIter ...
378 : ! **************************************************************************************************
379 0 : SUBROUTINE cp_pexsi_dft_driver(plan, pexsi_options, numElectronExact, muPEXSI, &
380 : numElectronPEXSI, muMinInertia, muMaxInertia, &
381 : numTotalInertiaIter, numTotalPEXSIIter)
382 : INTEGER(KIND=C_INTPTR_T), INTENT(IN) :: plan
383 : TYPE(cp_pexsi_options), INTENT(IN) :: pexsi_options
384 : REAL(KIND=real_8), INTENT(IN) :: numElectronExact
385 : REAL(KIND=real_8), INTENT(out) :: muPEXSI, numElectronPEXSI, &
386 : muMinInertia, muMaxInertia
387 : INTEGER, INTENT(out) :: numTotalInertiaIter, &
388 : numTotalPEXSIIter
389 :
390 : #if defined(__PEXSI)
391 : CHARACTER(LEN=*), PARAMETER :: routineN = 'cp_pexsi_dft_driver'
392 : INTEGER :: handle, info
393 : #if defined(__HAS_IEEE_EXCEPTIONS)
394 : LOGICAL, DIMENSION(5) :: halt
395 : #endif
396 :
397 : CALL timeset(routineN, handle)
398 :
399 : ! Unfortuntatelly, some PEXSI kernels raise IEEE754 exceptions.
400 : ! Therefore, we disable floating point traps temporarily.
401 : #if defined(__HAS_IEEE_EXCEPTIONS)
402 : CALL ieee_get_halting_mode(IEEE_ALL, halt)
403 : CALL ieee_set_halting_mode(IEEE_ALL, .FALSE.)
404 : #endif
405 :
406 : CALL f_ppexsi_dft_driver(plan, pexsi_options%options, numElectronExact, muPEXSI, &
407 : numElectronPEXSI, muMinInertia, muMaxInertia, &
408 : numTotalInertiaIter, numTotalPEXSIIter, info)
409 :
410 : #if defined(__HAS_IEEE_EXCEPTIONS)
411 : CALL ieee_set_halting_mode(IEEE_ALL, halt)
412 : #endif
413 :
414 : IF (info /= 0) THEN
415 : CPABORT("Pexsi returned an error. Consider logPEXSI0 for details.")
416 : END IF
417 : CALL timestop(handle)
418 : #else
419 : MARK_USED(plan)
420 : MARK_USED(numelectronexact)
421 : MARK_USED(pexsi_options)
422 : ! assign intent-out arguments to silence compiler warnings
423 0 : muPEXSI = 0.0_real_8
424 0 : numElectronPEXSI = 0.0_real_8
425 0 : muMinInertia = 0.0_real_8
426 0 : muMaxInertia = 0.0_real_8
427 0 : numTotalInertiaIter = -1
428 0 : numTotalPEXSIIter = -1
429 0 : CPABORT("Requires linking to the PEXSI library.")
430 : #endif
431 0 : END SUBROUTINE cp_pexsi_dft_driver
432 :
433 : ! **************************************************************************************************
434 : !> \brief ...
435 : !> \param plan ...
436 : !> \param DMnzvalLocal ...
437 : !> \param EDMnzvalLocal ...
438 : !> \param FDMnzvalLocal ...
439 : !> \param totalEnergyH ...
440 : !> \param totalEnergyS ...
441 : !> \param totalFreeEnergy ...
442 : ! **************************************************************************************************
443 0 : SUBROUTINE cp_pexsi_retrieve_real_dft_matrix(plan, DMnzvalLocal, EDMnzvalLocal, &
444 : FDMnzvalLocal, totalEnergyH, &
445 : totalEnergyS, totalFreeEnergy)
446 : INTEGER(KIND=C_INTPTR_T), INTENT(IN) :: plan
447 : REAL(KIND=real_8), INTENT(out) :: DMnzvalLocal(*), EDMnzvalLocal(*), &
448 : FDMnzvalLocal(*), totalEnergyH, totalEnergyS, &
449 : totalFreeEnergy
450 :
451 : #if defined(__PEXSI)
452 : CHARACTER(LEN=*), PARAMETER :: routineN = 'cp_pexsi_retrieve_real_symmetric_dft_matrix'
453 : INTEGER :: handle, info
454 :
455 : CALL timeset(routineN, handle)
456 : CALL f_ppexsi_retrieve_real_dft_matrix(plan, DMnzvalLocal, EDMnzvalLocal, &
457 : FDMnzvalLocal, totalEnergyH, &
458 : totalEnergyS, totalFreeEnergy, info)
459 : IF (info /= 0) THEN
460 : CPABORT("Pexsi returned an error. Consider logPEXSI0 for details.")
461 : END IF
462 : CALL timestop(handle)
463 : #else
464 : MARK_USED(plan)
465 : ! assign intent-out arguments to silence compiler warnings
466 0 : DMnzvalLocal(1) = 0.0_real_8
467 0 : EDMnzvalLocal(1) = 0.0_real_8
468 0 : FDMnzvalLocal(1) = 0.0_real_8
469 0 : totalEnergyH = 0.0_real_8
470 0 : totalEnergyS = 0.0_real_8
471 0 : totalFreeEnergy = 0.0_real_8
472 :
473 0 : CPABORT("Requires linking to the PEXSI library.")
474 : #endif
475 0 : END SUBROUTINE cp_pexsi_retrieve_real_dft_matrix
476 :
477 : ! **************************************************************************************************
478 : !> \brief ...
479 : !> \param plan ...
480 : ! **************************************************************************************************
481 0 : SUBROUTINE cp_pexsi_plan_finalize(plan)
482 : INTEGER(KIND=C_INTPTR_T), INTENT(IN) :: plan
483 :
484 : #if defined(__PEXSI)
485 : CHARACTER(LEN=*), PARAMETER :: routineN = 'cp_pexsi_plan_finalize'
486 : INTEGER :: info, handle
487 :
488 : CALL timeset(routineN, handle)
489 : CALL f_ppexsi_plan_finalize(plan, info)
490 : IF (info /= 0) THEN
491 : CPABORT("Pexsi returned an error. Consider logPEXSI0 for details.")
492 : END IF
493 : CALL timestop(handle)
494 : #else
495 : MARK_USED(plan)
496 0 : CPABORT("Requires linking to the PEXSI library.")
497 : #endif
498 0 : END SUBROUTINE cp_pexsi_plan_finalize
499 :
500 0 : END MODULE pexsi_interface
|