Quantum-mechanical virial sum rules for a molecule in electric and magnetic fields