arcos = 0.5D0*(PI-DSIGN(1.0D0,X)*PI)
[unres.git] / source / wham / src / bxread.F
1       subroutine bxread(nazwa,islice,ii,jj,kk,ll,mm,iR,ib,iparm)
2       implicit none
3       include "DIMENSIONS"
4       include "DIMENSIONS.ZSCOPT"
5       include "DIMENSIONS.FREE"
6 #ifdef MPI
7       include "mpif.h"
8       integer IERROR,ERRCODE,STATUS(MPI_STATUS_SIZE)
9       include "COMMON.MPI"
10 #endif
11       include "COMMON.CHAIN"
12       include "COMMON.IOUNITS"
13       include "COMMON.PROTFILES"
14       include "COMMON.NAMES"
15       include "COMMON.VAR"
16       include "COMMON.GEO"
17       include "COMMON.ENEPS"
18       include "COMMON.PROT"
19       include "COMMON.INTERACT"
20       include "COMMON.FREE"
21       include "COMMON.SBRIDGE"
22       real*4 csingle(3,maxres2)
23       character*64 nazwa
24       character*128 bprotfile_temp
25       character*3 liczba
26       integer i,is,ie,j,ii,jj,k,kk,l,ll,mm,if,m
27       integer nrec,nlines,iscor,islice
28       double precision energ
29       integer ilen,iroof
30       external ilen,iroof
31       double precision rmsdev,energia(0:max_ene),efree,eini,temp
32       double precision prop(maxQ)
33       integer ntot_all(0:maxprocs-1)
34       integer iparm,ib,iib,ir,nprop,nthr,nrec_slice
35       double precision etot,time
36       logical lerr
37       nrec_slice=(rec_end(iR,ib,iparm)-rec_start(iR,ib,iparm)+1)/nslice
38       is=rec_start(iR,ib,iparm)+(islice-1)*nrec_slice
39       ie=rec_start(iR,ib,iparm)+islice*nrec_slice-1
40       write (iout,*) "bxread: islice",islice," nslice",nslice,
41      & " nrec_slice",nrec_slice
42       write (iout,*) "is",is," ie",ie,"rec_start",
43      &  rec_start(iR,ib,iparm)," rec_end",rec_end(iR,ib,iparm)
44       do i=is,ie
45             read(ientin,rec=i+1,err=101) 
46      &        ((csingle(l,k),l=1,3),k=1,nres),
47      &        ((csingle(l,k+nres),l=1,3),k=nnt,nct),
48      &        nss,(ihpb(k),jhpb(k),k=1,nss),
49      &        eini,efree,rmsdev,(prop(j),j=1,nQ),iscor
50             ii=ii+1
51             kk=kk+1
52        write(iout,*) 'BXWEJ',eini,l
53        flush(iout)
54             if (mod(kk,isampl(iparm)).eq.0) then
55             jj=jj+1
56             write(ientout,rec=jj)
57      &        ((csingle(l,k),l=1,3),k=1,nres),
58      &        ((csingle(l,k+nres),l=1,3),k=nnt,nct),
59      &        nss,(ihpb(k),jhpb(k),k=1,nss),
60      &        eini,efree,rmsdev,(prop(j),j=1,nQ),iR,ib,iparm
61 #ifdef DEBUG
62             do l=1,2*nres
63               do j=1,3
64                 c(j,l)=csingle(j,l)
65               enddo
66             enddo
67             call int_from_cart1(.false.)
68             write (iout,*) "Writing conformation, record",jj
69             write (iout,*) "Cartesian coordinates"
70             write (iout,'(8f10.5)') ((c(j,m),j=1,3),m=1,nres)
71             write (iout,'(8f10.5)') ((c(j,m+nres),j=1,3),m=nnt,nct)
72             write (iout,*) "Internal coordinates"
73             write (iout,'(8f10.4)') (vbld(k),k=nnt+1,nct)
74             write (iout,'(8f10.4)') (vbld(k),k=nres+nnt,nres+nct)
75             write (iout,'(8f10.4)') (rad2deg*theta(k),k=3,nres)
76             write (iout,'(8f10.4)') (rad2deg*phi(k),k=4,nres)
77             write (iout,'(8f10.4)') (rad2deg*alph(k),k=2,nres-1)
78             write (iout,'(8f10.4)') (rad2deg*omeg(k),k=2,nres-1)
79             write (iout,'(16i5)') nss,(ihpb(k),jhpb(k),k=1,nss)
80             write (iout,'(f10.5,i5)') rmsdev,iscor
81 #endif
82             endif
83           enddo
84   101     continue
85           close(ientin)
86           write (iout,*) ii," conformations read from DA file ",
87      &      nazwa(:ilen(nazwa))
88           write (iout,*) kk," conformations read so far, slice",islice
89           write (iout,*) jj," conformations stored so far, slice",islice
90
91       return
92       end