cluster wham src-M corrections to match unres energy
[unres.git] / source / cluster / wham / src / read_coords.F
index 15456a2..61fbbc9 100644 (file)
@@ -129,7 +129,7 @@ C
    13 NCON=ICON-1
 
 #endif
-      call flush(iout)
+c      call flush(iout)
       jj_old=1
       open (icbase,file=bprotfiles,status="unknown",
      &   form="unformatted",access="direct",recl=lenrec)
@@ -162,7 +162,11 @@ c through a ring.
           if (iret.eq.0) then
             write (iout,*) "Error: coordinate file ",
      &       intinname(:ilen(intinname))," does not exist."
-            call flush(iout)
+#ifdef AIX
+      call flush_(iout)
+#else
+      call flush(iout)
+#endif
 #ifdef MPI
             call MPI_ABORT(MPI_COMM_WORLD,IERROR,ERRCODE)
 #endif
@@ -170,7 +174,11 @@ c through a ring.
           endif
         else
           write (iout,*) "Error: coordinate format not specified"
-          call flush(iout)
+#ifdef AIX
+      call flush_(iout)
+#else
+      call flush(iout)
+#endif
 #ifdef MPI
           call MPI_ABORT(MPI_COMM_WORLD,IERROR,ERRCODE)
 #else
@@ -181,7 +189,11 @@ c through a ring.
 #ifdef DEBUG
         write (iout,*) "Opening file ",intinname(:ilen(intinname))
         write (iout,*) "lenrec",lenrec_in
-        call flush(iout)
+#ifdef AIX
+      call flush_(iout)
+#else
+      call flush(iout)
+#endif
 #endif
 c        write (iout,*) "maxconf",maxconf
         i=0
@@ -210,6 +222,7 @@ c          call flush(iout)
                enddo
              enddo
           else
+            itmp=0
 #if (defined(AIX) && !defined(JUBL))
             call xdrf3dfcoord_(ixdrf, csingle, itmp, prec, iret)
             if (iret.eq.0) goto 101
@@ -247,7 +260,7 @@ c            call flush(iout)
             call xdrfint(ixdrf, nss, iret)
 c            write (iout,*) "iret",iret
 c            write (iout,*) "nss",nss
-            call flush(iout)
+c            call flush(iout)
             if (iret.eq.0) goto 101
             do k=1,nss
 cc              if (dyn_ss) then
@@ -297,7 +310,11 @@ cc         write(iout,*) 'refree=', refree,jj+1
           write (iout,*) "Conformation",jjj+1,jj+1
           write (iout,'(8f10.5)') ((c(j,i),j=1,3),i=1,nres)
           write (iout,'(8f10.5)') ((c(j,i+nres),j=1,3),i=nnt,nct)
-          call flush(iout)
+#ifdef AIX
+      call flush_(iout)
+#else
+      call flush(iout)
+#endif
 #endif
           call add_new_cconf(jjj,jj,jj_old,icount,Next)
         enddo
@@ -366,14 +383,22 @@ c Check if everyone has the same number of conformations
           write (iout,'(8i10)') i,ntot_all(i)
         enddo
         write (iout,*) "Calculation terminated."
-        call flush(iout)
+#ifdef AIX
+      call flush_(iout)
+#else
+      call flush(iout)
+#endif
         return1
       endif
       return
 #endif
  1111 write(iout,*) "Error opening coordinate file ",
      & intinname(:ilen(intinname))
+#ifdef AIX
+      call flush_(iout)
+#else
       call flush(iout)
+#endif
       return1
       end
 c------------------------------------------------------------------------------
@@ -529,8 +554,12 @@ c Write the structures to a scratch file
 c Master sends the portion of conformations that have been read in to the neighbor
 #ifdef DEBUG
       write (iout,*) "Processor",me," entered WRITE_AND_SEND_CONF"
+#ifdef AIX
+      call flush_(iout)
+#else
       call flush(iout)
 #endif
+#endif
       call MPI_Send(icount,1,MPI_INTEGER,Next,570,MPI_COMM_WORLD,IERROR)
       call MPI_Send(nss_all(1),icount,MPI_INTEGER,
      &    Next,571,MPI_COMM_WORLD,IERROR)
@@ -569,8 +598,12 @@ c------------------------------------------------------------------------------
       icount=1
 #ifdef DEBUG
       write (iout,*) "Processor",me," entered RECEIVE_AND_PASS_CONF"
+#ifdef AIX
+      call flush_(iout)
+#else
       call flush(iout)
 #endif
+#endif
       do while (icount.gt.0) 
       call MPI_Recv(icount,1,MPI_INTEGER,Previous,570,MPI_COMM_WORLD,
      &     STATUS,IERROR)
@@ -649,14 +682,22 @@ c
       inquire(unit=icbase,name=nam,recl=len,form=form,access=acc)
       write (iout,*) "len=",len," form=",form," acc=",acc
       write (iout,*) "nam=",nam
+#ifdef AIX
+      call flush_(iout)
+#else
       call flush(iout)
 #endif
+#endif
       do ii=istart_conf,iend_conf
         ij = ii - istart_conf + 1
         iii=list_conf(ii)
 #ifdef DEBUG
         write (iout,*) "Reading binary file, record",iii," ii",ii
-        call flush(iout)
+#ifdef AIX
+      call flush_(iout)
+#else
+      call flush(iout)
+#endif
 #endif
         if (dyn_ss) then
         read(icbase,rec=iii) ((allcart(j,i,ij),j=1,3),i=1,nres),
@@ -677,7 +718,11 @@ c     &    nss_all(ij),(ihpb_all(i,ij),jhpb_all(i,ij),i=1,nss),
         write (iout,'(2e15.5)') entfac(ij)
         write (iout,'(16i5)') nss_all(ij),(ihpb_all(i,ij),
      &    jhpb_all(i,ij),i=1,nss)
-        call flush(iout)
+#ifdef AIX
+      call flush_(iout)
+#else
+      call flush(iout)
+#endif
 #endif
       enddo
       return
@@ -713,14 +758,22 @@ c
       inquire(unit=unit_out,name=nam,recl=len,form=form,access=acc)
       write (iout,*) "len=",len," form=",form," acc=",acc
       write (iout,*) "nam=",nam
+#ifdef AIX
+      call flush_(iout)
+#else
       call flush(iout)
 #endif
+#endif
       do ii=istart_conf,iend_conf
         iii=list_conf(ii)
         ij = ii - istart_conf + 1
 #ifdef DEBUG
         write (iout,*) "Writing binary file, record",iii," ii",ii
-        call flush(iout)
+#ifdef AIX
+      call flush_(iout)
+#else
+      call flush(iout)
+#endif
 #endif
        if (dyn_ss) then
         write(unit_out,rec=iii) ((allcart(j,i,ij),j=1,3),i=1,nres),
@@ -740,7 +793,11 @@ c     &    nss_all(ij),(ihpb_all(i,ij),jhpb_all(i,ij),i=1,nss_all(ij))
         write (iout,'(2e15.5)') entfac(ij)
         write (iout,'(16i5)') nss_all(ij),(ihpb(i,ij),jhpb(i,ij),i=1,
      &   nss_all(ij))
-        call flush(iout)
+#ifdef AIX
+      call flush_(iout)
+#else
+      call flush(iout)
+#endif
 #endif
       enddo
       return