(git:3d5d2e5)
Loading...
Searching...
No Matches
integral_library_types.F
Go to the documentation of this file.
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 Library choices for electronic integral APIs.
10! **************************************************************************************************
20 USE kinds, ONLY: default_path_length,&
21 dp
22
23 IMPLICIT NONE
24
25 PRIVATE
26
27 INTEGER, PARAMETER, PUBLIC :: library_native = 0, &
29
30#if defined(__LIBINT)
31 INTEGER, PARAMETER, PUBLIC :: default_coulomb_library = library_libint
32 LOGICAL, PARAMETER :: libint_available = .true.
33#else
34 INTEGER, PARAMETER, PUBLIC :: default_coulomb_library = library_native
35 LOGICAL, PARAMETER :: libint_available = .false.
36#endif
37
38 TYPE, PUBLIC :: integral_library_type
39 INTEGER :: coulomb2_library = default_coulomb_library
40 INTEGER :: coulomb3_library = default_coulomb_library
42
43 TYPE, PUBLIC :: coulomb_operator_type
44 INTEGER :: potential_type = do_potential_coulomb
45 REAL(dp) :: omega = 0.0_dp ! SR: erfc(omega*r)/r
46 REAL(dp) :: cutoff_radius = 0.0_dp ! TC cutoff/effective SR range
47 CHARACTER(default_path_length) :: filename = ""
48 REAL(dp) :: scale_coulomb = 0.0_dp ! Only for WFC methods
49 REAL(dp) :: scale_longrange = 0.0_dp ! Only for WFC methods
50 REAL(dp) :: scale_gaussian = 0.0_dp ! Gaussian coefficient in mixed operators
52
53 ! Enlarge the support slightly when screening the discontinuous truncated Coulomb operator.
54 REAL(dp), PARAMETER, PUBLIC :: cutoff_screen_factor = 1.0001_dp
55
57
59
60CONTAINS
61
62! **************************************************************************************************
63!> \brief Compare the parameters defining two radial operators.
64!> \param potential1 first operator
65!> \param potential2 second operator
66!> \return whether the operator selectors and their relevant parameters agree
67!> \note Table filenames and effective short-range screening cutoffs are excluded.
68! **************************************************************************************************
69 PURE FUNCTION compare_potential_types(potential1, potential2) RESULT(equals)
70 TYPE(coulomb_operator_type), INTENT(IN) :: potential1, potential2
71 LOGICAL :: equals
72
73 equals = .false.
74 IF (potential1%potential_type /= potential2%potential_type) RETURN
75
76 equals = .true.
77 SELECT CASE (potential1%potential_type)
79 IF (potential1%omega /= potential2%omega) equals = .false.
81 IF (potential1%cutoff_radius /= potential2%cutoff_radius) equals = .false.
83 IF (potential1%omega /= potential2%omega) equals = .false.
84 IF (potential1%scale_coulomb /= potential2%scale_coulomb) equals = .false.
85 IF (potential1%scale_longrange /= potential2%scale_longrange) equals = .false.
86 IF (potential1%potential_type == do_potential_mix_cl_trunc) THEN
87 IF (potential1%cutoff_radius /= potential2%cutoff_radius) equals = .false.
88 END IF
90 IF (potential1%omega /= potential2%omega) equals = .false.
91 IF (potential1%scale_longrange /= potential2%scale_longrange) equals = .false.
92 IF (potential1%scale_gaussian /= potential2%scale_gaussian) equals = .false.
93 END SELECT
94 END FUNCTION compare_potential_types
95
96! **************************************************************************************************
97!> \brief Resolves requested Coulomb integral libraries against the compiled-in backends.
98!> \param coulomb2_library requested two-center Coulomb integral library
99!> \param coulomb3_library requested three-center Coulomb integral library
100!> \param fallback_applied whether an unavailable Libint request was replaced by the native backend
101! **************************************************************************************************
102 SUBROUTINE integral_library_init(coulomb2_library, coulomb3_library, fallback_applied)
103 INTEGER, INTENT(IN) :: coulomb2_library, coulomb3_library
104 LOGICAL, INTENT(OUT) :: fallback_applied
105
106 active_integral_library%coulomb2_library = coulomb2_library
107 active_integral_library%coulomb3_library = coulomb3_library
108 fallback_applied = .false.
109
110 IF (.NOT. libint_available) THEN
111 IF (active_integral_library%coulomb2_library == library_libint) THEN
112 active_integral_library%coulomb2_library = library_native
113 fallback_applied = .true.
114 END IF
115 IF (active_integral_library%coulomb3_library == library_libint) THEN
116 active_integral_library%coulomb3_library = library_native
117 fallback_applied = .true.
118 END IF
119 END IF
120
121 END SUBROUTINE integral_library_init
122
123END MODULE integral_library_types
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_potential_mix_cl
integer, parameter, public do_potential_gaussian
integer, parameter, public do_potential_truncated
integer, parameter, public do_potential_mix_lg
integer, parameter, public do_potential_coulomb
integer, parameter, public do_potential_short
integer, parameter, public do_potential_mix_cl_trunc
integer, parameter, public do_potential_long
Library choices for electronic integral APIs.
real(dp), parameter, public cutoff_screen_factor
subroutine, public integral_library_init(coulomb2_library, coulomb3_library, fallback_applied)
Resolves requested Coulomb integral libraries against the compiled-in backends.
type(integral_library_type), save, public active_integral_library
integer, parameter, public default_coulomb_library
pure logical function, public compare_potential_types(potential1, potential2)
Compare the parameters defining two radial operators.
integer, parameter, public library_native
integer, parameter, public library_libint
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_path_length
Definition kinds.F:58