📄 intrabend.f90
字号:
subroutine IntraBend( X, Y, Z, kbend, theta_eq, Uintra )
implicit none
! X, Y, Z contain the coordinates of the existing beads.
real, dimension(3), intent(in) :: X, Y, Z
! kbend is the angle bending modulus and theta_eq is the equilibrium angle.
real, intent(in) :: kbend, theta_eq
! Uintra is the intramolecular bending energy.
real, intent(out) :: Uintra
! Local Variables
real, parameter :: pi = 3.14159265359
real :: costh, th
real, dimension(3) :: V, W
V(1) = X(1) - X(2)
V(2) = Y(1) - Y(2)
V(3) = Z(1) - Z(2)
W(1) = X(3) - X(2)
W(2) = Y(3) - Y(2)
W(3) = Z(3) - Z(2)
V = V / sqrt( dot_product( V, V ) )
W = W / sqrt( dot_product( W, W ) )
costh = dot_product( V, W )
if( costh > 1.0 .OR. costh < -1.0 ) then
if( costh > 1.0 ) th = 0.0
if( costh < -1.0 ) th = pi
else
th = acos( costh )
end if
Uintra = 0.5 * kbend * ( th - theta_eq ) * ( th - theta_eq )
return
end subroutine IntraBend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -