Magnetic subperiodic groups and magnetic space groups