Representing spherical tensors with scalar-based machine-learning models