it seems to work, though it is very unstable

unstable with respect to the initial state. For a nice AF initial state it goes to the correct expected energy. For a random state it doesn't always. Try adding staggered magnetic field.