A new high field gradient magnet was designed for the deflection of nanoclusters according to their magnetic moment. From the Stern-Gerlach experiment, we know that the force acting on electrically neutral particles with spin is proportional to the magnetic field gradient and to the component of the magnetic moment along the field gradient. Since the magnetic moment of nanoclusters can be several orders of magnitude smaller than those of single atoms, the requirements for the magnet are a strong field , a very large field gradient and a sufficiently large beam acceptance. Since classical particle tracking codes do not include Stern-Gerlach effects but only Lorentz forces, we developed our own tracking code. This code is coupled to 2D and 3D electromagnetic simulation software. Power consumption, thermal aspects, self inductance and eddy current effects, magnetic forces, operation in saturated regime and weight considerations were taken into account.