Change in energy_p_new_barrier.F, in eelec, aorund line 3065
authorrojas <anarojas1@gmail.com>
Tue, 30 Jun 2015 14:49:35 +0000 (10:49 -0400)
committerrojas <anarojas1@gmail.com>
Tue, 30 Jun 2015 14:49:35 +0000 (10:49 -0400)
 Because in general iturn3_start and iturn3_end are nnt and nct-3,
respectively, if the chain has a GLY as the first or last residues,
nnt=1 or nct=nres, the program ends up evaluating itype(0) or itype(nres+1).
The first case causes a segmentation fault, the second won't (if maxres is
bigger than nres), but it won't cycle the loop which is what was intended

source/unres/src_MD-M/energy_p_new_barrier.F

index af14adb..a5d1e86 100644 (file)
@@ -3065,10 +3065,13 @@ C 14/01/2014 TURN3,TUNR4 does no go under periodic boundry condition
       do i=iturn3_start,iturn3_end
         if (itype(i).eq.ntyp1 .or. itype(i+1).eq.ntyp1
      &  .or. itype(i+2).eq.ntyp1
-     &  .or. itype(i+3).eq.ntyp1
-     &  .or. itype(i-1).eq.ntyp1
-     &  .or. itype(i+4).eq.ntyp1
-     &  ) cycle
+     &  .or. itype(i+3).eq.ntyp1) cycle
+        if(i.gt.1)then
+          if(itype(i-1).eq.ntyp1)cycle
+        end if
+        if(i.LT.nres-3)then
+          if (itype(i+4).eq.ntyp1) cycle
+        end if
         dxi=dc(1,i)
         dyi=dc(2,i)
         dzi=dc(3,i)