Calculate atomic dispersion coefficients and their derivatives w.r.t. the coordination numbers and atomic partial charges.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(d4_model), | intent(in) | :: | self |
Instance of the dispersion model |
||
class(structure_type), | intent(in) | :: | mol |
Molecular structure data |
||
real(kind=wp), | intent(in) | :: | gwvec(:,:,:) |
Weighting function for the atomic reference systems |
||
real(kind=wp), | intent(in), | optional | :: | gwdcn(:,:,:) |
Derivative of the weighting function w.r.t. the coordination number |
|
real(kind=wp), | intent(in), | optional | :: | gwdq(:,:,:) |
Derivative of the weighting function w.r.t. the partial charge |
|
real(kind=wp), | intent(out) | :: | c6(:,:) |
C6 coefficients for all atom pairs. |
||
real(kind=wp), | intent(out), | optional | :: | dc6dcn(:,:) |
Derivative of the C6 w.r.t. the coordination number |
|
real(kind=wp), | intent(out), | optional | :: | dc6dq(:,:) |
Derivative of the C6 w.r.t. the partial charge |
subroutine get_atomic_c6(self, mol, gwvec, gwdcn, gwdq, c6, dc6dcn, dc6dq) !DEC$ ATTRIBUTES DLLEXPORT :: get_atomic_c6 !> Instance of the dispersion model class(d4_model), intent(in) :: self !> Molecular structure data class(structure_type), intent(in) :: mol !> Weighting function for the atomic reference systems real(wp), intent(in) :: gwvec(:, :, :) !> Derivative of the weighting function w.r.t. the coordination number real(wp), intent(in), optional :: gwdcn(:, :, :) !> Derivative of the weighting function w.r.t. the partial charge real(wp), intent(in), optional :: gwdq(:, :, :) !> C6 coefficients for all atom pairs. real(wp), intent(out) :: c6(:, :) !> Derivative of the C6 w.r.t. the coordination number real(wp), intent(out), optional :: dc6dcn(:, :) !> Derivative of the C6 w.r.t. the partial charge real(wp), intent(out), optional :: dc6dq(:, :) integer :: iat, jat, izp, jzp, iref, jref real(wp) :: refc6, dc6, dc6dcni, dc6dcnj, dc6dqi, dc6dqj if (present(gwdcn).and.present(dc6dcn) & & .and.present(gwdq).and.present(dc6dq)) then c6(:, :) = 0.0_wp dc6dcn(:, :) = 0.0_wp dc6dq(:, :) = 0.0_wp !$omp parallel do default(none) schedule(runtime) & !$omp shared(c6, dc6dcn, dc6dq, mol, self, gwvec, gwdcn, gwdq) & !$omp private(iat, jat, izp, jzp, iref, jref, refc6, dc6, dc6dqi, dc6dqj, & !$omp& dc6dcni, dc6dcnj) do iat = 1, mol%nat izp = mol%id(iat) do jat = 1, iat jzp = mol%id(jat) dc6 = 0.0_wp dc6dcni = 0.0_wp dc6dcnj = 0.0_wp dc6dqi = 0.0_wp dc6dqj = 0.0_wp do iref = 1, self%ref(izp) do jref = 1, self%ref(jzp) refc6 = self%c6(iref, jref, izp, jzp) dc6 = dc6 + gwvec(iref, iat, 1) * gwvec(jref, jat, 1) * refc6 dc6dcni = dc6dcni + gwdcn(iref, iat, 1) * gwvec(jref, jat, 1) * refc6 dc6dcnj = dc6dcnj + gwvec(iref, iat, 1) * gwdcn(jref, jat, 1) * refc6 dc6dqi = dc6dqi + gwdq(iref, iat, 1) * gwvec(jref, jat, 1) * refc6 dc6dqj = dc6dqj + gwvec(iref, iat, 1) * gwdq(jref, jat, 1) * refc6 end do end do c6(iat, jat) = dc6 c6(jat, iat) = dc6 dc6dcn(iat, jat) = dc6dcni dc6dcn(jat, iat) = dc6dcnj dc6dq(iat, jat) = dc6dqi dc6dq(jat, iat) = dc6dqj end do end do else c6(:, :) = 0.0_wp !$omp parallel do default(none) schedule(runtime) & !$omp shared(c6, mol, self, gwvec) & !$omp private(iat, jat, izp, jzp, iref, jref, refc6, dc6) do iat = 1, mol%nat izp = mol%id(iat) do jat = 1, iat jzp = mol%id(jat) dc6 = 0.0_wp do iref = 1, self%ref(izp) do jref = 1, self%ref(jzp) refc6 = self%c6(iref, jref, izp, jzp) dc6 = dc6 + gwvec(iref, iat, 1) * gwvec(jref, jat, 1) * refc6 end do end do c6(iat, jat) = dc6 c6(jat, iat) = dc6 end do end do end if end subroutine get_atomic_c6