added source code
[unres.git] / source / unres / src_MD-M / random_multi_chain / random.f
1       implicit none 
2       double precision vec(3,1000,20),xtemp,ytemp,ztemp
3 cc vector is in the sequence: position, number of atom, number of chain
4        character*80 inname,outname,incontrol
5        character*8 junk
6        character*3 atype(1000),restyp(1000),atyptemp,resttemp,chain
7        integer natoms,i,ncopies,atnum,renum(1000),irestemp,actatom
8        integer unres,k,j,nrep
9        double precision occupan(1000),tempfact(1000),occutemp,temptemp
10        call getarg(1,inname)
11        call getarg(2,outname)
12        call getarg(3,incontrol)
13       k=18
14       call RNUNF(k)
15       write (*,*) k
16         open (6,file=incontrol, status='old')
17        read (6,*) natoms,ncopies,unres
18        open (1,file=inname, status='old')
19         if (unres.eq.0) then
20        do i=1,natoms
21         read (1,*) junk,atnum,atyptemp,resttemp,chain,irestemp,xtemp,
22      &ytemp, ztemp,occutemp,temptemp
23         vec(1,i,1)=xtemp
24         vec(2,i,1)=ytemp
25         vec(3,i,1)=ztemp
26         atype(i)=atyptemp
27         restyp(i)=resttemp
28         renum(i)=irestemp
29         occupan(i)=occutemp
30         tempfact(i)=temptemp
31        enddo
32         endif
33         if (unres.ne.0) then
34         do i=1,natoms
35         read (1,*) junk,atnum,atyptemp,resttemp,irestemp,xtemp,ytemp,
36      &ztemp
37         vec(1,i,1)=xtemp
38         vec(2,i,1)=ytemp
39         vec(3,i,1)=ztemp
40         atype(i)=atyptemp
41         restyp(i)=resttemp
42         occupan(i)=1.0
43         tempfact(i)=10.0
44         renum(i)=irestemp
45         enddo
46         endif
47        write (*,*) "end of reading"
48        open (4,file=outname)
49        junk="ATOM     "
50        do k=1,ncopies
51          if (k.eq.1) chain=" A"
52          do i=1,natoms
53          actatom=natoms*(k-1)+i
54          write (4,'(a8,i3,a4,a4,a2,i3,f12.3,2f8.3,2f6.2)') junk, actatom
55      &, atype(i),restyp(i),chain,
56      &renum(i), (vec(j,i,k),j=1,3),occupan(i),tempfact(i)
57          enddo
58       write (4,'(a3)') "TER"
59       enddo
60       end
61