Average consensus for nonlinearly coupled agents: Quadratic criteria