set_model_ewald Subroutine

public subroutine set_model_ewald(verror, vdisp, rank, tolerance, kcut, mesh) bind(C, name=namespace//"set_model_ewald")

Evaluate the two-body dispersion energy by Ewald summation.

Non-positive values select the respective default, a vanishing rank derives the rank from the tolerance and a vanishing reciprocal cutoff derives it from the damping radii. A negative mesh sums over the reciprocal lattice directly instead of using the particle mesh.

Arguments

Type IntentOptional Attributes Name
type(c_ptr), value :: verror
type(c_ptr), value :: vdisp
integer(kind=c_int), intent(in), value :: rank
real(kind=c_double), intent(in), value :: tolerance
real(kind=c_double), intent(in), value :: kcut
integer(kind=c_int), intent(in), value :: mesh

Source Code

subroutine set_model_ewald(verror, vdisp, rank, tolerance, kcut, mesh) &
      & bind(C, name=namespace//"set_model_ewald")
   type(c_ptr), value :: verror
   type(vp_error), pointer :: error
   type(c_ptr), value :: vdisp
   type(vp_model), pointer :: disp
   integer(c_int), value, intent(in) :: rank
   real(c_double), value, intent(in) :: tolerance
   real(c_double), value, intent(in) :: kcut
   integer(c_int), value, intent(in) :: mesh

   type(d3_lowrank_config) :: config

   if (.not.c_associated(verror)) return
   call c_f_pointer(verror, error)

   if (.not.c_associated(vdisp)) then
      call fatal_error(error%ptr, "D3 dispersion model is missing")
      return
   end if
   call c_f_pointer(vdisp, disp)

   config = d3_lowrank_config()
   if (rank > 0) config%rank = rank
   if (tolerance > 0.0_wp) config%tolerance = tolerance
   if (kcut > 0.0_wp) config%kcut = kcut
   config%mesh = mesh

   call disp%ptr%set_lowrank(config)
end subroutine set_model_ewald