omeg(i)=-120d0*deg2rad
if (itype(i).le.0) omeg(i)=-omeg(i)
enddo
+c from old chainbuild
+C
+C Define the origin and orientation of the coordinate system and locate the
+C first three CA's and SC(2).
+C
+ call orig_frame
+*
+* Build the alpha-carbon chain.
+*
+ do i=4,nres
+ call locate_next_res(i)
+ enddo
+C
+C First and last SC must coincide with the corresponding CA.
+C
+ do j=1,3
+ dc(j,nres+1)=0.0D0
+ dc_norm(j,nres+1)=0.0D0
+ dc(j,nres+nres)=0.0D0
+ dc_norm(j,nres+nres)=0.0D0
+ c(j,nres+1)=c(j,1)
+ c(j,nres+nres)=c(j,nres)
+ enddo
+C
+C Define the origin and orientation of the coordinate system and locate the
+C first three CA's and SC(2).
+C
+ call orig_frame
+*
+* Build the alpha-carbon chain.
+*
+ do i=4,nres
+ call locate_next_res(i)
+ enddo
+C
+C First and last SC must coincide with the corresponding CA.
+C
+ do j=1,3
+ dc(j,nres+1)=0.0D0
+ dc_norm(j,nres+1)=0.0D0
+ dc(j,nres+nres)=0.0D0
+ dc_norm(j,nres+nres)=0.0D0
+ c(j,nres+1)=c(j,1)
+ c(j,nres+nres)=c(j,nres)
+ enddo
+
+c
else
if(me.eq.king.or..not.out1file)
& write (iout,'(a)') 'Random-generated initial geometry.'