anchor.diff:        dimension x1(ndim),y1(ndim),z1(ndim),nn1(ndim)
         dimension x2(ndim),y2(ndim),z2(ndim),nn2(ndim)
   
  -      logical read_score
  -      read_score = .FALSE.
  +cjmht
  +      integer score_type
  +      logical fcheck
  +      score_type=0
  +      fcheck = .FALSE.
   
   **********************************************************************
   ****  check if we are reading a score matrix or processing rmsds
   **********************************************************************
  -      inquire(file='score.matrix',exist=read_score)
  -      if (read_score) then
  +      inquire(file='score.matrix',exist=fcheck)
  +      if (fcheck) then
             write(*,*)"Scores will be read from file: score.matrix"
  -      else
  +          score_type=1
  +      endif
  +      inquire(file='TM.score',exist=fcheck)
  +      if (fcheck) then
  +          write(*,*)"TM scores will be used"
  +          if (score_type .ne. 0) then
  +              write(*,*)'Cannot use score.matrix and TM.score!'
  +              STOP 1
  +          endif
  +          score_type=2
  +      endif
  +      if (score_type .eq. 0) then
             write(*,*)"Calculating RMSD scores"
         endif
   
  
positive.code:       return
        end
  
        subroutine read_score_matrix(nst,n_str,Lch,amat,rmsd_delta,
       & rmsd_a)
  *     This routine reads in a matrix of score in a scale 0-1 and
  *     uses the reciprocal to convert them into an rmsd-like score
  
negative.code: c       -2: no result obtained because of negative weights w
  c           or all weights equal to zero.
  cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
        subroutine rmsd_score_all(ndim,nst,w,n_str,Lch,x,y,z,amat,
       & rmsd_delta,rmsd_a)
  !     REM: I, J, K, L, M, or N are int
        implicit none
  !     Intent In
  