Collective-variable tempering method