2 C------------------------------------------------------------------------------
4 double precision function alpha(i1,i2,i3)
6 c Calculates the planar angle between atoms (i1), (i2), and (i3).
10 double precision x12,x23,y12,y23,z12,z23,vnorm,wnorm,scalar,angle
11 double precision arcos
15 include 'COMMON.CHAIN'
22 vnorm=dsqrt(x12*x12+y12*y12+z12*z12)
23 wnorm=dsqrt(x23*x23+y23*y23+z23*z23)
24 if ((vnorm.eq.0.0d0).or.(wnorm.eq.0.0d0)) then
27 scalar=(x12*x23+y12*y23+z12*z23)/(vnorm*wnorm)
33 C------------------------------------------------------------------------------
35 double precision function beta(i1,i2,i3,i4)
37 c Calculates the dihedral angle between atoms (i1), (i2), (i3) and (i4)
41 double precision x12,x23,x34,y12,y23,y34,z12,z23,z34,vnorm,wnorm,
42 & vx,vy,vz,wx,wy,wz,tx,ty,tz,scalar,angle
45 include 'COMMON.CHAIN'
55 cd print '(2i3,3f10.5)',i1,i2,x12,y12,z12
56 cd print '(2i3,3f10.5)',i2,i3,x23,y23,z23
57 cd print '(2i3,3f10.5)',i3,i4,x34,y34,z34
61 wnorm=dsqrt(wx*wx+wy*wy+wz*wz)
65 vnorm=dsqrt(vx*vx+vy*vy+vz*vz)
66 if (vnorm.gt.1.0D-13 .and. wnorm.gt.1.0D-13) then
67 scalar=(vx*wx+vy*wy+vz*wz)/(vnorm*wnorm)
68 if (dabs(scalar).gt.1.0D0)
69 &scalar=0.99999999999999D0*scalar/dabs(scalar)
71 cd print '(2i4,10f7.3)',i2,i3,vx,vy,vz,wx,wy,wz,vnorm,wnorm,
76 c if (angle.le.0.0D0) angle=pi+angle
80 scalar=tx*x23+ty*y23+tz*z23
81 if (scalar.lt.0.0D0) angle=-angle
86 C------------------------------------------------------------------------------
88 double precision function dist(i1,i2)
90 c Calculates the distance between atoms (i1) and (i2).
94 double precision x12,y12,z12
97 include 'COMMON.CHAIN'
101 dist=dsqrt(x12*x12+y12*y12+z12*z12)