(git:374b731)
Loading...
Searching...
No Matches
semi_empirical_expns3_methods.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Methods for handling the 1/R^3 residual integral part
10!> \author Teodoro Laino (12.2008) [tlaino]
11! **************************************************************************************************
15 USE kinds, ONLY: dp
16 USE qs_kind_types, ONLY: get_qs_kind,&
25#include "./base/base_uses.f90"
26
27 IMPLICIT NONE
28 PRIVATE
29 LOGICAL, PARAMETER, PRIVATE :: debug_this_module = .false.
30 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'semi_empirical_expns3_methods'
31
33
34CONTAINS
35! **************************************************************************************************
36!> \brief Setup the quantity necessary to handle the slowly convergent
37!> residual integral term 1/R^3
38!>
39!> \param qs_kind_set ...
40!> \param se_control ...
41!> \param method_id ...
42!> \date 12.2008 [tlaino]
43!> \author Teodoro Laino [tlaino]
44! **************************************************************************************************
45 SUBROUTINE semi_empirical_expns3_setup(qs_kind_set, se_control, method_id)
46 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
47 TYPE(semi_empirical_control_type), POINTER :: se_control
48 INTEGER, INTENT(IN) :: method_id
49
50 INTEGER :: i, itype, j, nkinds
51 LOGICAL :: check
52 TYPE(semi_empirical_type), POINTER :: sepi, sepj
53
54 IF (se_control%do_ewald_r3) THEN
55 NULLIFY (sepi, sepj)
56 nkinds = SIZE(qs_kind_set)
57 DO i = 1, nkinds
58 CALL get_qs_kind(qs_kind_set(i), se_parameter=sepi)
59 check = .NOT. ASSOCIATED(sepi%expns3_int)
60 cpassert(check)
61 ALLOCATE (sepi%expns3_int(nkinds))
62 DO j = 1, nkinds
63 NULLIFY (sepi%expns3_int(j)%expns3)
64 CALL semi_empirical_expns3_create(sepi%expns3_int(j)%expns3)
65 END DO
66 END DO
67
68 itype = get_se_type(method_id)
69 DO i = 1, nkinds
70 CALL get_qs_kind(qs_kind_set(i), se_parameter=sepi)
71 DO j = 1, nkinds
72 CALL get_qs_kind(qs_kind_set(j), se_parameter=sepj)
73 CALL setup_c3_coeff(sepi, sepj, i, j, itype)
74 END DO
75 END DO
76 END IF
77 END SUBROUTINE semi_empirical_expns3_setup
78
79! **************************************************************************************************
80!> \brief For any given semi-empirical pair i,j evaluates the coefficient of
81!> the integral residual part ( 1/r^3 term )
82!> The integral expression, unfortunately, does not allow any kind of
83!> separability. It is, therefore, mandatory to compute this coefficient
84!> as a pair term, instead of as an atomic quantity.
85!>
86!> \param sepi ...
87!> \param sepj ...
88!> \param ikind ...
89!> \param jkind ...
90!> \param itype ...
91!> \date 12.2008 [tlaino]
92!> \author Teodoro Laino [tlaino]
93! **************************************************************************************************
94 SUBROUTINE setup_c3_coeff(sepi, sepj, ikind, jkind, itype)
95 TYPE(semi_empirical_type), POINTER :: sepi, sepj
96 INTEGER, INTENT(IN) :: ikind, jkind, itype
97
98 INTEGER :: i, ij, j, kl, kr, li, lk
99 REAL(kind=dp) :: core_core, e1b(9), e2a(9), r, zi, zj
100
101! Set the distance to 0 (the coefficient is anyway independent of the atomic
102! position)
103
104 r = 0.0_dp
105 ! Nuclei-Nuclei contribution
106 ij = indexa(1, 1)
107 zi = -sepi%zeff
108 zj = -sepj%zeff
109 core_core = ijkl_low_3(sepi, sepj, ij, ij, 0, 0, 0, 0, -1, r, itype, coeff_int_3)*zi*zj
110
111 ! Electron(i)-Nuclei(j) contribution
112 kl = indexa(1, 1)
113 e1b(1) = ijkl_low_3(sepi, sepj, kl, ij, 0, 0, 0, 0, 2, r, itype, coeff_int_3)*zj
114 IF (sepi%natorb > 1) THEN
115 kl = indexa(2, 2)
116 e1b(2) = ijkl_low_3(sepi, sepj, kl, ij, 1, 1, 0, 0, 2, r, itype, coeff_int_3)*zj
117 kl = indexa(3, 3)
118 e1b(3) = ijkl_low_3(sepi, sepj, kl, ij, 1, 1, 0, 0, 2, r, itype, coeff_int_3)*zj
119 kl = indexa(4, 4)
120 e1b(4) = ijkl_low_3(sepi, sepj, kl, ij, 1, 1, 0, 0, 2, r, itype, coeff_int_3)*zj
121 ! Consistency check
122 cpassert(e1b(2) == e1b(3))
123 cpassert(e1b(3) == e1b(4))
124 IF (sepi%dorb) THEN
125 kl = indexa(5, 5)
126 e1b(5) = ijkl_low_3(sepi, sepj, kl, ij, 2, 2, 0, 0, 2, r, itype, coeff_int_3)*zj
127 kl = indexa(6, 6)
128 e1b(6) = ijkl_low_3(sepi, sepj, kl, ij, 2, 2, 0, 0, 2, r, itype, coeff_int_3)*zj
129 kl = indexa(7, 7)
130 e1b(7) = ijkl_low_3(sepi, sepj, kl, ij, 2, 2, 0, 0, 2, r, itype, coeff_int_3)*zj
131 kl = indexa(8, 8)
132 e1b(8) = ijkl_low_3(sepi, sepj, kl, ij, 2, 2, 0, 0, 2, r, itype, coeff_int_3)*zj
133 kl = indexa(9, 9)
134 e1b(9) = ijkl_low_3(sepi, sepj, kl, ij, 2, 2, 0, 0, 2, r, itype, coeff_int_3)*zj
135 ! Consistency check
136 cpassert(e1b(5) == e1b(6))
137 cpassert(e1b(6) == e1b(7))
138 cpassert(e1b(7) == e1b(8))
139 cpassert(e1b(8) == e1b(9))
140 END IF
141 END IF
142
143 ! Electron(j)-Nuclei(i) contribution
144 kl = indexa(1, 1)
145 e2a(1) = ijkl_low_3(sepi, sepj, ij, kl, 0, 0, 0, 0, 1, r, itype, coeff_int_3)*zi
146 IF (sepj%natorb > 1) THEN
147 kl = indexa(2, 2)
148 e2a(2) = ijkl_low_3(sepi, sepj, ij, kl, 0, 0, 1, 1, 1, r, itype, coeff_int_3)*zi
149 kl = indexa(3, 3)
150 e2a(3) = ijkl_low_3(sepi, sepj, ij, kl, 0, 0, 1, 1, 1, r, itype, coeff_int_3)*zi
151 kl = indexa(4, 4)
152 e2a(4) = ijkl_low_3(sepi, sepj, ij, kl, 0, 0, 1, 1, 1, r, itype, coeff_int_3)*zi
153 ! Consistency check
154 cpassert(e2a(2) == e2a(3))
155 cpassert(e2a(3) == e2a(4))
156 IF (sepj%dorb) THEN
157 kl = indexa(5, 5)
158 e2a(5) = ijkl_low_3(sepi, sepj, ij, kl, 0, 0, 2, 2, 1, r, itype, coeff_int_3)*zi
159 kl = indexa(6, 6)
160 e2a(6) = ijkl_low_3(sepi, sepj, ij, kl, 0, 0, 2, 2, 1, r, itype, coeff_int_3)*zi
161 kl = indexa(7, 7)
162 e2a(7) = ijkl_low_3(sepi, sepj, ij, kl, 0, 0, 2, 2, 1, r, itype, coeff_int_3)*zi
163 kl = indexa(8, 8)
164 e2a(8) = ijkl_low_3(sepi, sepj, ij, kl, 0, 0, 2, 2, 1, r, itype, coeff_int_3)*zi
165 kl = indexa(9, 9)
166 e2a(9) = ijkl_low_3(sepi, sepj, ij, kl, 0, 0, 2, 2, 1, r, itype, coeff_int_3)*zi
167 ! Consistency check
168 cpassert(e2a(5) == e2a(6))
169 cpassert(e2a(6) == e2a(7))
170 cpassert(e2a(7) == e2a(8))
171 cpassert(e2a(8) == e2a(9))
172 END IF
173 END IF
174
175 ! Copy info into the semi-empirical type (i)
176 sepi%expns3_int(jkind)%expns3%core_core = core_core
177 sepi%expns3_int(jkind)%expns3%e1b(1:sepi%natorb) = e1b(1:sepi%natorb)
178 sepi%expns3_int(jkind)%expns3%e2a(1:sepj%natorb) = e2a(1:sepj%natorb)
179 ! Copy info into the semi-empirical type (j)
180 sepj%expns3_int(ikind)%expns3%core_core = core_core
181 sepj%expns3_int(ikind)%expns3%e1b(1:sepj%natorb) = e2a(1:sepj%natorb)
182 sepj%expns3_int(ikind)%expns3%e2a(1:sepi%natorb) = e1b(1:sepi%natorb)
183
184 ! Electron-Electron contribution - sepi/sepj
185 kr = 0
186 DO i = 1, sepi%natorb
187 li = l_index(i)
188 ij = indexa(i, i)
189 DO j = 1, sepj%natorb
190 lk = l_index(j)
191 kl = indexa(j, j)
192 kr = kr + 1
193 sepi%expns3_int(jkind)%expns3%w(kr) = &
194 ijkl_low_3(sepi, sepj, ij, kl, li, li, lk, lk, 0, r, do_method_undef, coeff_int_3)
195 END DO
196 END DO
197
198 ! Electron-Electron contribution - sepj/sepi
199 kr = 0
200 DO i = 1, sepj%natorb
201 li = l_index(i)
202 ij = indexa(i, i)
203 DO j = 1, sepi%natorb
204 lk = l_index(j)
205 kl = indexa(j, j)
206 kr = kr + 1
207 sepj%expns3_int(ikind)%expns3%w(kr) = &
208 ijkl_low_3(sepj, sepi, ij, kl, li, li, lk, lk, 0, r, do_method_undef, coeff_int_3)
209 END DO
210 END DO
211
212 END SUBROUTINE setup_c3_coeff
213
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_method_undef
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_r3d_rs_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, pao_basis_size, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
Methods for handling the 1/R^3 residual integral part.
subroutine, public semi_empirical_expns3_setup(qs_kind_set, se_control, method_id)
Setup the quantity necessary to handle the slowly convergent residual integral term 1/R^3.
Definition of the type to handle the 1/R^3 residual integral part.
subroutine, public semi_empirical_expns3_create(expns3)
Allocate semi-empirical 1/R^3 expansion type.
Utilities for evaluating the residual part (1/r^3) of Integrals for semi-empiric methods.
real(kind=dp) function, public coeff_int_3(r, l1, l2, add)
Evaluates the coefficient for the residual Interaction function between two point-charges l1 - Quantu...
real(kind=dp) function, public ijkl_low_3(sepi, sepj, ij, kl, li, lj, lk, ll, ic, r, itype, eval)
Low level general driver for computing residual part of semi-empirical integrals <ij|kl> and their de...
Arrays of parameters used in the semi-empirical calculations \References Everywhere in this module TC...
integer, dimension(9), parameter, public l_index
integer, dimension(9, 9), public indexa
Definition of the semi empirical parameter types.
Working with the semi empirical parameter types.
integer function, public get_se_type(se_method)
Gives back the unique semi_empirical METHOD type.
Provides all information about a quickstep kind.