Calculate dispersion
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(c_ptr), | value | :: | verror | |||
| type(c_ptr), | value | :: | vmol | |||
| type(c_ptr), | value | :: | vdisp | |||
| type(c_ptr), | value | :: | vparam | |||
| real(kind=c_double), | intent(out) | :: | energy | |||
| real(kind=c_double), | intent(out), | optional | :: | c_gradient(3,*) | ||
| real(kind=c_double), | intent(out), | optional | :: | c_sigma(3,3) |
subroutine get_dispersion_api(verror, vmol, vdisp, vparam, & & energy, c_gradient, c_sigma) & & bind(C, name=namespace//"get_dispersion") type(c_ptr), value :: verror type(vp_error), pointer :: error type(c_ptr), value :: vmol type(vp_structure), pointer :: mol type(c_ptr), value :: vdisp type(vp_model), pointer :: disp type(c_ptr), value :: vparam type(vp_param), pointer :: param real(c_double), intent(out) :: energy real(c_double), intent(out), optional :: c_gradient(3, *) real(wp), allocatable :: gradient(:, :) real(c_double), intent(out), optional :: c_sigma(3, 3) real(wp), allocatable :: sigma(:, :) type(realspace_cutoff) :: cutoff if (.not.c_associated(verror)) return call c_f_pointer(verror, error) if (.not.c_associated(vmol)) then call fatal_error(error%ptr, "Molecular structure data is missing") return end if call c_f_pointer(vmol, mol) if (.not.c_associated(vdisp)) then call fatal_error(error%ptr, "Dispersion model is missing") return end if call c_f_pointer(vdisp, disp) if (.not.c_associated(vparam)) then call fatal_error(error%ptr, "Damping parameters are missing") return end if call c_f_pointer(vparam, param) if (.not.allocated(param%ptr)) then call fatal_error(error%ptr, "Damping parameters are not initialized") return end if if (present(c_gradient)) then gradient = c_gradient(:3, :mol%ptr%nat) end if if (present(c_sigma)) then sigma = c_sigma(:3, :3) end if cutoff = realspace_cutoff() if (allocated(disp%cutoff)) then cutoff = disp%cutoff end if if (allocated(disp%comm)) then call get_dispersion_mpi(error%ptr, mol%ptr, disp%ptr, param%ptr, cutoff, & & disp%comm, energy, gradient, sigma) else call get_dispersion(error%ptr, mol%ptr, disp%ptr, param%ptr, cutoff, & & energy, gradient, sigma, partition=disp%partition) end if if (allocated(error%ptr)) return if (present(c_gradient)) then c_gradient(:3, :mol%ptr%nat) = gradient end if if (present(c_sigma)) then c_sigma(:3, :3) = sigma end if end subroutine get_dispersion_api