From: rojas Date: Tue, 30 Jun 2015 14:49:35 +0000 (-0400) Subject: Change in energy_p_new_barrier.F, in eelec, aorund line 3065 X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?p=unres.git;a=commitdiff_plain;h=f973c199bc1118ee2c17e28c31718c36544cdc70 Change in energy_p_new_barrier.F, in eelec, aorund line 3065 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 --- diff --git a/source/unres/src_MD-M/energy_p_new_barrier.F b/source/unres/src_MD-M/energy_p_new_barrier.F index af14adb..a5d1e86 100644 --- a/source/unres/src_MD-M/energy_p_new_barrier.F +++ b/source/unres/src_MD-M/energy_p_new_barrier.F @@ -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)