45#include "./base/base_uses.f90"
51 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_dftb_dispersion'
67 LOGICAL,
INTENT(IN) :: calculate_forces
76 dft_control=dft_control)
78 energy%dispersion = 0._dp
80 dftb_control => dft_control%qs_control%dftb_control
81 IF (dftb_control%dispersion)
THEN
82 SELECT CASE (dftb_control%dispersion_type)
84 CALL calculate_dispersion_uff(qs_env, para_env, calculate_forces)
86 CALL get_qs_env(qs_env=qs_env, dispersion_env=dispersion_env)
88 energy%dispersion, calculate_forces)
102 SUBROUTINE calculate_dispersion_uff(qs_env, para_env, calculate_forces)
106 LOGICAL,
INTENT(IN) :: calculate_forces
108 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calculate_dispersion_uff'
110 INTEGER :: atom_a, atom_b, handle, iatom, ikind, &
112 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind
113 LOGICAL :: use_virial
114 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: define_kind
115 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: rc_kind
116 REAL(kind=
dp) :: a, b, c, devdw, dij, dr, eij, evdw,
fac, &
118 REAL(kind=
dp),
DIMENSION(3) :: fdij, rij
124 DIMENSION(:),
POINTER :: nl_iterator
130 POINTER :: dftb_potential
134 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
137 CALL timeset(routinen, handle)
139 NULLIFY (atomic_kind_set, sab_vdw, atprop)
143 atomic_kind_set=atomic_kind_set, &
144 qs_kind_set=qs_kind_set, &
145 virial=virial, atprop=atprop, &
146 dft_control=dft_control)
148 energy%dispersion = 0._dp
150 dftb_control => dft_control%qs_control%dftb_control
152 IF (dftb_control%dispersion)
THEN
154 NULLIFY (dftb_potential)
155 CALL get_qs_env(qs_env=qs_env, dftb_potential=dftb_potential)
156 IF (calculate_forces)
THEN
157 NULLIFY (force, particle_set)
159 particle_set=particle_set, &
162 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
166 nkind =
SIZE(atomic_kind_set)
167 ALLOCATE (define_kind(nkind), rc_kind(nkind))
169 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_kind_a)
175 IF (atprop%energy)
THEN
176 CALL get_qs_env(qs_env=qs_env, particle_set=particle_set)
180 CALL get_qs_env(qs_env=qs_env, sab_vdw=sab_vdw)
183 CALL get_iterator_info(nl_iterator, ikind=ikind, jkind=jkind, iatom=iatom, jatom=jatom, r=rij)
184 IF ((.NOT. define_kind(ikind)) .OR. (.NOT. define_kind(jkind))) cycle
185 rc = rc_kind(ikind) + rc_kind(jkind)
187 dr = sqrt(sum(rij(:)**2))
188 IF (dr <= rc .AND. dr > 0.001_dp)
THEN
190 IF (iatom == jatom)
fac = 0.5_dp
192 dftb_param_ij => dftb_potential(ikind, jkind)
194 xij = dftb_param_ij%xij
195 dij = dftb_param_ij%dij
196 x0ij = dftb_param_ij%x0ij
204 eij = dij*(-2._dp*xp**6 + xp**12)*
fac
206 IF (calculate_forces .AND. (dr > 0.001_dp))
THEN
207 devdw = dij*12._dp*(xp**6 - xp**12)/dr*
fac
208 atom_a = atom_of_kind(iatom)
209 atom_b = atom_of_kind(jatom)
210 fdij(:) = devdw*rij(:)/dr
211 force(ikind)%dispersion(:, atom_a) = &
212 force(ikind)%dispersion(:, atom_a) - fdij(:)
213 force(jkind)%dispersion(:, atom_b) = &
214 force(jkind)%dispersion(:, atom_b) + fdij(:)
222 eij = (a - b*dr**5 - c*dr**10)*
fac
224 IF (calculate_forces .AND. (dr > 0.001_dp))
THEN
225 atom_a = atom_of_kind(iatom)
226 atom_b = atom_of_kind(jatom)
227 devdw = (-5*b*dr**4 - 10*c*dr**9)*
fac
228 fdij(:) = devdw*rij(:)/dr
229 force(ikind)%dispersion(:, atom_a) = &
230 force(ikind)%dispersion(:, atom_a) - fdij(:)
231 force(jkind)%dispersion(:, atom_b) = &
232 force(jkind)%dispersion(:, atom_b) + fdij(:)
235 IF (atprop%energy)
THEN
236 atprop%atevdw(iatom) = atprop%atevdw(iatom) + 0.5_dp*eij
237 atprop%atevdw(jatom) = atprop%atevdw(jatom) + 0.5_dp*eij
239 IF (calculate_forces .AND. (dr > 0.001_dp) .AND. use_virial)
THEN
247 CALL para_env%sum(evdw)
248 energy%dispersion = evdw
252 CALL timestop(handle)
254 END SUBROUTINE calculate_dispersion_uff
static GRID_HOST_DEVICE double fac(const int i)
Factorial function, e.g. fac(5) = 5! = 120.
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)
...
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.
Define the data structure for the particle information.
Calculation of dispersion in DFTB.
subroutine, public calculate_dftb_dispersion(qs_env, para_env, calculate_forces)
...
Definition of the DFTB parameter types.
Working with the DFTB parameter types.
subroutine, public get_dftb_atom_param(dftb_parameter, name, typ, defined, z, zeff, natorb, lmax, skself, occupation, eta, energy, cutoff, xi, di, rcdisp, dudq)
...
Calculation of dispersion using pair potentials.
subroutine, public calculate_dispersion_pairpot(qs_env, dispersion_env, energy, calculate_forces, atevdw)
...
Definition of disperson types for DFT calculations.
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_pp, 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, harris_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, eeq, 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, zatom, 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_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_model_file, 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)
...
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
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.