153 def P(e, en, t): 154 """Calculating probability of making a transition to state with energy en when in state with energy e and when current temperature is t""" 155 if en < e: 156 return 1.0 157 else: 158 log("----P----",DEBUG) 159 prob = math.exp((float(e)-float(en))/t) 160 if(prob < 0.5): 161 probability_test['below_0.5']+=1 162 else: 163 probability_test['above_0.5']+=1 164 log("---------",DEBUG) 165 return prob bliver til: 153 def P(e, en, t): 154 """Calculating probability of making a transition to state with energy en when in state with energy e and when current temperature is t""" 155 if en < e: 156 return 1.0 157 else: 158 log("----P----",DEBUG) 159 prob = math.exp((float(e)-float(en))/t) 164 log("---------",DEBUG) 165 return prob