Merge branch 'lipid' of mmka.chem.univ.gda.pl:unres into lipid
[unres.git] / source / wham / src-M / enecalc1.F
index ab0a408..36ef370 100644 (file)
@@ -60,6 +60,8 @@
           enddo
         enddo
       enddo
+      write (iout,*) "indstart(me1),indend(me1)"
+     &,indstart(me1),indend(me1)
       do i=indstart(me1),indend(me1)
 #else
       do iparm=1,nParmSet
@@ -71,6 +73,7 @@
       enddo
       do i=1,ntot
 #endif
+
         read(ientout,rec=i,err=101) 
      &    ((csingle(l,k),l=1,3),k=1,nres),
      &    ((csingle(l,k+nres),l=1,3),k=nnt,nct),
@@ -154,12 +157,18 @@ c     &   " kfac",kfac,"quot",quot," fT",fT
      &      wcorr,wcorr5,wcorr6,wturn4,wturn3,wturn6,wel_loc,
      &      wtor_d,wsccor,wbond
 #endif
+C        write (iout,*) "tuz przed energia"
         call etotal(energia(0),fT)
+C        write (iout,*) "tuz za energia"
+#define DEBUG
 #ifdef DEBUG
         write (iout,*) "Conformation",i
           write (iout,'(8f10.5)') ((c(l,k),l=1,3),k=1,nres)
           write (iout,'(8f10.5)') ((c(l,k+nres),l=1,3),k=nnt,nct)
         call enerprint(energia(0),fT)
+#endif
+#undef DEBUG
+#ifdef DEBUG
         write (iout,'(2i5,21f8.2)') i,iparm,(energia(k),k=1,21)
         write (iout,*) "ftors(1)",ftors(1)
         call briefout(i,energia(0))
@@ -220,8 +229,9 @@ c              call intout
               endif
             endif
           endif
+C          write (iout,*) "Czy tu dochodze"
           potE(iii+1,iparm)=energia(0)
-          do k=1,21
+          do k=1,22
             enetb(k,iii+1,iparm)=energia(k)
           enddo
 #ifdef DEBUG
@@ -736,11 +746,36 @@ c------------------------------------------------------------------------------
       endif
       call int_from_cart1(.false.)
       do j=nnt+1,nct
+        if (wliptran.gt.0d0) then
+        if (itype(j-1).ne.ntyp1 .and. itype(j).ne.ntyp1 .and.
+     &    (vbld(j).lt.2.0d0 .or. vbld(j).gt.5.3d0)) then
+          if (iprint.gt.0)
+     &    write (iout,*) "Bad CA-CA bond length",j," ",vbld(j),
+     &      " for conformation",ii,wliptran
+          if (iprint.gt.1) then
+            write (iout,*) "The Cartesian geometry is:"
+            write (iout,'(8f10.5)') ((c(l,k),l=1,3),k=1,nres)
+            write (iout,'(8f10.5)') ((c(l,k+nres),l=1,3),k=nnt,nct)
+            write (iout,*) "The internal geometry is:"
+            write (iout,'(8f10.4)') (vbld(k),k=nnt+1,nct)
+            write (iout,'(8f10.4)') (vbld(k),k=nres+nnt,nres+nct)
+            write (iout,'(8f10.4)') (rad2deg*theta(k),k=3,nres)
+            write (iout,'(8f10.4)') (rad2deg*phi(k),k=4,nres)
+            write (iout,'(8f10.4)') (rad2deg*alph(k),k=2,nres-1)
+            write (iout,'(8f10.4)') (rad2deg*omeg(k),k=2,nres-1)
+          endif
+          if (iprint.gt.0) write (iout,*)
+     &      "This conformation WILL NOT be added to the database."
+          conf_check=.false.
+          return
+        endif
+
+        else
         if (itype(j-1).ne.ntyp1 .and. itype(j).ne.ntyp1 .and. 
      &    (vbld(j).lt.2.0d0 .or. vbld(j).gt.5.0d0)) then
           if (iprint.gt.0) 
      &    write (iout,*) "Bad CA-CA bond length",j," ",vbld(j),
-     &      " for conformation",ii
+     &      " for conformation",ii,wliptran
           if (iprint.gt.1) then
             write (iout,*) "The Cartesian geometry is:"
             write (iout,'(8f10.5)') ((c(l,k),l=1,3),k=1,nres)
@@ -758,6 +793,7 @@ c------------------------------------------------------------------------------
           conf_check=.false.
           return
         endif
+        endif
       enddo
       do j=nnt,nct
         itj=itype(j)