ires=0
do i=nnt,nct
iti=itype(i)
- if (iti.eq.ntyp1) then
+ if ((iti.eq.ntyp1).and.((itype(i+1)).eq.ntyp1)) then
ichain=ichain+1
ires=0
write (iunit,'(a)') 'TER'
ires=ires+1
iatom=iatom+1
ica(i)=iatom
+ if (iti.ne.ntyp1) then
write (iunit,10) iatom,restyp(iti),chainid(ichain),
& ires,(c(j,i),j=1,3),vtot(i)
if (iti.ne.10) then
write (iunit,20) iatom,restyp(iti),chainid(ichain),
& ires,(c(j,nres+i),j=1,3),
& vtot(i+nres)
+ endif
endif
endif
enddo