added the correct energy calculation of ising model without the function call