Compute torsion potential
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_bonded_type), | intent(in) | :: | bds | |||
real(kind=rp), | intent(inout) | :: | V |
torsion potential, result will be added to V |
subroutine tortor_potential(bds, V)
!! Compute torsion potential
use mod_utils, only: compute_bicubic_interp
implicit none
type(ommp_bonded_type), intent(in) :: bds
! Bonded potential data structure
real(rp), intent(inout) :: V
!! torsion potential, result will be added to V
real(rp) :: thetx, thety, vtt, dvttdx, dvttdy
integer(ip) :: i, j, iprm, ibeg, iend
if(.not. bds%use_tortor) return
!$omp parallel do default(shared) reduction(+:V) &
!$omp private(i,iprm,ibeg,j,iend,thetx,thety,vtt,dvttdx,dvttdy)
do i=1, bds%ntortor
! Atoms that defines the two angles
iprm = bds%tortorprm(i)
ibeg = 1
do j=1, iprm-1
ibeg = ibeg + bds%ttmap_shape(1,j)*bds%ttmap_shape(2,j)
end do
iend = ibeg + bds%ttmap_shape(1,iprm)*bds%ttmap_shape(2,iprm) - 1
thetx = ang_torsion(bds%top, bds%tortorat(1:4,i))
thety = ang_torsion(bds%top, bds%tortorat(2:5,i))
call compute_bicubic_interp(thetx, thety, vtt, &
dvttdx, dvttdy, &
bds%ttmap_shape(1,iprm), &
bds%ttmap_shape(2,iprm), &
bds%ttmap_ang1(ibeg:iend), &
bds%ttmap_ang2(ibeg:iend), &
bds%ttmap_v(ibeg:iend), &
bds%ttmap_vx(ibeg:iend), &
bds%ttmap_vy(ibeg:iend), &
bds%ttmap_vxy(ibeg:iend))
V = V + vtt
end do
end subroutine tortor_potential