64 REAL(kind=
dp),
INTENT(OUT) :: evdw
65 LOGICAL,
INTENT(IN) :: calculate_forces
66 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL :: atevdw
68 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calculate_dispersion_d2_pairpot'
70 INTEGER :: atom_a, atom_b, handle, iatom, ikind, &
71 jatom, jkind, mepos, natom, nkind, &
73 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind, atomnumber, kind_of
74 LOGICAL :: atenergy, atex, floating_a, ghost_a, &
76 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: dodisp, floating, ghost
77 REAL(kind=
dp) :: c6, dd, devdw, dfdmp, dr, er,
fac, fdmp, &
79 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: c6d2, radd2
80 REAL(kind=
dp),
DIMENSION(3) :: fdij, rij
81 REAL(kind=
dp),
DIMENSION(3, 3) :: pv_virial_thread
82 REAL(kind=
dp),
DIMENSION(:),
POINTER :: atener
87 DIMENSION(:),
POINTER :: nl_iterator
95 CALL timeset(routinen, handle)
99 NULLIFY (atomic_kind_set, qs_kind_set, sab_vdw)
101 CALL get_qs_env(qs_env=qs_env, nkind=nkind, natom=natom, atomic_kind_set=atomic_kind_set, &
102 qs_kind_set=qs_kind_set, cell=cell, virial=virial, atprop=atprop)
105 atenergy = atprop%energy
108 atener => atprop%atevdw
112 IF (
PRESENT(atevdw))
THEN
119 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
120 pv_virial_thread(:, :) = 0._dp
122 ALLOCATE (dodisp(nkind), ghost(nkind), floating(nkind), atomnumber(nkind), c6d2(nkind), radd2(nkind))
125 CALL get_qs_kind(qs_kind_set(ikind), dispersion=disp_a, ghost=ghost_a, floating=floating_a)
126 dodisp(ikind) = disp_a%defined
127 ghost(ikind) = ghost_a
128 floating(ikind) = floating_a
129 atomnumber(ikind) = za
130 c6d2(ikind) = disp_a%c6
131 radd2(ikind) = disp_a%vdw_radii
134 rcut = 2._dp*dispersion_env%rc_disp
135 s6 = dispersion_env%scaling
136 dd = dispersion_env%exp_pre
138 sab_vdw => dispersion_env%sab_vdw
144 CALL get_iterator_info(nl_iterator, mepos=mepos, ikind=ikind, jkind=jkind, iatom=iatom, jatom=jatom, r=rij)
146 IF (ghost(ikind) .OR. ghost(jkind) .OR. floating(ikind) .OR. floating(jkind)) cycle
148 IF (.NOT. (dodisp(ikind) .AND. dodisp(jkind))) cycle
150 za = atomnumber(ikind)
151 zb = atomnumber(jkind)
153 dr = sqrt(sum(rij(:)**2))
156 IF (iatom == jatom)
fac = 0.5_dp
157 IF (dr > 0.001_dp)
THEN
158 c6 = sqrt(c6d2(ikind)*c6d2(jkind))
159 rcc = radd2(ikind) + radd2(jkind)
160 er = exp(-dd*(dr/rcc - 1._dp))
161 fdmp = 1._dp/(1._dp + er)
163 evdw = evdw - xp*fdmp*
fac
164 IF (calculate_forces)
THEN
165 dfdmp = dd/rcc*er*fdmp*fdmp
166 devdw = -xp*(-6._dp*fdmp/dr + dfdmp)
167 fdij(:) = devdw*rij(:)/dr*
fac
168 atom_a = atom_of_kind(iatom)
169 atom_b = atom_of_kind(jatom)
170 force(ikind)%dispersion(:, atom_a) = force(ikind)%dispersion(:, atom_a) - fdij(:)
171 force(jkind)%dispersion(:, atom_b) = force(jkind)%dispersion(:, atom_b) + fdij(:)
177 atener(iatom) = atener(iatom) - 0.5_dp*xp*fdmp*
fac
178 atener(jatom) = atener(jatom) - 0.5_dp*xp*fdmp*
fac
181 atevdw(iatom) = atevdw(iatom) - 0.5_dp*xp*fdmp*
fac
182 atevdw(jatom) = atevdw(jatom) - 0.5_dp*xp*fdmp*
fac
189 virial%pv_virial = virial%pv_virial + pv_virial_thread
193 DEALLOCATE (dodisp, ghost, floating, atomnumber, radd2, c6d2)
195 CALL timestop(handle)
208 INTEGER,
INTENT(in) :: z
209 REAL(kind=
dp),
INTENT(inout) :: c6, r
210 LOGICAL,
INTENT(inout) :: found
212 REAL(kind=
dp),
DIMENSION(54),
PARAMETER :: c6val = (/0.14_dp, 0.08_dp, 1.61_dp, 1.61_dp, &
213 3.13_dp, 1.75_dp, 1.23_dp, 0.70_dp, 0.75_dp, 0.63_dp, 5.71_dp, 5.71_dp, 10.79_dp, 9.23_dp,&
214 7.84_dp, 5.57_dp, 5.07_dp, 4.61_dp, 10.80_dp, 10.80_dp, 10.80_dp, 10.80_dp, 10.80_dp, &
215 10.80_dp, 10.80_dp, 10.80_dp, 10.80_dp, 10.80_dp, 10.80_dp, 10.80_dp, 16.99_dp, 17.10_dp, &
216 16.37_dp, 12.64_dp, 12.47_dp, 12.01_dp, 24.67_dp, 24.67_dp, 24.67_dp, 24.67_dp, 24.67_dp, &
217 24.67_dp, 24.67_dp, 24.67_dp, 24.67_dp, 24.67_dp, 24.67_dp, 24.67_dp, 37.32_dp, 38.71_dp, &
218 38.44_dp, 31.74_dp, 31.50_dp, 29.99_dp/)
219 REAL(kind=
dp),
DIMENSION(54),
PARAMETER :: rval = (/1.001_dp, 1.012_dp, 0.825_dp, 1.408_dp, &
220 1.485_dp, 1.452_dp, 1.397_dp, 1.342_dp, 1.287_dp, 1.243_dp, 1.144_dp, 1.364_dp, 1.639_dp, &
221 1.716_dp, 1.705_dp, 1.683_dp, 1.639_dp, 1.595_dp, 1.485_dp, 1.474_dp, 1.562_dp, 1.562_dp, &
222 1.562_dp, 1.562_dp, 1.562_dp, 1.562_dp, 1.562_dp, 1.562_dp, 1.562_dp, 1.562_dp, 1.650_dp, &
223 1.727_dp, 1.760_dp, 1.771_dp, 1.749_dp, 1.727_dp, 1.628_dp, 1.606_dp, 1.639_dp, 1.639_dp, &
224 1.639_dp, 1.639_dp, 1.639_dp, 1.639_dp, 1.639_dp, 1.639_dp, 1.639_dp, 1.639_dp, 1.672_dp, &
225 1.804_dp, 1.881_dp, 1.892_dp, 1.892_dp, 1.881_dp/)
239 IF (z > 0 .AND. z <= 54)
THEN
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.
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.