anchor.diff:              Omega2(I) = HUGE(1.0_FEKi)
            endif
         endif
  -      if (bCheckSingularity) then
  -         if ( EqualRealNos(real(Omega2(I),ReKi),0.0_ReKi) ) THEN
  -            ErrStat2=ErrID_Fatal
  -            ErrMsg2= 'Zero eigenvalue found, system may be singular (may contain rigid body modes)'
  -         elseif (Omega2(I) < 0.0_FEKi) then
  -            ErrStat2=ErrID_Fatal
  -            ErrMsg2= 'Negative eigenvalue found, system may be singular (may contain rigid body modes)'
  -         endif
  -         if(Failed()) return
  -      endif
      enddo  
      ! Sorting
      CALL ScaLAPACK_LASRT('I',N,Omega2,KEY,ErrStat2,ErrMsg2); if(Failed()) return 
  
positive.code:    ! LOCALS         
     REAL(FEKi), ALLOCATABLE                   :: K_FEKi(:,:), M_FEKi(:,:) 
     REAL(FEKi), ALLOCATABLE                   :: EigVect_FEKi(:,:), Omega2_FEKi(:) 
     REAL(FEKi)                                :: Om2
     INTEGER(IntKi)                            :: N, i
     INTEGER(IntKi)                            :: ErrStat2
     CHARACTER(ErrMsgLen)                      :: ErrMsg2
  
negative.code:       EigVect(:,I)=VL(:,KEY(I))  !just reordered as Huimin had a normalization outside of this one
     ENDDO
     !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
  
     ! --- Return Omega (capped by huge(ReKi)) and check for singularity
     Omega(:) = 0.0_FEKi
     do I=1,N 
        ! Capping Om2 to avoid overflow
        if (abs(Omega2(I))>huge(1.0_ReKi)) then
           Om2 = huge(1.0_ReKi) * sign(1.0_FEKI, Omega2(i)) !< NOTE huge(ReKi)
        else
           Om2 = Omega2(i)
        endif
        if (EqualRealNos(real(Om2,ReKi), 0.0_ReKi)) then  ! NOTE: may be necessary for some corner numerics
           Omega(i)=0.0_FEKi
           if (bCheckSingularity) then
              ErrStat2=ErrID_Fatal
              ErrMsg2= 'Zero eigenvalue found, system may be singular (may contain rigid body modes)'
              if(Failed()) return
           endif
        elseif (Om2>0) then 
           Omega(i)=sqrt(Om2)
        else
           ! Negative eigenfrequency
           print*,'>>> Wrong eigenfrequency, Omega^2=',Om2
           Omega(i)= 0.0_FEKi 
           if (bCheckSingularity) then
              ErrStat2=ErrID_Fatal
              ErrMsg2= 'Negative eigenvalue found, system may be singular (may contain rigid body modes)'
              if(Failed()) return
           endif
        endif
     enddo
  
     CALL CleanupEigen()
     RETURN
  
  