Grain alignment in the intergalactic magnetic field