Development of a size-consistent energy functional for open shell states