Magnetic field induced improvement of the arrangement of nanomagnets from the gas phase on S layers