(git:374b731)
Loading...
Searching...
No Matches
se_core_core.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 Split and build its own idependent core_core SE interaction module
10!> \author Teodoro Laino [tlaino] - 05.2009
11!> \par History
12!> Teodoro Laino (05.2009) [tlaino] - create
13! **************************************************************************************************
19 USE cell_types, ONLY: cell_type
24 USE ewald_pw_types, ONLY: ewald_pw_get,&
26 USE input_constants, ONLY: &
29 USE kinds, ONLY: dp
36 USE qs_kind_types, ONLY: get_qs_kind,&
57 USE virial_types, ONLY: virial_type
58#include "./base/base_uses.f90"
59
60 IMPLICIT NONE
61 PRIVATE
62
63 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'se_core_core'
64 LOGICAL, PARAMETER, PRIVATE :: debug_this_module = .false.
65
67
68CONTAINS
69
70! **************************************************************************************************
71!> \brief Evaluates the core-core interactions for NDDO methods
72!> \param qs_env ...
73!> \param para_env ...
74!> \param calculate_forces ...
75!> \date 04.2008 [tlaino]
76!> \author Teodoro Laino [tlaino] - University of Zurich
77! **************************************************************************************************
78 SUBROUTINE se_core_core_interaction(qs_env, para_env, calculate_forces)
79 TYPE(qs_environment_type), POINTER :: qs_env
80 TYPE(mp_para_env_type), POINTER :: para_env
81 LOGICAL, INTENT(in) :: calculate_forces
82
83 CHARACTER(len=*), PARAMETER :: routinen = 'se_core_core_interaction'
84
85 INTEGER :: atom_a, atom_b, handle, iab, iatom, &
86 ikind, itype, jatom, jkind, nkind
87 INTEGER, ALLOCATABLE, DIMENSION(:) :: atom_of_kind
88 LOGICAL :: anag, atener, defined, use_virial
89 LOGICAL, ALLOCATABLE, DIMENSION(:) :: se_defined
90 REAL(kind=dp) :: delta, dr1, dr3inv(3), enuc, enucij, &
91 enuclear, r2inv, r3inv, rinv
92 REAL(kind=dp), DIMENSION(3) :: force_ab, rij
93 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
94 TYPE(atprop_type), POINTER :: atprop
95 TYPE(cell_type), POINTER :: cell
96 TYPE(dft_control_type), POINTER :: dft_control
97 TYPE(ewald_environment_type), POINTER :: ewald_env
98 TYPE(ewald_pw_type), POINTER :: ewald_pw
100 DIMENSION(:), POINTER :: nl_iterator
101 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
102 POINTER :: sab_se
103 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
104 TYPE(qs_energy_type), POINTER :: energy
105 TYPE(qs_force_type), DIMENSION(:), POINTER :: force
106 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
107 TYPE(se_int_control_type) :: se_int_control
108 TYPE(se_taper_type), POINTER :: se_taper
109 TYPE(semi_empirical_control_type), POINTER :: se_control
110 TYPE(semi_empirical_p_type), DIMENSION(:), POINTER :: se_kind_param
111 TYPE(semi_empirical_type), POINTER :: se_kind_a, se_kind_b
112 TYPE(virial_type), POINTER :: virial
113
114 enuclear = 0.0_dp
115 NULLIFY (dft_control, cell, force, particle_set, se_control, se_taper, atomic_kind_set, &
116 virial, atprop)
117
118 CALL timeset(routinen, handle)
119 cpassert(ASSOCIATED(qs_env))
120 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control, cell=cell, se_taper=se_taper, &
121 virial=virial, atprop=atprop, energy=energy)
122
123 CALL initialize_se_taper(se_taper, coulomb=.true.)
124 ! Parameters
125 se_control => dft_control%qs_control%se_control
126 anag = se_control%analytical_gradients
127 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
128 CALL setup_se_int_control_type(se_int_control, do_ewald_r3=se_control%do_ewald_r3, &
129 do_ewald_gks=se_control%do_ewald_gks, integral_screening=se_control%integral_screening, &
130 shortrange=(se_control%do_ewald .OR. se_control%do_ewald_gks), &
131 max_multipole=se_control%max_multipole, pc_coulomb_int=.false.)
132
133 ! atomic energy decomposition
134 atener = atprop%energy
135 IF (atener) THEN
136 CALL get_qs_env(qs_env=qs_env, particle_set=particle_set)
137 CALL atprop_array_init(atprop%atecc, natom=SIZE(particle_set))
138 END IF
139
140 ! Retrieve some information if GKS ewald scheme is used
141 IF (se_control%do_ewald_gks) THEN
142 CALL get_qs_env(qs_env=qs_env, ewald_env=ewald_env, ewald_pw=ewald_pw)
143 CALL ewald_env_get(ewald_env, alpha=se_int_control%ewald_gks%alpha)
144 CALL ewald_pw_get(ewald_pw, pw_big_pool=se_int_control%ewald_gks%pw_pool, &
145 dg=se_int_control%ewald_gks%dg)
146 ! Virial not implemented
147 cpassert(.NOT. use_virial)
148 END IF
149
150 CALL get_qs_env(qs_env=qs_env, sab_se=sab_se, atomic_kind_set=atomic_kind_set, &
151 qs_kind_set=qs_kind_set)
152
153 nkind = SIZE(atomic_kind_set)
154 ! Possibly compute forces
155 IF (calculate_forces) THEN
156 CALL get_qs_env(qs_env=qs_env, particle_set=particle_set, force=force)
157 delta = se_control%delta
158 CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, atom_of_kind=atom_of_kind)
159 END IF
160
161 itype = get_se_type(dft_control%qs_control%method_id)
162
163 ALLOCATE (se_kind_param(nkind), se_defined(nkind))
164 DO ikind = 1, nkind
165 CALL get_qs_kind(qs_kind_set(ikind), se_parameter=se_kind_a)
166 se_kind_param(ikind)%se_param => se_kind_a
167 CALL get_se_param(se_kind_a, defined=defined)
168 se_defined(ikind) = defined
169 END DO
170 CALL neighbor_list_iterator_create(nl_iterator, sab_se)
171 DO WHILE (neighbor_list_iterate(nl_iterator) == 0)
172 CALL get_iterator_info(nl_iterator, ikind=ikind, jkind=jkind, iatom=iatom, jatom=jatom, r=rij)
173 IF (.NOT. se_defined(ikind)) cycle
174 IF (.NOT. se_defined(jkind)) cycle
175 se_kind_a => se_kind_param(ikind)%se_param
176 se_kind_b => se_kind_param(jkind)%se_param
177 iab = ikind + nkind*(jkind - 1)
178 dr1 = dot_product(rij, rij)
179 enucij = 0._dp
180 IF (dr1 > rij_threshold) THEN
181 SELECT CASE (dft_control%qs_control%method_id)
184
185 ! Core-Core energy term
186 CALL corecore(se_kind_a, se_kind_b, rij, enuc=enuc, itype=itype, anag=anag, &
187 se_int_control=se_int_control, se_taper=se_taper)
188 enucij = enucij + enuc
189 ! Residual integral (1/R^3) correction
190 IF (se_int_control%do_ewald_r3) THEN
191 r2inv = 1.0_dp/dr1
192 rinv = sqrt(r2inv)
193 r3inv = rinv**3
194 ! Core-Core term
195 enucij = enucij + se_kind_a%expns3_int(jkind)%expns3%core_core*r3inv
196 END IF
197
198 ! Core-Core Derivatives
199 IF (calculate_forces) THEN
200 atom_a = atom_of_kind(iatom)
201 atom_b = atom_of_kind(jatom)
202
203 CALL dcorecore(se_kind_a, se_kind_b, rij, denuc=force_ab, itype=itype, delta=delta, &
204 anag=anag, se_int_control=se_int_control, se_taper=se_taper)
205
206 ! Residual integral (1/R^3) correction
207 IF (se_int_control%do_ewald_r3) THEN
208 dr3inv = -3.0_dp*rij*r3inv*r2inv
209 ! Derivatives of core-core terms
210 force_ab = force_ab + se_kind_a%expns3_int(jkind)%expns3%core_core*dr3inv
211 END IF
212 IF (use_virial) THEN
213 CALL virial_pair_force(virial%pv_virial, -1.0_dp, force_ab, rij)
214 END IF
215
216 ! Sum up force components
217 force(ikind)%all_potential(1, atom_a) = force(ikind)%all_potential(1, atom_a) - force_ab(1)
218 force(jkind)%all_potential(1, atom_b) = force(jkind)%all_potential(1, atom_b) + force_ab(1)
219
220 force(ikind)%all_potential(2, atom_a) = force(ikind)%all_potential(2, atom_a) - force_ab(2)
221 force(jkind)%all_potential(2, atom_b) = force(jkind)%all_potential(2, atom_b) + force_ab(2)
222
223 force(ikind)%all_potential(3, atom_a) = force(ikind)%all_potential(3, atom_a) - force_ab(3)
224 force(jkind)%all_potential(3, atom_b) = force(jkind)%all_potential(3, atom_b) + force_ab(3)
225 END IF
226 CASE DEFAULT
227 cpabort("")
228 END SELECT
229 ELSE
230 IF (se_int_control%do_ewald_gks) THEN
231 ! Core-Core energy term (self term in periodic systems)
232 CALL corecore(se_kind_a, se_kind_b, rij, enuc=enuc, itype=itype, anag=anag, &
233 se_int_control=se_int_control, se_taper=se_taper)
234 enucij = enucij + 0.5_dp*enuc
235 END IF
236 END IF
237 IF (atener) THEN
238 atprop%atecc(iatom) = atprop%atecc(iatom) + 0.5_dp*enucij
239 atprop%atecc(jatom) = atprop%atecc(jatom) + 0.5_dp*enucij
240 END IF
241 enuclear = enuclear + enucij
242 END DO
243 CALL neighbor_list_iterator_release(nl_iterator)
244
245 DEALLOCATE (se_kind_param, se_defined)
246
247 IF (calculate_forces) THEN
248 DEALLOCATE (atom_of_kind)
249 END IF
250
251 CALL para_env%sum(enuclear)
252 energy%core_overlap = enuclear
253 energy%core_overlap0 = enuclear
254
255 CALL finalize_se_taper(se_taper)
256 CALL timestop(handle)
257 END SUBROUTINE se_core_core_interaction
258
259END MODULE se_core_core
260
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
Holds information on atomic properties.
subroutine, public atprop_array_init(atarray, natom)
...
Handles all functions related to the CELL.
Definition cell_types.F:15
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public ewald_env_get(ewald_env, ewald_type, alpha, eps_pol, epsilon, gmax, ns_max, o_spline, group, para_env, poisson_section, precs, rcut, do_multipoles, max_multipole, do_ipol, max_ipol_iter, interaction_cutoffs, cell_hmat)
Purpose: Get the EWALD environment.
subroutine, public ewald_pw_get(ewald_pw, pw_big_pool, pw_small_pool, rs_desc, poisson_env, dg)
get the ewald_pw environment to the correct program.
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_method_pdg
integer, parameter, public do_method_pnnl
integer, parameter, public do_method_rm1
integer, parameter, public do_method_pm3
integer, parameter, public do_method_mndo
integer, parameter, public do_method_mndod
integer, parameter, public do_method_am1
integer, parameter, public do_method_pm6fm
integer, parameter, public do_method_pm6
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Interface to the message passing library MPI.
Define the data structure for the particle information.
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, rhs)
Get the QUICKSTEP environment.
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.
Define the neighbor list data types and the corresponding functionality.
subroutine, public neighbor_list_iterator_create(iterator_set, nl, search, nthread)
Neighbor list iterator functions.
subroutine, public neighbor_list_iterator_release(iterator_set)
...
integer function, public neighbor_list_iterate(iterator_set, mepos)
...
subroutine, public get_iterator_info(iterator_set, mepos, ikind, jkind, nkind, ilist, nlist, inode, nnode, iatom, jatom, r, cell)
...
Split and build its own idependent core_core SE interaction module.
subroutine, public se_core_core_interaction(qs_env, para_env, calculate_forces)
Evaluates the core-core interactions for NDDO methods.
Arrays of parameters used in the semi-empirical calculations \References Everywhere in this module TC...
real(kind=dp), parameter, public rij_threshold
Set of wrappers for semi-empirical analytical/numerical Integrals routines.
subroutine, public dcorecore(sepi, sepj, rij, denuc, itype, delta, anag, se_int_control, se_taper)
wrapper for numerical/analytical routines
subroutine, public corecore(sepi, sepj, rij, enuc, itype, anag, se_int_control, se_taper)
wrapper for numerical/analytical routines core-core integrals, since are evaluated only once do not n...
Definition of the semi empirical parameter types.
subroutine, public setup_se_int_control_type(se_int_control, shortrange, do_ewald_r3, do_ewald_gks, integral_screening, max_multipole, pc_coulomb_int)
Setup the Semiempirical integral control type.
subroutine, public get_se_param(sep, name, typ, defined, z, zeff, natorb, eheat, beta, sto_exponents, uss, upp, udd, uff, alp, eisol, gss, gsp, gpp, gp2, acoul, nr, de, ass, asp, app, hsp, gsd, gpd, gdd, ppddg, dpddg, ngauss)
Get info from the semi-empirical type.
Working with the semi empirical parameter types.
subroutine, public finalize_se_taper(se_taper)
Finalizes the semi-empirical taper for a chunk calculation.
integer function, public get_se_type(se_method)
Gives back the unique semi_empirical METHOD type.
subroutine, public initialize_se_taper(se_taper, coulomb, exchange, lr_corr)
Initializes the semi-empirical taper for a chunk calculation.
pure subroutine, public virial_pair_force(pv_virial, f0, force, rab)
Computes the contribution to the stress tensor from two-body pair-wise forces.
Provides all information about an atomic kind.
type for the atomic properties
Type defining parameters related to the simulation cell.
Definition cell_types.F:55
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.
Taper type use in semi-empirical calculations.