anchor.diff:           mark(i)=1
         enddo
         
  -      if (read_score) then
  -          call read_score_matrix(nst,n_str,Lch,amat,rmsd_delta,
  -     &     rmsd_a)
  +cjmht Calculate the amat with the all-by-all scores
  +      if (score_type .eq. 1) then
  +          call read_score_matrix(nst,n_str,amat,rmsd_delta, rmsd_a)
  +      elseif (score_type .eq. 2) then
  +          call tm_score_all(ndim,nst,n_str,Lch,x,y,z,amat,rmsd_delta,
  +     &                      rmsd_a)
         else
  -          call rmsd_score(ndim,nst,w,n_str,Lch,x,y,z,amat,rmsd_delta,
  -     &     rmsd_a)
  +          call rmsd_score_all(ndim,nst,w,n_str,Lch,x,y,z,amat,
  +     &                        rmsd_delta,rmsd_a)
         endif
  +
  +cjmht write out the score matrix
  +      open(30,file='spicker.matrix',status='unknown') !scores
  +      do i=1,n_str
  +         do j=i,n_str
  +         write(30,2000)i-1,j-1,amat(i,j)
  +         enddo
  +      enddo
  +      close(30)
  +2000  format(i4,2x,i4,2x,f9.4)
   
   ******** reset RMSD_cutoff parameters:
         if(n_para.eq.-1)then      !parameters for ab inito modeling
  
positive.code:       dimension x1(ndim),y1(ndim),z1(ndim),nn1(ndim)
        dimension x2(ndim),y2(ndim),z2(ndim),nn2(ndim)
  
        logical read_score
        read_score = .FALSE.
  
  **********************************************************************
  ****  check if we are reading a score matrix or processing rmsds
  **********************************************************************
        inquire(file='score.matrix',exist=read_score)
        if (read_score) then
            write(*,*)"Scores will be read from file: score.matrix"
        else
            write(*,*)"Calculating RMSD scores"
        endif
  
  
negative.code:       real rmsd_delta
        double precision rmsd_a
  !     local variables
        real scored,RMSD_min,RMSD_max
        parameter(RMSD_min=0)
        parameter(RMSD_max=50.0)
        real armsd,rmsd2_a
        integer i,j,k,n_rmsd
  
        rmsd_a=0
        rmsd2_a=0
        n_rmsd=0
  