dissulfides energy and gfortran ctests
[unres.git] / source / unres / src_MD / gen_rand_conf.F
index ec15679..ad1269a 100644 (file)
@@ -15,8 +15,8 @@ cd    print *,' CG Processor',me,' maxgen=',maxgen
       maxsi=100
 cd    write (iout,*) 'Gen_Rand_conf: nstart=',nstart
       if (nstart.lt.5) then
-        it1=iabs(itype(2))
-        phi(4)=gen_phi(4,iabs(itype(2)),abs(itype(3)))
+        it1=itype(2)
+        phi(4)=gen_phi(4,itype(2),itype(3))
 c       write(iout,*)'phi(4)=',rad2deg*phi(4)
         if (nstart.lt.3) theta(3)=gen_theta(itype(2),pi,phi(4))
 c       write(iout,*)'theta(3)=',rad2deg*theta(3) 
@@ -54,9 +54,9 @@ c       write(iout,*)'theta(3)=',rad2deg*theta(3)
           endif
           return1
         endif
-       it1=abs(itype(i-1))
-       it2=abs(itype(i-2))
-       it=abs(itype(i))
+       it1=itype(i-1)
+       it2=itype(i-2)
+       it=itype(i)
 c       print *,'Gen_Rand_Conf: i=',i,' it=',it,' it1=',it1,' it2=',it2,
 c    &    ' nit=',nit,' niter=',niter,' maxgen=',maxgen
        phi(i+1)=gen_phi(i+1,it1,it)
@@ -132,12 +132,12 @@ c-------------------------------------------------------------------------
       include 'COMMON.FFIELD'
       data redfac /0.5D0/
       overlap=.false.
-      iti=abs(itype(i))
+      iti=itype(i)
       if (iti.gt.ntyp) return
 C Check for SC-SC overlaps.
 cd    print *,'nnt=',nnt,' nct=',nct
       do j=nnt,i-1
-        itj=abs(itype(j))
+        itj=itype(j)
         if (j.lt.i-1 .or. ipot.ne.4) then
           rcomp=sigmaii(iti,itj)
         else 
@@ -159,7 +159,7 @@ C SCs.
        c(j,maxres2+1)=0.5D0*(c(j,i)+c(j,i+1))
       enddo
       do j=nnt,i-2
-       itj=abs(itype(j))
+       itj=itype(j)
 cd      print *,'overlap, p-Sc: i=',i,' j=',j,
 cd   &         ' dist=',dist(nres+j,maxres2+1)
        if (dist(nres+j,maxres2+1).lt.4.0D0*redfac) then
@@ -779,7 +779,7 @@ c     overlapping residues left, or false otherwise (success)
 
         do ires=1,ioverlap_last 
           i=ioverlap(ires)
-          iti=abs(itype(i))
+          iti=itype(i)
           if (iti.ne.10) then
             nsi=0
             fail=.true.
@@ -838,9 +838,10 @@ c     &           (ioverlap(j),j=1,ioverlap_last)
 C Check for SC-SC overlaps and mark residues
 c      print *,'>>overlap_sc nnt=',nnt,' nct=',nct
       ind=0
-      do i=iatsc_s,iatsc_e
-        itypi=abs(itype(i))
-        itypi1=abs(itype(i+1))
+c      do i=iatsc_s,iatsc_e
+      do i=nnt,nct-1
+        itypi=itype(i)
+        itypi1=itype(i+1)
         xi=c(1,nres+i)
         yi=c(2,nres+i)
         zi=c(3,nres+i)
@@ -849,10 +850,11 @@ c      print *,'>>overlap_sc nnt=',nnt,' nct=',nct
         dzi=dc_norm(3,nres+i)
         dsci_inv=dsc_inv(itypi)
 c
-       do iint=1,nint_gr(i)
-         do j=istart(i,iint),iend(i,iint)
+c       do iint=1,nint_gr(i)
+c         do j=istart(i,iint),iend(i,iint)
+          do j=i+2,nct
             ind=ind+1
-            itypj=abs(itype(j))
+            itypj=itype(j)
             dscj_inv=dsc_inv(itypj)
             sig0ij=sigma(itypi,itypj)
             chi1=chi(itypi,itypj)
@@ -904,7 +906,7 @@ cd     &     rcomp,1.0/rij,rij_shift
           enddo 
          endif
         enddo
-       enddo
+c       enddo
       enddo
       return
       end