@brief Gradient of nuclear repulsion energy
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(atomic_structure), | intent(inout) | :: | atoms | |||
integer, | intent(in) | :: | ecp_el(:) |
subroutine grad_nn(atoms, ecp_el) implicit none type(atomic_structure), intent(inout) :: atoms integer, intent(in) :: ecp_el(:) integer :: k, l real(kind=dp) :: pkl(3), rkl3, de1(3) do k = 2, ubound(atoms%zn, 1) do l = 1, k-1 if (k==l) cycle pkl = atoms%xyz(:,k)-atoms%xyz(:,l) rkl3 = norm2(pkl)**3 de1 = -(atoms%zn(k)-ecp_el(k))*(atoms%zn(l)-ecp_el(l))*pkl/rkl3 atoms%grad(:,k) = atoms%grad(:,k) + de1 atoms%grad(:,l) = atoms%grad(:,l) - de1 end do end do end subroutine grad_nn