correction to the last commit - cleaning of homo restraints
[unres.git] / source / cluster / wham / src-M / int_from_cart1.f
1       subroutine int_from_cart1(lprn)
2       implicit real*8 (a-h,o-z)
3       include 'DIMENSIONS'
4       include 'sizesclu.dat'
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       logical lprn 
13       if (lprn) write (iout,'(/a)') 'Recalculated internal coordinates'
14       vbld(nres+1)=0.0d0
15       vbld(2*nres)=0.0d0
16       vbld_inv(nres+1)=0.0d0
17       vbld_inv(2*nres)=0.0d0
18       do i=2,nres
19         dnorm1=dist(i-1,i)
20         dnorm2=dist(i,i+1)
21         do j=1,3
22           c(j,maxres2)=0.5D0*(2*c(j,i)+(c(j,i-1)-c(j,i))/dnorm1
23      &     +(c(j,i+1)-c(j,i))/dnorm2)
24         enddo
25         be=0.0D0
26         if (i.gt.2) phi(i+1)=beta(i-2,i-1,i,i+1)
27         if (i.gt.2) tauangle(3,i+1)=beta(i+nres-1,i-1,i,i+nres)
28         if (i.gt.2) tauangle(1,i+1)=beta(i-1+nres,i-1,i,i+1)
29         if (i.gt.2) tauangle(2,i+1)=beta(i-2,i-1,i,i+nres)
30         omeg(i)=beta(nres+i,i,maxres2,i+1)
31         theta(i+1)=alpha(i-1,i,i+1)
32         alph(i)=alpha(nres+i,i,maxres2)
33         vbld(i)=dist(i-1,i)
34         vbld_inv(i)=1.0d0/vbld(i)
35         vbld(nres+i)=dist(nres+i,i)
36         if (itype(i).ne.10) then
37           vbld_inv(nres+i)=1.0d0/vbld(nres+i)
38         else
39           vbld_inv(nres+i)=0.0d0
40         endif
41       enddo   
42       do i=1,nres-1
43         do j=1,3
44           dc(j,i)=c(j,i+1)-c(j,i)
45           dc_norm(j,i)=dc(j,i)*vbld_inv(i+1)
46         enddo
47       enddo
48       do i=1,nres
49         do j=1,3
50           dc(j,i+nres)=c(j,i+nres)-c(j,i)
51           dc_norm(j,i+nres)=dc(j,i+nres)*vbld_inv(i+nres)
52         enddo
53       enddo
54       if (lprn) then
55       do i=2,nres
56        write (iout,1212) restyp(itype(i)),i,vbld(i),
57      &rad2deg*theta(i),rad2deg*phi(i),vbld(nres+i),
58      &rad2deg*alph(i),rad2deg*omeg(i)
59       enddo
60       endif
61  1212 format (a3,'(',i3,')',2(f15.10,2f10.2))
62       return
63       end