out-of-bounds stdfsc from Adam
[unres.git] / source / unres / src_MD-M / gen_rand_conf.F
index 6caa718..4b6bbc0 100644 (file)
@@ -781,7 +781,7 @@ c     overlapping residues left, or false otherwise (success)
         do ires=1,ioverlap_last 
           i=ioverlap(ires)
           iti=iabs(itype(i))
-          if (iti.ne.10) then
+          if (iti.ne.10 .and. iti.lt.ntyp1 .and.iti.gt.0) then
             nsi=0
             fail=.true.
             do while (fail.and.nsi.le.maxsi)
@@ -842,6 +842,7 @@ c      print *,'>>overlap_sc nnt=',nnt,' nct=',nct
       do i=iatsc_s,iatsc_e
         itypi=iabs(itype(i))
         itypi1=iabs(itype(i+1))
+        if (itypi.gt.ntyp .or. itypi.le.0) cycle 
         xi=c(1,nres+i)
         yi=c(2,nres+i)
         zi=c(3,nres+i)
@@ -854,6 +855,7 @@ c
          do j=istart(i,iint),iend(i,iint)
             ind=ind+1
             itypj=iabs(itype(j))
+            if (itypj.gt.ntyp .or. itypj.le.0) cycle
             dscj_inv=dsc_inv(itypj)
             sig0ij=sigma(itypi,itypj)
             chi1=chi(itypi,itypj)