Small modification in Metropolis algorithm acceptance probability calculation: Do first the product of energy and temperature (this should return a double or something convertible to double) and then do the negation. Without parantheses this would rely on the temperature type to have an operator -