Rozgrzebany SCCOR dla wham-M
[unres.git] / source / wham / src-M / int_from_cart.f
1       subroutine int_from_cart1(lprn)
2       implicit none
3       include 'DIMENSIONS'
4       include 'DIMENSIONS.ZSCOPT'
5       include 'COMMON.IOUNITS'
6       include 'COMMON.VAR'
7       include 'COMMON.CHAIN'
8       include 'COMMON.GEO'
9       include 'COMMON.INTERACT'
10       include 'COMMON.LOCAL'
11       include 'COMMON.NAMES'
12       integer i,j
13       double precision dist,alpha,beta,dnorm1,dnorm2,be
14       logical lprn 
15       if (lprn) write (iout,'(/a)') 'Recalculated internal coordinates'
16       vbld(nres+1)=0.0d0
17       vbld(2*nres)=0.0d0
18       vbld_inv(nres+1)=0.0d0
19       vbld_inv(2*nres)=0.0d0
20       do i=2,nres
21         dnorm1=dist(i-1,i)
22         dnorm2=dist(i,i+1)
23         do j=1,3
24           c(j,maxres2)=0.5D0*(2*c(j,i)+(c(j,i-1)-c(j,i))/dnorm1
25      &     +(c(j,i+1)-c(j,i))/dnorm2)
26         enddo
27         be=0.0D0
28         if (i.gt.2) phi(i+1)=beta(i-2,i-1,i,i+1)
29         omeg(i)=beta(nres+i,i,maxres2,i+1)
30         theta(i+1)=alpha(i-1,i,i+1)
31         alph(i)=alpha(nres+i,i,maxres2)
32         vbld(i)=dist(i-1,i)
33         vbld_inv(i)=1.0d0/vbld(i)
34         vbld(nres+i)=dist(nres+i,i)
35         if (itype(i).ne.10) then
36           vbld_inv(nres+i)=1.0d0/vbld(nres+i)
37         else
38           vbld_inv(nres+i)=0.0d0
39         endif
40       enddo   
41       do i=1,nres-1
42         do j=1,3
43           dc(j,i)=c(j,i+1)-c(j,i)
44           dc_norm(j,i)=dc(j,i)*vbld_inv(i+1)
45         enddo
46       enddo
47       do i=1,nres
48         do j=1,3
49           dc(j,i+nres)=c(j,i+nres)-c(j,i)
50           dc_norm(j,i+nres)=dc(j,i+nres)*vbld_inv(i+nres)
51         enddo
52       enddo
53       if (lprn) then
54       do i=2,nres
55        write (iout,1212) restyp(itype(i)),i,vbld(i),
56      &rad2deg*theta(i),rad2deg*phi(i),vbld(nres+i),
57      &rad2deg*alph(i),rad2deg*omeg(i)
58       enddo
59       endif
60  1212 format (a3,'(',i3,')',2(f15.10,2f10.2))
61       return
62       end