Modern high-density magnetic memories such as hard disk drives and magnetoresistive random access memories feature magnetic bits with a size of only a few magnetic grains (see, for example, ref. 1).