anchor.diff:     
      ! normalize PhiM
      MU = MATMUL ( MATMUL( TRANSPOSE(PhiM), MLL ), PhiM )
  -   
  +   MU2=0 !Initialize
      DO I = 1, DOFM
  -      MU(I, I) = 1./SQRT( MU(I, I) )  !RRD this is was wrong and I fixed it 6/10/2013
  +      MU2(I, I) = 1./SQRT( MU(I, I) )  !RRD this is was wrong and I fixed it 6/10/2013
         OmegaM(I) = SQRT( OmegaM(I) )
      ENDDO
      
  -   PhiM = MATMUL( PhiM, MU )
  +   PhiM = MATMUL( PhiM, MU2 )  !this is the nondimensionalization 
   
      MBB = MRR + MATMUL(MRL, PhiR) + TRANSPOSE( MATMUL(MRL, PhiR) ) &
                + MATMUL( MATMUL(TRANSPOSE(PhiR), MLL), PhiR )
  
positive.code:    END IF   
     p%D2_42 = 0         
     
        ! Allocate Abar_21
     ALLOCATE( p%Abar_21(DOFL, DOFM), STAT = ErrStat )
     IF ( ErrStat/= ErrID_None ) THEN
        ErrStat = ErrID_Fatal
        ErrMsg  = 'Error allocating parameter matrix p%Abar_21 in SubDyn_Init/Set parameters'
        RETURN
     END IF   
     p%Abar_21 = 0            
     
        ! Allocate Abar_22
     ALLOCATE( p%Abar_22(DOFL, DOFM), STAT = ErrStat )
     IF ( ErrStat/= ErrID_None ) THEN
        ErrStat = ErrID_Fatal
        ErrMsg  = 'Error allocating parameter matrix p%Abar_22 in SubDyn_Init/Set parameters'
        RETURN
     END IF   
     p%Abar_22 = 0               
     
        ! Allocate Bbar_13
     ALLOCATE( p%Bbar_13(DOFI, p%TPdofL), STAT = ErrStat )
     IF ( ErrStat/= ErrID_None ) THEN
        ErrStat = ErrID_Fatal
        ErrMsg  = 'Error allocating parameter matrix p%Bbar_13 in SubDyn_Init/Set parameters'
        RETURN
     END IF   
     p%Bbar_13 = 0               
     
        ! Allocate Bbar_23
     ALLOCATE( p%Bbar_23(DOFL, p%TPdofL), STAT = ErrStat )
     IF ( ErrStat/= ErrID_None ) THEN
        ErrStat = ErrID_Fatal
        ErrMsg  = 'Error allocating parameter matrix p%Bbar_23 in SubDyn_Init/Set parameters'
        RETURN
     END IF   
     p%Bbar_23 = 0               
  
        ! Allocate Bbar_24
     ALLOCATE( p%Bbar_24(DOFL, DOFL), STAT = ErrStat )
     IF ( ErrStat/= ErrID_None ) THEN
        ErrStat = ErrID_Fatal
        ErrMsg  = 'Error allocating parameter matrix p%Bbar_24 in SubDyn_Init/Set parameters'
        RETURN
     END IF   
     p%Bbar_24 = 0
     
        ! Allocate Fbar_21
     ALLOCATE( p%Fbar_21(DOFL), STAT = ErrStat )
  
negative.code: !------------------------------------------------------------------------------------------------------
  !------------------------------------------------------------------------------------------------------
  
  End Module SubDyn
  