Magnetotaxis for nanofabrication