make cp src-HCD-5D
[unres.git] / source / unres / src-HCD-5D / initialize_p.F
index dd473ed..c73426c 100644 (file)
@@ -1,8 +1,16 @@
       block data
-      implicit real*8 (a-h,o-z)
+      implicit none
       include 'DIMENSIONS'
       include 'COMMON.MCM'
-      include 'COMMON.MD'
+#ifdef LANG0
+#ifdef FIVEDIAG
+      include 'COMMON.LANGEVIN.lang0.5diag'
+#else
+      include 'COMMON.LANGEVIN.lang0'
+#endif
+#else
+      include 'COMMON.LANGEVIN'
+#endif
       data MovTypID
      &  /'pool','chain regrow','multi-bond','phi','theta','side chain',
      &   'total'/
@@ -14,7 +22,7 @@ c--------------------------------------------------------------------------
 C 
 C Define constants and zero out tables.
 C
-      implicit real*8 (a-h,o-z)
+      implicit none
       include 'DIMENSIONS'
 #ifdef MPI
       include 'mpif.h'
@@ -37,13 +45,19 @@ cMS$ATTRIBUTES C ::  proc_proc
       include 'COMMON.MINIM' 
       include 'COMMON.DERIV'
       include 'COMMON.SPLITELE'
+      include 'COMMON.VAR'
 c Common blocks from the diagonalization routines
+      integer IR,IW,IP,IJK,IPK,IDAF,NAV,IODA,KDIAG,ICORFL,IXDR
+      integer i,idumm,j,k,l,ichir1,ichir2,iblock,m
+      double precision rr
       COMMON /IOFILE/ IR,IW,IP,IJK,IPK,IDAF,NAV,IODA(400)
       COMMON /MACHSW/ KDIAG,ICORFL,IXDR
-      logical mask_r
 c      real*8 text1 /'initial_i'/
 
       mask_r=.false.
+      mask_theta=1
+      mask_phi=1
+      mask_side=1
 #ifndef ISNAN
 c NaNQ initialization
       i=-1
@@ -126,12 +140,12 @@ C input file for transfer sidechain and peptide group inside the
 C lipidic environment if lipid is implicite
 
 C DNA input files for parameters range 80-99
-C Suger input files for parameters range 100-119
+C Sugar input files for parameters range 100-119
 C All-atom input files for parameters range 120-149
 C
 C Set default weights of the energy terms.
 C
-      wlong=1.0D0
+      wsc=1.0D0
       welec=1.0D0
       wtor =1.0D0
       wang =1.0D0
@@ -291,8 +305,8 @@ C Initialize variables used in minimization.
 C   
 c     maxfun=5000
 c     maxit=2000
-      maxfun=500
-      maxit=200
+      maxfun=1000
+      maxmin=500
       tolf=1.0D-2
       rtolf=5.0D-4
 C 
@@ -300,6 +314,7 @@ C Initialize the variables responsible for the mode of gradient storage.
 C
       nfl=0
       icg=1
+      sideonly=.false.
 C
 C Initialize constants used to split the energy into long- and short-range
 C components
@@ -313,7 +328,7 @@ C      rlamb=0.3d0
       end
 c-------------------------------------------------------------------------
       block data nazwy
-      implicit real*8 (a-h,o-z)
+      implicit none
       include 'DIMENSIONS'
       include 'COMMON.NAMES'
       include 'COMMON.FFIELD'
@@ -413,13 +428,15 @@ c-------------------------------------------------------------------------
       end 
 c---------------------------------------------------------------------------
       subroutine init_int_table
-      implicit real*8 (a-h,o-z)
+      implicit none
       include 'DIMENSIONS'
 #ifdef MPI
       include 'mpif.h'
+      integer ierr,ierror
       integer blocklengths(15),displs(15)
 #endif
       include 'COMMON.CONTROL'
+      include 'COMMON.SAXS'
       include 'COMMON.SETUP'
       include 'COMMON.CHAIN'
       include 'COMMON.INTERACT'
@@ -428,7 +445,12 @@ c---------------------------------------------------------------------------
       include 'COMMON.TORCNSTR'
       include 'COMMON.IOUNITS'
       include 'COMMON.DERIV'
-      include 'COMMON.CONTACTS'
+      include 'COMMON.CORRMAT'
+      integer iturn3_start_all,iturn3_end_all,iturn4_start_all,
+     & iturn4_end_all,iatel_s_all,
+     & iatel_e_all,ielstart_all,ielend_all,ntask_cont_from_all,
+     & itask_cont_from_all,ntask_cont_to_all,itask_cont_to_all,
+     & n_sc_int_tot,my_sc_inds,my_sc_inde,ind_sctint,ind_scint_old
       common /przechowalnia/ iturn3_start_all(0:max_fg_procs),
      & iturn3_end_all(0:max_fg_procs),iturn4_start_all(0:max_fg_procs),
      & iturn4_end_all(0:max_fg_procs),iatel_s_all(0:max_fg_procs),
@@ -440,15 +462,23 @@ c---------------------------------------------------------------------------
      & itask_cont_to_all(0:max_fg_procs-1,0:max_fg_procs-1)
       integer FG_GROUP,CONT_FROM_GROUP,CONT_TO_GROUP
       logical scheck,lprint,flag
