force-directed optimisation of a 3D-periodic graph