saxs and adam's corrections to multichain
[unres.git] / source / unres / src_MD-M / energy_split-sep.F
index 24ab8dd..0f67d19 100644 (file)
@@ -15,6 +15,7 @@ cMS$ATTRIBUTES C ::  proc_proc
       double precision weights_(n_ene)
 #endif
       include 'COMMON.SETUP'
+      include 'COMMON.CONTROL'
       include 'COMMON.IOUNITS'
       double precision energia(0:n_ene)
       include 'COMMON.FFIELD'
@@ -65,6 +66,7 @@ C FG slaves as WEIGHTS array.
           weights_(17)=wbond
           weights_(18)=scal14
           weights_(21)=wsccor
+          weights_(25)=wsaxs
 C FG Master broadcasts the WEIGHTS_ array
           call MPI_Bcast(weights_(1),n_ene,
      &        MPI_DOUBLE_PRECISION,king,FG_COMM,IERROR)
@@ -91,6 +93,7 @@ C FG slaves receive the WEIGHTS array
           wbond=weights(17)
           scal14=weights(18)
           wsccor=weights(21)
+          wsaxs=weights(25)
         endif
         call MPI_Bcast(dc(1,1),6*nres,MPI_DOUBLE_PRECISION,
      &    king,FG_COMM,IERR)
@@ -252,6 +255,7 @@ cMS$ATTRIBUTES C ::  proc_proc
       double precision weights_(n_ene)
 #endif
       include 'COMMON.SETUP'
+      include 'COMMON.CONTROL'
       include 'COMMON.IOUNITS'
       double precision energia(0:n_ene)
       include 'COMMON.FFIELD'
@@ -303,6 +307,7 @@ C FG slaves as WEIGHTS array.
           weights_(17)=wbond
           weights_(18)=scal14
           weights_(21)=wsccor
+          weights_(25)=wsaxs
 C FG Master broadcasts the WEIGHTS_ array
           call MPI_Bcast(weights_(1),n_ene,
      &        MPI_DOUBLE_PRECISION,king,FG_COMM,IERROR)
@@ -329,6 +334,7 @@ C FG slaves receive the WEIGHTS array
           wbond=weights(17)
           scal14=weights(18)
           wsccor=weights(21)
+          wsaxs=weights(25)
         endif
 c        write (iout,*),"Processor",myrank," BROADCAST weights"
         call MPI_Bcast(c(1,1),maxres6,MPI_DOUBLE_PRECISION,
@@ -436,6 +442,17 @@ C
       else
         esccor=0.0d0
       endif
+
+c      write (iout,*) "nsaxs",nsaxs," saxs_mode",saxs_mode
+      if (nsaxs.gt.0 .and. saxs_mode.eq.0) then
+        call e_saxs(Esaxs_constr)
+c        write (iout,*) "From Esaxs: Esaxs_constr",Esaxs_constr
+      else if (nsaxs.gt.0 .and. saxs_mode.gt.0) then
+        call e_saxsC(Esaxs_constr)
+c        write (iout,*) "From EsaxsC: Esaxs_constr",Esaxs_constr
+      else
+        Esaxs_constr = 0.0d0
+      endif        
 C
 C Put energy components into an array
 C
@@ -463,6 +480,7 @@ C
       energia(17)=estr
       energia(19)=edihcnstr
       energia(21)=esccor
+      energia(25)=Esaxs_constr
 c      write (iout,*) "ETOTAL_SHORT before SUM_ENERGY"
       call flush(iout)
       call sum_energy(energia,.true.)