This folder contains all the relevant code used in the paper, including scripts for the structural optimization method, analytical modeling of the magnetic attractive force, and COMSOL simulations for the static magnetic force.