-c
-c odl(k,ii)=dist(i,j)
-c write (iout,*) "dist(",i,j,") =",dist(i,j)
-c write (iout,*) "distal = ",distal
-c write (iout,*) "odl(",k,ii,") =",odl(k,ii)
-c write(iout,*) "rescore(",k,i,") =",rescore(k,i),
-c & "rescore(",k,j,") =",rescore(k,j)
-c
-c Calculation of sigma from res sim
-c
-c if (odl(k,ii).le.6.0d0) then
-c sigma_odl(k,ii)=hmscore(k)*rescore(k,i)*rescore(k,j)
-c Other functional forms possible depending on odl(k,ii), eg.
-c
- if (odl(k,ii).le.dist_cut) then
- sigma_odl(k,ii)=rescore(k,i)+rescore(k,j) ! other exprs possible
-c sigma_odl(k,ii)=hmscore(k)*rescore(k,i)*rescore(k,j)
- else
- sigma_odl(k,ii)=(rescore(k,i)+rescore(k,j))* ! sigma ~ rescore ~ error
+ if (read2sigma) then
+ sigma_odl(k,ii)=0
+ do ik=i,j
+ sigma_odl(k,ii)=sigma_odl(k,ii)+rescore2(k,ik)
+ enddo
+ sigma_odl(k,ii)=sigma_odl(k,ii)/(j-i+1)
+ if (odl(k,ii).gt.dist_cut) sigma_odl(k,ii) =
+ & sigma_odl(k,ii)*dexp(0.5d0*(odl(k,ii)/dist_cut)**2-0.5d0)
+ else
+ if (odl(k,ii).le.dist_cut) then
+ sigma_odl(k,ii)=rescore(k,i)+rescore(k,j)
+ else
+#ifdef OLDSIGMA
+ sigma_odl(k,ii)=(rescore(k,i)+rescore(k,j))*