new HOMOL energy
authorCezary Czaplewski <czarek@chem.univ.gda.pl>
Fri, 20 Apr 2018 09:48:04 +0000 (11:48 +0200)
committerCezary Czaplewski <czarek@chem.univ.gda.pl>
Fri, 20 Apr 2018 09:48:04 +0000 (11:48 +0200)
use for old ifdef OLDRESTR

source/unres/src_MD/energy_p_new_barrier.F

index 2f41df9..e7611c4 100644 (file)
@@ -6077,9 +6077,13 @@ c     write(iout,*) "waga_theta",waga_theta,"waga_d",waga_d
          j = jres_homo(ii)
          dij=dist(i,j)
 c        write (iout,*) "dij(",i,j,") =",dij
+         nexl=0
          do k=1,constr_homology
 c           write(iout,*) ii,k,i,j,l_homo(k,ii),dij,odl(k,ii)
-           if(.not.l_homo(k,ii)) cycle
+           if(.not.l_homo(k,ii)) then
+             nexl=nexl+1
+             cycle
+           endif
            distance(k)=odl(k,ii)-dij
 c          write (iout,*) "distance(",k,") =",distance(k)
 c
@@ -6118,7 +6122,15 @@ c        write (iout,* )"min_odl",min_odl
          write (iout,*) "distancek",(distancek(k),k=1,constr_homology)
          write (iout,* )"min_odl",min_odl
 #endif
+#ifdef OLDRESTR
          odleg2=0.0d0
+#else
+         if (waga_dist.ge.0.0d0) then
+           odleg2=nexl
+         else 
+           odleg2=0.0d0
+         endif 
+#endif
          do k=1,constr_homology
 c Nie wiem po co to liczycie jeszcze raz!
 c            odleg3=-waga_dist(iset)*((distance(i,j,k)**2)/ 
@@ -6261,7 +6273,11 @@ c      write (iout,*) idihconstr_start_homo,idihconstr_end_homo
       enddo
 #endif
       do i=idihconstr_start_homo,idihconstr_end_homo
+#ifdef OLDRESTR
         kat2=0.0d0
+#else
+        kat2=nexl
+#endif
 c        betai=beta(i,i+1,i+2,i+3)
         betai = phi(i)
 c       write (iout,*) "betai =",betai
@@ -6366,7 +6382,11 @@ c
 c Deviation of theta angles wrt constr_homology ref structures
 c
         utheta_i=0.0d0 ! argument of Gaussian for single k
+#ifdef OLDRESTR
         gutheta_i=0.0d0 ! Sum of Gaussians over constr_homology ref structures
+#else
+        gutheta_i=nexl
+#endif
 c       do j=ifrag_back(1,i,iset)+2,ifrag_back(2,i,iset) ! original loop
 c       over residues in a fragment
 c       write (iout,*) "theta(",i,")=",theta(i)
@@ -6379,7 +6399,7 @@ c
           utheta_i=-0.5d0*theta_diff(k)**2*sigma_theta(k,i) ! waga_theta rmvd from Gaussian argument
 c         utheta_i=-0.5d0*waga_theta*theta_diff(k)**2*sigma_theta(k,i) ! waga_theta?
           gtheta(k)=dexp(utheta_i) ! + min_utheta_i?
-          gutheta_i=gutheta_i+dexp(utheta_i)   ! Sum of Gaussians (pk)
+          gutheta_i=gutheta_i+gtheta(k)  ! Sum of Gaussians (pk)
 c         Gradient for single Gaussian restraint in subr Econstr_back
 c         dutheta(j-2)=dutheta(j-2)+wfrag_back(1,i,iset)*dtheta_i/(ii-1)
 c
@@ -6434,7 +6454,11 @@ c     write (iout,*) "waga_d",waga_d
 #endif
       do i=loc_start,loc_end
         usc_diff_i=0.0d0 ! argument of Gaussian for single k
+#ifdef OLDRESTR
         guscdiff(i)=0.0d0 ! Sum of Gaussians over constr_homology ref structures
+#else
+        guscdiff(i)=nexl
+#endif
 c       do j=ifrag_back(1,i,iset)+1,ifrag_back(2,i,iset)-1 ! Econstr_back legacy
 c       write(iout,*) "xxtab, yytab, zztab"
 c       write(iout,'(i5,3f8.2)') i,xxtab(i),yytab(i),zztab(i)
@@ -6451,7 +6475,7 @@ c
 c         usc_diff(i)=-0.5d0*waga_d*(dxx**2+dyy**2+dzz**2)*sigma_d(k,i) ! waga_d?
 c         uscdiffk(k)=usc_diff(i)
           guscdiff2(k)=dexp(usc_diff_i) ! without min_scdiff
-          guscdiff(i)=guscdiff(i)+dexp(usc_diff_i)   !Sum of Gaussians (pk)
+          guscdiff(i)=guscdiff(i)+guscdiff2(k)  !Sum of Gaussians (pk)
 c          write (iout,'(i5,6f10.5)') j,xxtab(j),yytab(j),zztab(j),
 c     &      xxref(j),yyref(j),zzref(j)
         enddo