Scheme for calculating the orbital-dependent exchange-correlation potential using the virial theorem: Application to atomic systems