- subroutine int_to_cart
-c--------------------------------------------------------------
-c This subroutine converts the energy derivatives from internal
-c coordinates to cartesian coordinates
-c-------------------------------------------------------------
- implicit real*8 (a-h,o-z)
- include 'DIMENSIONS'
- include 'COMMON.VAR'
- include 'COMMON.CHAIN'
- include 'COMMON.DERIV'
- include 'COMMON.GEO'
- include 'COMMON.LOCAL'
- include 'COMMON.INTERACT'
- include 'COMMON.MD'
- include 'COMMON.IOUNITS'
-
-c calculating dE/ddc1
- if (nres.lt.3) return
- do j=1,3
- gcart(j,1)=gcart(j,1)+gloc(1,icg)*dphi(j,1,4)
- & +gloc(nres-2,icg)*dtheta(j,1,3)
- if(itype(2).ne.10) then
- gcart(j,1)=gcart(j,1)+gloc(ialph(2,1),icg)*dalpha(j,1,2)+
- & gloc(ialph(2,1)+nside,icg)*domega(j,1,2)
- endif
- enddo
-c Calculating the remainder of dE/ddc2
- do j=1,3
- gcart(j,2)=gcart(j,2)+gloc(1,icg)*dphi(j,2,4)+
- & gloc(nres-2,icg)*dtheta(j,2,3)+gloc(nres-1,icg)*dtheta(j,1,4)
- & +gloc(nres-2,icg)*dtheta(j,1,3)
- if(itype(2).ne.10) then
- gcart(j,2)=gcart(j,2)+gloc(ialph(2,1),icg)*dalpha(j,2,2)+
- & gloc(ialph(2,1)+nside,icg)*domega(j,2,2)
- endif
- if(itype(3).ne.10) then
- gcart(j,2)=gcart(j,2)+gloc(ialph(3,1),icg)*dalpha(j,1,3)+
- & gloc(ialph(3,1)+nside,icg)*domega(j,1,3)
- endif
- if(nres.gt.4) then
- gcart(j,2)=gcart(j,2)+gloc(2,icg)*dphi(j,1,5)
- endif
- enddo
-c If there are only five residues
- if(nres.eq.5) then
- do j=1,3
- gcart(j,3)=gcart(j,3)+gloc(1,icg)*dphi(j,3,4)+gloc(2,icg)*
- & dphi(j,2,5)+gloc(nres-1,icg)*dtheta(j,2,4)+gloc(nres,icg)*
- & dtheta(j,1,5)
- if(itype(3).ne.10) then
- gcart(j,3)=gcart(j,3)+gloc(ialph(3,1),icg)*
- & dalpha(j,2,3)+gloc(ialph(3,1)+nside,icg)*domega(j,2,3)
- endif
- if(itype(4).ne.10) then
- gcart(j,3)=gcart(j,3)+gloc(ialph(4,1),icg)*
- & dalpha(j,1,4)+gloc(ialph(4,1)+nside,icg)*domega(j,1,4)
- endif
- enddo
- endif
-c If there are more than five residues
- if(nres.gt.5) then
- do i=3,nres-3
- do j=1,3
- gcart(j,i)=gcart(j,i)+gloc(i-2,icg)*dphi(j,3,i+1)
- & +gloc(i-1,icg)*dphi(j,2,i+2)+
- & gloc(i,icg)*dphi(j,1,i+3)+gloc(nres+i-4,icg)*dtheta(j,2,i+1)+
- & gloc(nres+i-3,icg)*dtheta(j,1,i+2)
- if(itype(i).ne.10) then
- gcart(j,i)=gcart(j,i)+gloc(ialph(i,1),icg)*dalpha(j,2,i)+
- & gloc(ialph(i,1)+nside,icg)*domega(j,2,i)
- endif
- if(itype(i+1).ne.10) then
- gcart(j,i)=gcart(j,i)+gloc(ialph(i+1,1),icg)*dalpha(j,1,i+1)
- & +gloc(ialph(i+1,1)+nside,icg)*domega(j,1,i+1)
- endif
- enddo
- enddo
- endif
-c Setting dE/ddnres-2
- if(nres.gt.5) then
- do j=1,3
- gcart(j,nres-2)=gcart(j,nres-2)+gloc(nres-4,icg)*
- & dphi(j,3,nres-1)+gloc(nres-3,icg)*dphi(j,2,nres)
- & +gloc(2*nres-6,icg)*
- & dtheta(j,2,nres-1)+gloc(2*nres-5,icg)*dtheta(j,1,nres)
- if(itype(nres-2).ne.10) then
- gcart(j,nres-2)=gcart(j,nres-2)+gloc(ialph(nres-2,1),icg)*
- & dalpha(j,2,nres-2)+gloc(ialph(nres-2,1)+nside,icg)*
- & domega(j,2,nres-2)
- endif
- if(itype(nres-1).ne.10) then
- gcart(j,nres-2)=gcart(j,nres-2)+gloc(ialph(nres-1,1),icg)*
- & dalpha(j,1,nres-1)+gloc(ialph(nres-1,1)+nside,icg)*
- & domega(j,1,nres-1)
- endif
- enddo
- endif
-c Settind dE/ddnres-1
- do j=1,3
- gcart(j,nres-1)=gcart(j,nres-1)+gloc(nres-3,icg)*dphi(j,3,nres)+
- & gloc(2*nres-5,icg)*dtheta(j,2,nres)
- if(itype(nres-1).ne.10) then
- gcart(j,nres-1)=gcart(j,nres-1)+gloc(ialph(nres-1,1),icg)*
- & dalpha(j,2,nres-1)+gloc(ialph(nres-1,1)+nside,icg)*
- & domega(j,2,nres-1)
- endif
- enddo
-c The side-chain vector derivatives
- do i=2,nres-1
- if(itype(i).ne.10) then
- do j=1,3
- gxcart(j,i)=gxcart(j,i)+gloc(ialph(i,1),icg)*dalpha(j,3,i)
- & +gloc(ialph(i,1)+nside,icg)*domega(j,3,i)
- enddo
- endif
- enddo
- return
- end
-
-