Compute torsion potential
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_bonded_type), | intent(in) | :: | bds | |||
real(kind=rp), | intent(inout) | :: | V |
improper torsion potential, result will be added to V |
subroutine imptorsion_potential(bds, V)
!! Compute torsion potential
use mod_constants, only: pi, eps_rp
implicit none
type(ommp_bonded_type), intent(in) :: bds
! Bonded potential data structure
real(rp), intent(inout) :: V
!! improper torsion potential, result will be added to V
real(rp) :: thet, costhet
integer(ip) :: i, j
if(.not. bds%use_imptorsion) return
do i=1, bds%nimptorsion
! Atoms that defines the dihedral angle
costhet = cos_torsion(bds%top, bds%imptorsionat(:,i))
if(costhet + 1.0 <= eps_rp) then
thet = pi
else
thet = acos(costhet)
end if
do j=1, 3
if(bds%imptorsn(j,i) < 1) exit
V = V + bds%imptorsamp(j,i) * (1+cos(real(bds%imptorsn(j,i))*thet &
- bds%imptorsphase(j,i)))
end do
end do
end subroutine imptorsion_potential