corrections to src_MD-M for the same energy as src_MD
[unres.git] / source / unres / src_MD-M / readrtns_CSA.F
index e89d8ce..bd17218 100644 (file)
@@ -722,9 +722,11 @@ C 12/1/95 Added weight for the multi-body term WCORR
   33    write (iout,'(a)') 'Error opening PDB file.'
         stop
   34    continue
-c        print *,'Begin reading pdb data'
+c        write (iout,*) 'Begin reading pdb data'
+c        call flush(iout)
         call readpdb
-c        print *,'Finished reading pdb data'
+c        write (iout,*) 'Finished reading pdb data'
+c        call flush(iout)
         if(me.eq.king.or..not.out1file)
      &   write (iout,'(a,i3,a,i3)')'nsup=',nsup,
      &   ' nstart_sup=',nstart_sup
@@ -1036,18 +1038,7 @@ C initial geometry.
    40       continue
           endif
 #else
-          do itrial=1,100
-            itmp=1
-            call gen_rand_conf(itmp,*30)
-            goto 40
-   30       write (iout,*) 'Failed to generate random conformation',
-     &        ', itrial=',itrial
-            write (*,*) 'Failed to generate random conformation',
-     &        ', itrial=',itrial
-          enddo
-          write (iout,'(a,i3,a)') 'Processor:',me,
-     &      ' error in generating random conformation.'
-          write (*,'(a,i3,a)') 'Processor:',me,
+          write (*,'(a)') 
      &      ' error in generating random conformation.'
           stop
    40     continue
@@ -1871,8 +1862,16 @@ C Get parameter filenames and open the parameter files.
       open (ibond,file=bondname,status='old',readonly,shared)
       call getenv_loc('THETPAR',thetname)
       open (ithep,file=thetname,status='old',readonly,shared)
+#ifndef CRYST_THETA
+      call getenv_loc('THETPARPDB',thetname_pdb)
+      open (ithep_pdb,file=thetname_pdb,status='old',readonly,shared)
+#endif
       call getenv_loc('ROTPAR',rotname)
       open (irotam,file=rotname,status='old',readonly,shared)
+#ifndef CRYST_SC
+      call getenv_loc('ROTPARPDB',rotname_pdb)
+      open (irotam_pdb,file=rotname_pdb,status='old',readonly,shared)
+#endif
       call getenv_loc('TORPAR',torname)
       open (itorp,file=torname,status='old',readonly,shared)
       call getenv_loc('TORDPAR',tordname)
@@ -1897,9 +1896,17 @@ c      print *,"Processor",myrank," opened file IBOND"
       call getenv_loc('THETPAR',thetname)
       open (ithep,file=thetname,status='old',action='read')
 c      print *,"Processor",myrank," opened file ITHEP" 
+#ifndef CRYST_THETA
+      call getenv_loc('THETPARPDB',thetname_pdb)
+      open (ithep_pdb,file=thetname_pdb,status='old',action='read')
+#endif
       call getenv_loc('ROTPAR',rotname)
       open (irotam,file=rotname,status='old',action='read')
 c      print *,"Processor",myrank," opened file IROTAM" 
+#ifndef CRYST_SC
+      call getenv_loc('ROTPARPDB',rotname_pdb)
+      open (irotam_pdb,file=rotname_pdb,status='old',action='read')
+#endif
       call getenv_loc('TORPAR',torname)
       open (itorp,file=torname,status='old',action='read')
 c      print *,"Processor",myrank," opened file ITORP" 
@@ -1928,8 +1935,16 @@ C Get parameter filenames and open the parameter files.
       open (ibond,file=bondname,status='old')
       call getenv_loc('THETPAR',thetname)
       open (ithep,file=thetname,status='old')
+#ifndef CRYST_THETA
+      call getenv_loc('THETPARPDB',thetname_pdb)
+      open (ithep_pdb,file=thetname_pdb,status='old')
+#endif
       call getenv_loc('ROTPAR',rotname)
       open (irotam,file=rotname,status='old')
+#ifndef CRYST_SC
+      call getenv_loc('ROTPARPDB',rotname_pdb)
+      open (irotam_pdb,file=rotname_pdb,status='old')
+#endif
       call getenv_loc('TORPAR',torname)
       open (itorp,file=torname,status='old')
       call getenv_loc('TORDPAR',tordname)
@@ -1952,8 +1967,18 @@ C Get parameter filenames and open the parameter files.
       open (ibond,file=bondname,status='old',readonly)
       call getenv_loc('THETPAR',thetname)
       open (ithep,file=thetname,status='old',readonly)
+#ifndef CRYST_THETA
+      call getenv_loc('THETPARPDB',thetname_pdb)
+      print *,"thetname_pdb ",thetname_pdb
+      open (ithep_pdb,file=thetname_pdb,status='old',action='read')
+      print *,ithep_pdb," opened"
+#endif
       call getenv_loc('ROTPAR',rotname)
       open (irotam,file=rotname,status='old',readonly)
+#ifndef CRYST_SC
+      call getenv_loc('ROTPARPDB',rotname_pdb)
+      open (irotam_pdb,file=rotname_pdb,status='old',action='read')
+#endif
       call getenv_loc('TORPAR',torname)
       open (itorp,file=torname,status='old',readonly)
       call getenv_loc('TORDPAR',tordname)
@@ -2036,7 +2061,7 @@ c      print *,"Processor",myrank," fg_rank",fg_rank
       mol2name=prefix(:lenpre)//'_'//pot(:lenpot)//'.mol2'
       statname=prefix(:lenpre)//'_'//pot(:lenpot)//'.stat'
       if (lentmp.gt.0)
-     &  call copy_to_tmp(pref_orig(:ile(pref_orig))//'_'//pot(:lenpot)//
+     &  call copy_to_tmp(pref_orig(:ilen(pref_orig))//'_'//pot(:lenpot)
      &    //'.stat')
       rest2name=prefix(:ilen(prefix))//'.rst'
       if(usampl) then 
@@ -2397,6 +2422,9 @@ C Initialize random number generator
 C
       implicit real*8 (a-h,o-z)
       include 'DIMENSIONS'
+#ifdef AMD64
+      integer*8 iseedi8
+#endif
 #ifdef MPI
       include 'mpif.h'
       logical OKRandom, prng_restart
@@ -2432,9 +2460,11 @@ C
       if (fg_rank.eq.0) then
       seed=seed*(me+1)+1
 #ifdef AMD64
-      if(me.eq.king)
-     &  write (iout,*) 'MPI: node= ', me, ' iseed= ',iseed
-      OKRandom = prng_restart(me,iseed)
+      iseedi8=dint(seed)
+      if(me.eq.king .or. .not. out1file)
+     &  write (iout,*) 'MPI: node= ', me, ' iseed= ',iseedi8
+      write (*,*) 'MPI: node= ', me, ' iseed= ',iseedi8
+      OKRandom = prng_restart(me,iseedi8)
 #else
       do i=1,4
        tmp=65536.0d0**(4-i)