anchor.diff:     INTEGER(IntKi)                            :: ErrStat2
      CHARACTER(LEN(ErrMsg))                    :: ErrMsg2
   
  +   CHARACTER(*), PARAMETER                   :: RoutineName = 'SetParameters'
      
      ErrStat = ErrID_None 
      ErrMsg  = ''
  
positive.code:    ! now factor KLL to compute PhiR: KLL*PhiR=-TRANSPOSE(KRL)
     ! ** note this must be done after EigenSolve() because it modifies KLL **
     CALL LAPACK_getrf( p%DOFL, p%DOFL, KLL, ipiv, ErrStat2, ErrMsg2)
        CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'CBMatrix')
        IF ( ErrStat >= AbortErrLev ) RETURN
     
     PhiR = -1.0_ReKi * TRANSPOSE(KRL) !set "b" in Ax=b  (solve KLL * PhiR = - TRANSPOSE( KRL ) for PhiR)
     CALL LAPACK_getrs( TRANS='N',N=p%DOFL,A=KLL,IPIV=ipiv, B=PhiR, ErrStat=ErrStat2, ErrMsg=ErrMsg2)
        CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'CBMatrix')
        IF ( ErrStat >= AbortErrLev ) RETURN
     
     !....................................................
     ! Set MBB, MBM, and KBB from Eq. 4:
     !....................................................
     PhiR_T_MLL = TRANSPOSE(PhiR)
     PhiR_T_MLL = MATMUL(PhiR_T_MLL, MLL)
     MBB = MATMUL(MRL, PhiR)
  
negative.code:       MBM = MATMUL( PhiR_T_MLL, PhiL(:,1:DOFM))  ! last half of operation
        MBM = MATMUL( MRL, PhiL(:,1:DOFM) ) + MBM    !This had PhiM      
     ENDIF
     DEALLOCATE( PhiR_T_MLL )
     
     KBB = MATMUL(KRL, PhiR)   
     KBB = KBB + KRR
  