Adam 7/30/2014
[unres.git] / source / cluster / wham / src / energy_p_new.F
index 38090fe..ee00811 100644 (file)
       include 'COMMON.VAR'
       include 'COMMON.INTERACT'
       include 'COMMON.IOUNITS'
+      include 'COMMON.NAMES'
       dimension ggg(3)
       ehpb=0.0D0
 cd      write(iout,*)'edis: nhpb=',nhpb,' fbr=',fbr
 cd      write(iout,*)'link_start=',link_start,' link_end=',link_end
+#ifdef DEBUG
+      do i=1,nres
+        write (iout,'(a4,2x,i4,3f10.5,5x,3f10.5)') restyp(itype(i)),i,
+     &      (c(j,i),j=1,3),(c(j,i+nres),j=1,3)
+      enddo
+#endif
       if (link_end.eq.0) return
       do i=link_start,link_end
 C If ihpb(i) and jhpb(i) > NRES, this is a SC-SC distance, otherwise a
@@ -2818,8 +2825,10 @@ C iii and jjj point to the residues for which the distance is assigned.
           iii=ii
           jjj=jj
         endif
-c        write (iout,*) "i",i," ii",ii," iii",iii," jj",jj," jjj",jjj,
-c     &    dhpb(i),dhpb1(i),forcon(i)
+#ifdef DEBUG
+        write (iout,*) "i",i," ii",ii," iii",iii," jj",jj," jjj",jjj,
+     &    dhpb(i),dhpb1(i),forcon(i)
+#endif
 C 24/11/03 AL: SS bridges handled separately because of introducing a specific
 C    distance and angle dependent SS bond potential.
         if (ii.gt.nres .and. itype(iii).eq.1 .and. itype(jjj).eq.1) then
@@ -2832,8 +2841,10 @@ c Restraints from contact prediction
           if (dhpb1(i).gt.0.0d0) then
             ehpb=ehpb+2*forcon(i)*gnmr1(dd,dhpb(i),dhpb1(i))
             fac=forcon(i)*gnmr1prim(dd,dhpb(i),dhpb1(i))/dd
-c            write (iout,*) "beta nmr",
-c     &        dd,2*forcon(i)*gnmr1(dd,dhpb(i),dhpb1(i))
+#ifdef DEBUG
+            write (iout,*) "beta nmr",
+     &        dd,2*forcon(i)*gnmr1(dd,dhpb(i),dhpb1(i))
+#endif
           else
             dd=dist(ii,jj)
             rdis=dd-dhpb(i)
@@ -2841,7 +2852,9 @@ C Get the force constant corresponding to this distance.
             waga=forcon(i)
 C Calculate the contribution to energy.
             ehpb=ehpb+waga*rdis*rdis
-c            write (iout,*) "beta reg",dd,waga*rdis*rdis
+#ifdef DEBUG
+            write (iout,*) "beta reg",dd,waga*rdis*rdis
+#endif
 C
 C Evaluate gradient.
 C
@@ -2865,15 +2878,19 @@ C target distance.
           if (dhpb1(i).gt.0.0d0) then
             ehpb=ehpb+2*forcon(i)*gnmr1(dd,dhpb(i),dhpb1(i))
             fac=forcon(i)*gnmr1prim(dd,dhpb(i),dhpb1(i))/dd
-c            write (iout,*) "alph nmr",
-c     &        dd,2*forcon(i)*gnmr1(dd,dhpb(i),dhpb1(i))
+#ifdef DEBUG
+            write (iout,*) "alph nmr",
+     &        dd,2*forcon(i)*gnmr1(dd,dhpb(i),dhpb1(i))
+#endif
           else
             rdis=dd-dhpb(i)
 C Get the force constant corresponding to this distance.
             waga=forcon(i)
 C Calculate the contribution to energy.
             ehpb=ehpb+waga*rdis*rdis
-c            write (iout,*) "alpha reg",dd,waga*rdis*rdis
+#ifdef DEBUG
+            write (iout,*) "alpha reg",dd,waga*rdis*rdis
+#endif
 C
 C Evaluate gradient.
 C