implicit none double precision vec(3,1000,20),xtemp,ytemp,ztemp cc vector is in the sequence: position, number of atom, number of chain character*80 inname,outname,incontrol character*8 junk character*3 atype(1000),restyp(1000),atyptemp,resttemp,chain integer natoms,i,ncopies,atnum,renum(1000),irestemp,actatom integer unres,k,j,nrep double precision occupan(1000),tempfact(1000),occutemp,temptemp call getarg(1,inname) call getarg(2,outname) call getarg(3,incontrol) k=18 call RNUNF(k) write (*,*) k open (6,file=incontrol, status='old') read (6,*) natoms,ncopies,unres open (1,file=inname, status='old') if (unres.eq.0) then do i=1,natoms read (1,*) junk,atnum,atyptemp,resttemp,chain,irestemp,xtemp, &ytemp, ztemp,occutemp,temptemp vec(1,i,1)=xtemp vec(2,i,1)=ytemp vec(3,i,1)=ztemp atype(i)=atyptemp restyp(i)=resttemp renum(i)=irestemp occupan(i)=occutemp tempfact(i)=temptemp enddo endif if (unres.ne.0) then do i=1,natoms read (1,*) junk,atnum,atyptemp,resttemp,irestemp,xtemp,ytemp, &ztemp vec(1,i,1)=xtemp vec(2,i,1)=ytemp vec(3,i,1)=ztemp atype(i)=atyptemp restyp(i)=resttemp occupan(i)=1.0 tempfact(i)=10.0 renum(i)=irestemp enddo endif write (*,*) "end of reading" open (4,file=outname) junk="ATOM " do k=1,ncopies if (k.eq.1) chain=" A" do i=1,natoms actatom=natoms*(k-1)+i write (4,'(a8,i3,a4,a4,a2,i3,f12.3,2f8.3,2f6.2)') junk, actatom &, atype(i),restyp(i),chain, &renum(i), (vec(j,i,k),j=1,3),occupan(i),tempfact(i) enddo write (4,'(a3)') "TER" enddo end