This subroutine takes as input the model and state objects, the RHSs, and the tolerance for the linear systems and gives in output the energy and, if requested, the forces. An optional argument controls if the guesses for the linear systems should be generated from scratch or read from the state object. This might help in the case of repeated calculations for similar RHSs, as it might be the case during the iterative solution to the self-consistent field problem.