multichain debug print removed (no fort.2 file)
[unres.git] / source / unres / src_MD-M / lagrangian_lesyng.F
index f9a48fc..b4eec37 100644 (file)
@@ -46,7 +46,7 @@ c-------------------------------------------------------------------------
       enddo
       if (lprn) write (iout,*) "Potential forces sidechain"
       do i=nnt,nct
-        if (itype(i).ne.10 .and. itype(i).ne.21) then
+        if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then
           if (lprn) write (iout,'(i5,3e15.5,5x,3e15.5)') 
      &       i,(-gcart(j,i),j=1,3)
           do j=1,3
@@ -69,7 +69,7 @@ c-------------------------------------------------------------------------
         enddo
       enddo
       do i=nnt,nct
-        if (itype(i).ne.10 .and. itype(i).ne.21) then
+        if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then
           do j=1,3
             ind=ind+1
             d_a(j,i+nres)=d_a_work(ind)
@@ -124,6 +124,7 @@ c------------------------------------------------------------------
       integer ierror
 #endif
       include 'COMMON.SETUP'
+      include 'COMMON.CONTROL'
       include 'COMMON.VAR'
       include 'COMMON.CHAIN'
       include 'COMMON.DERIV'
@@ -167,12 +168,14 @@ c sites (dimen1)
       my_ng_count=igmult_end-igmult_start
       call MPI_Allgather(3*my_ng_count,1,MPI_INTEGER,ng_counts(0),1,
      &    MPI_INTEGER,FG_COMM,IERROR)
-      write (iout,*) 'Processor:',fg_rank,' CG group',kolor,
+       if (me.eq.king .or. .not. out1file) then
+        write (iout,*) 'Processor:',fg_rank,' CG group',kolor,
      & ' absolute rank',myrank,' igmult_start',igmult_start,
      & ' igmult_end',igmult_end,' count',my_ng_count
-      write (iout,*) "ng_start",(ng_start(i),i=0,nfgtasks-1)
-      write (iout,*) "ng_counts",(ng_counts(i),i=0,nfgtasks-1)
-      call flush(iout)
+        write (iout,*) "ng_start",(ng_start(i),i=0,nfgtasks-1)
+        write (iout,*) "ng_counts",(ng_counts(i),i=0,nfgtasks-1)
+        call flush(iout)
+       endif
       else
 #endif
       igmult_start=1
@@ -212,17 +215,17 @@ c  Diagonal elements of the dX part of A and the respective friction coefficient
       m1=nct-nnt+1
       ind=0
       ind1=0
-      msc(21)=1.0d0
+      msc(ntyp1)=1.0d0
       do i=nnt,nct
         ind=ind+1
         ii = ind+m
         iti=itype(i)
-        massvec(ii)=msc(iti)
-        if (iti.ne.10 .and. iti.ne.21) then
+        massvec(ii)=msc(iabs(iti))
+        if (iti.ne.10 .and. iti.ne.ntyp1) then
           ind1=ind1+1
           ii1= ind1+m1
           A(ii,ii1)=1.0d0
-          Gmat(ii1,ii1)=ISC(iti)
+          Gmat(ii1,ii1)=ISC(iabs(iti))
         endif
       enddo
 c  Off-diagonal elements of the dX part of A
@@ -282,9 +285,11 @@ c Invert the G matrix
      &    nginv_start(0),1,MPI_INTEGER,FG_COMM,IERROR)
         call MPI_Allgather(myginv_ng_count,1,MPI_INTEGER,
      &    nginv_counts(0),1,MPI_INTEGER,FG_COMM,IERROR)
-        write (iout,*) "nginv_start",(nginv_start(i),i=0,nfgtasks-1)
-        write (iout,*) "nginv_counts",(nginv_counts(i),i=0,nfgtasks-1)
-        call flush(iout)
+        if (lprn .and. (me.eq.king .or. .not. out1file) ) then
+          write (iout,*) "nginv_start",(nginv_start(i),i=0,nfgtasks-1)
+          write (iout,*) "nginv_counts",(nginv_counts(i),i=0,nfgtasks-1)
+          call flush(iout)
+        endif
 c        call MPI_Scatterv(ginv(1,1),nginv_counts(0),
 c     &    nginv_start(0),MPI_DOUBLE_PRECISION,ginv,
 c     &    myginv_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
@@ -476,7 +481,7 @@ c---------------------------------------------------------------------------
       include 'COMMON.TIME1'
       include 'COMMON.MD'
       double precision z(dimen3),d_a_tmp(dimen3),temp(maxres6),time00
-     &time01
+     &,time01,zcopy(dimen3)
 #ifdef MPI
       if (nfgtasks.gt.1) then
         if (fg_rank.eq.0) then
@@ -497,7 +502,10 @@ c        call MPI_Barrier(FG_COMM,IERROR)
         time00=MPI_Wtime()
         call MPI_Scatterv(z,ng_counts(0),ng_start(0),
      &    MPI_DOUBLE_PRECISION,
-     &    z,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+     &    zcopy,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+         do i=1,3*my_ng_count
+           z(i)=zcopy(i)
+         enddo
 c        write (2,*) "My chunk of z"
 c        do i=1,3*my_ng_count
 c          write (2,*) i,z(i)
@@ -628,7 +636,7 @@ c---------------------------------------------------------------------------
       include 'COMMON.LANGEVIN.lang0'
 #endif
       double precision z(dimen3),d_a_tmp(dimen3),temp(maxres6),time00
-     &time01
+     &,time01,zcopy(dimen3)
 #ifdef MPI
       if (nfgtasks.gt.1) then
         if (fg_rank.eq.0) then
@@ -642,7 +650,11 @@ c        call MPI_Barrier(FG_COMM,IERROR)
         time00=MPI_Wtime()
         call MPI_Scatterv(z,ng_counts(0),ng_start(0),
      &    MPI_DOUBLE_PRECISION,
-     &    z,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+     &    zcopy,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+
+         do i=1,3*my_ng_count
+          z(i)=zcopy(i)
+         enddo
 c        write (2,*) "My chunk of z"
 c        do i=1,3*my_ng_count
 c          write (2,*) i,z(i)