port of python ising model to c