+      integer i,j,k,ii,jj,iint,npept,nele_int_tot,ind_eleint,ind_scint,
+     & my_ele_inds,my_ele_inde,ind_eleint_old,nele_int_tot_vdw,
+     & my_ele_inds_vdw,my_ele_inde_vdw,ind_eleint_vdw,ijunk,
+     & ind_eleint_vdw_old,nscp_int_tot,my_scp_inds,my_scp_inde,
+     & ind_scpint,ind_scpint_old,nsumgrad,nlen,ngrad_start,ngrad_end,
+     & iaux,ind_typ,ncheck_from,ncheck_to,ichunk
 #ifdef MPI
       integer my_sc_int(0:max_fg_Procs-1),my_sc_intt(0:max_fg_Procs),
      & my_ele_int(0:max_fg_Procs-1),my_ele_intt(0:max_fg_Procs)
 C... Determine the numbers of start and end SC-SC interaction 
 C... to deal with by current processor.
+#ifdef FOURBODY
       do i=0,nfgtasks-1
         itask_cont_from(i)=fg_rank
         itask_cont_to(i)=fg_rank
       enddo
+#endif
       lprint=energy_dec
       if (lprint)
      &write (iout,*) 'INIT_INT_TABLE nres=',nres,' nnt=',nnt,' nct=',nct
@@ -866,6 +896,7 @@ c      nlen=nres-nnt+1
         enddo
         call flush(iout)
         endif
+#ifdef FOURBODY
         ntask_cont_from=0
         ntask_cont_to=0
         itask_cont_from(0)=fg_rank
@@ -1066,6 +1097,7 @@ c          call flush(iout)
         call MPI_Group_free(fg_group,ierr)
         call MPI_Group_free(cont_from_group,ierr)
         call MPI_Group_free(cont_to_group,ierr)
+#endif
         call MPI_Type_contiguous(3,MPI_DOUBLE_PRECISION,MPI_UYZ,IERROR)
         call MPI_Type_commit(MPI_UYZ,IERROR)
         call MPI_Type_contiguous(18,MPI_DOUBLE_PRECISION,MPI_UYZGRAD,
@@ -1442,12 +1474,13 @@ c---------------------------------------------------------------------------
       end
 c---------------------------------------------------------------------------
       subroutine int_bounds(total_ints,lower_bound,upper_bound)
-      implicit real*8 (a-h,o-z)
+      implicit none
       include 'DIMENSIONS'
       include 'mpif.h'
       include 'COMMON.SETUP'
       integer total_ints,lower_bound,upper_bound
       integer int4proc(0:max_fg_procs),sint4proc(0:max_fg_procs)
+      integer i,nint,nexcess
       nint=total_ints/nfgtasks
       do i=1,nfgtasks
         int4proc(i-1)=nint
@@ -1466,12 +1499,13 @@ c---------------------------------------------------------------------------
       end
 c---------------------------------------------------------------------------
       subroutine int_bounds1(total_ints,lower_bound,upper_bound)
-      implicit real*8 (a-h,o-z)
+      implicit none
       include 'DIMENSIONS'
       include 'mpif.h'
       include 'COMMON.SETUP'
       integer total_ints,lower_bound,upper_bound
       integer int4proc(0:max_fg_procs),sint4proc(0:max_fg_procs)
+      integer i,nint,nexcess
       nint=total_ints/nfgtasks1
       do i=1,nfgtasks1
         int4proc(i-1)=nint
@@ -1491,11 +1525,11 @@ c---------------------------------------------------------------------------
 c---------------------------------------------------------------------------
       subroutine int_partition(int_index,lower_index,upper_index,atom,
      & at_start,at_end,first_atom,last_atom,int_gr,jat_start,jat_end,*)
-      implicit real*8 (a-h,o-z)
+      implicit none
       include 'DIMENSIONS'
       include 'COMMON.IOUNITS'
       integer int_index,lower_index,upper_index,atom,at_start,at_end,
-     & first_atom,last_atom,int_gr,jat_start,jat_end
+     & first_atom,last_atom,int_gr,jat_start,jat_end,int_index_old
       logical lprn
       lprn=.false.
       if (lprn) write (iout,*) 'int_index=',int_index
@@ -1531,7 +1565,7 @@ c---------------------------------------------------------------------------
 #endif
 c------------------------------------------------------------------------------
       subroutine hpb_partition
-      implicit real*8 (a-h,o-z)
+      implicit none
       include 'DIMENSIONS'
 #ifdef MPI
       include 'mpif.h'
@@ -1553,7 +1587,7 @@ c------------------------------------------------------------------------------
       end
 c------------------------------------------------------------------------------
       subroutine homology_partition
-      implicit real*8 (a-h,o-z)
+      implicit none
       include 'DIMENSIONS'
 #ifdef MPI
       include 'mpif.h'
@@ -1562,8 +1596,8 @@ c------------------------------------------------------------------------------
       include 'COMMON.IOUNITS'
       include 'COMMON.SETUP'
       include 'COMMON.CONTROL'
-      include 'COMMON.MD'
       include 'COMMON.INTERACT'
+      include 'COMMON.HOMOLOGY'
 cd      write(iout,*)"homology_partition: lim_odl=",lim_odl,
 cd     &   " lim_dih",lim_dih
 #ifdef MPI
@@ -1596,7 +1630,7 @@ cd     &   " lim_dih",lim_dih
       end
 c------------------------------------------------------------------------------
       subroutine NMRpeak_partition
-      implicit real*8 (a-h,o-z)
+      implicit none
       include 'DIMENSIONS'
 #ifdef MPI
       include 'mpif.h'