def update(self, game, my_choice, opponent_choice): # fill history of opponents' behavior with 0 for cooperation and 1 for defection if opponent_choice == 'C': self.history_opponents_move.append(0) opponent_coop = 1.0 else: self.history_opponents_move.append(1) opponent_coop = 0.0 # compute frequencies of opponents cooperation and defection according to history frequency_opponents_def = sum(self.history_opponents_move) * 1.0 / len( self.history_opponents_move) frequency_opponents_coop = 1.0 - frequency_opponents_def # compute surprise values for cooperation and defection in the last round surprise_coop = (frequency_opponents_coop - opponent_coop)**2 surprise_def = (frequency_opponents_def - (1.0 - opponent_coop))**2 # compute predictability as how unsurprising the opponent's choice has been self.predictability = 1.0 - (0.5 * (surprise_coop + surprise_def)) # compute current payoffs and payoffs if cooperated or defected current_payoff = game.payoffs[0 if my_choice == 'C' else 1][ 0 if opponent_choice == 'C' else 1] payoff_coop = game.payoffs[0][0 if opponent_choice == 'C' else 1] payoff_def = game.payoffs[1][0 if opponent_choice == 'C' else 1] # compute regret values if current_payoff < payoff_coop: self.regret_coop = 0.5 else: self.regret_coop = 0.0 if current_payoff < payoff_def: self.regret_def = 0.5 else: self.regret_def = 0.0 # compute updated experience value new_experience = self.experience * self.predictability + 1.0 # compute regret factors for cooperation and defection regret_factor_coop = payoff_coop * ( self.regret_coop + (1.0 - self.regret_coop) * MyMath.ident(my_choice, 'C')) regret_factor_def = payoff_def * ( self.regret_def + (1.0 - self.regret_def) * MyMath.ident(my_choice, 'D')) # update attraction values self.attraction_coop = ( self.predictability * self.experience * self.attraction_coop + regret_factor_coop) / new_experience self.attraction_def = ( self.predictability * self.experience * self.attraction_def + regret_factor_def) / new_experience # update experience value self.experience = new_experience
def merge(self, h): if ( self.min_each_dim[0] < h.min_each_dim[0] and self.max_each_dim[0] < h.max_each_dim[0] and (self.dim == 1 or self.dim == 2) ): one = np.append( np.reshape(self.bins[:, 1], (self.num_bins, 1)), np.reshape(self.bins[:, 2 * self.dim + 2], (self.num_bins, 1)), axis=1, ) two = np.append( np.reshape(h.bins[:, 1], (h.num_bins, 1)), np.reshape(h.bins[:, 2 * h.dim + 2], (h.num_bins, 1)), axis=1 ) else: stderr.write("\n*** Error: range of histogram is invalid! Merge operation is illegal!\n\n") exit(1) deriv_one = MyMath.derivatives(one) deriv_two = MyMath.derivatives(two) start_index = -1 for i in xrange(0, self.num_bins - 4): if np.allclose(deriv_one[i, 0], deriv_two[0, 0]): start_index = i break end_index = -1 for i in xrange(0, h.num_bins - 4): if np.allclose(deriv_one[self.num_bins - 5, 0], deriv_two[i, 0]): end_index = i break if start_index == -1 or end_index == -1: stderr.write("\n*** Error: histograms are not compatible! Merge Operation is illegal!\n\n") exit(1) deriv_one = deriv_one[start_index:, :] deriv_two = deriv_two[: end_index + 1, :] diff = np.abs(deriv_one[:, 2] - deriv_two[:, 2]) min_pos = np.argmin(diff) min_pos_in_one = min_pos + 2 + start_index min_pos_in_two = min_pos + 2 temp = np.copy(h.bins) if self.dim == 1: offset = self.bins[min_pos_in_one, 4] temp += (0, 0, 0, 0, offset - temp[min_pos_in_two, 4]) elif self.dim == 2: offset = self.bins[min_pos_in_one, 6] temp += (0, 0, 0, 0, 0, 0, offset - temp[min_pos_in_two, 6]) self.bins = np.append(self.bins[:min_pos_in_one, :], temp[min_pos_in_two:, :], axis=0) self.num_bins = self.bins.shape[0] self.num_bins_each_dim[0] = self.bins.shape[0] self.max_each_dim = np.copy(h.max_each_dim) for i in range(0, self.bins.shape[0]): self.bins[i, 0] = i
def fast_grad(func): flag1 = 1 w = [1, 1] while flag1: fastest_grad = mm.gradient(F, w) #первоначальное направление lambda_ = mm.bin_search(min_lambda, 0, 2, w, fastest_grad) if (mm.vec_norm(fastest_grad) < eps): return w w = mm.vec_sum(w, mm.vec_mul((-1) * lambda_, fastest_grad))
def update(self, game, my_choice, opponent_choice): # update the memory of the last two opponents' choices self.before_last_opponent_choice = self.last_opponent_choice self.last_opponent_choice = opponent_choice # update weights as soon as two rounds were played if self.before_last_opponent_choice != -1: # compute learning rate learning_rate = min(self.prob_coop, 1.0 - self.prob_coop) # update according to opponents' behavior if self.last_opponent_choice == 'C' and self.before_last_opponent_choice == 'D': self.harmony += learning_rate #self.greed -= (learning_rate * 0.5) #self.fear -= (learning_rate * 0.5) elif self.last_opponent_choice == 'C' and self.before_last_opponent_choice == 'C': #self.harmony -= (learning_rate * 0.5) self.greed += learning_rate #self.fear -= (learning_rate * 0.5) elif self.last_opponent_choice == 'D' and self.before_last_opponent_choice == 'D': #self.harmony -= (learning_rate * 0.5) #self.greed -= (learning_rate * 0.5) self.fear += learning_rate # normalize so that all values are >= 0, <= 1 and the sum is 1 normalized_values = MyMath.normalize_triple( [self.harmony, self.greed, self.fear]) self.harmony = normalized_values[0] self.greed = normalized_values[1] self.fear = normalized_values[2]
def choice(self, game): # get the game features EFF, TEMP and RISK a = game.payoffs[0][0] b = game.payoffs[0][1] c = game.payoffs[1][0] d = game.payoffs[1][1] EFF = (a - d) * 1.0 / a TEMP = abs(a - c) * 1.0 / max(a, c) RISK = (d - b) * 1.0 / d # compute the dispositions as product of game features and weights disp_EFF = EFF * self.harmony disp_TEMP = TEMP * self.greed disp_RISK = RISK * self.fear # compute cooperation probability due to dispositions and game type if game.type == "SH": self.prob_coop = (disp_EFF + disp_TEMP) / (disp_EFF + disp_TEMP + disp_RISK) elif game.type == "PD": self.prob_coop = (disp_EFF) / (disp_EFF + disp_TEMP + disp_RISK) # make a probabilistic choice if MyMath.prob_choice(self.prob_coop): choice = 'C' else: choice = 'D' return choice
def choice(self, game): if self.choices_opponents[0] > 0 and self.choices_opponents[1] > 0: self.belief_coop = self.choices_opponents[0] * 1.0 / sum( self.choices_opponents) #print believe_coop, exp_util_C = game.payoffs[0][0] * self.belief_coop + game.payoffs[ 0][1] * (1.0 - self.belief_coop) exp_util_D = game.payoffs[1][0] * self.belief_coop + game.payoffs[ 1][1] * (1.0 - self.belief_coop) if exp_util_C > exp_util_D: self.prob_coop = 1.0 elif exp_util_C < exp_util_D: self.prob_coop = 0.0 else: self.prob_coop = 0.5 if MyMath.prob_choice(self.prob_coop): choice = 'C' else: choice = 'D' return choice
def interact(self, opponent, game): # check the distance between agents distance = MyMath.euc_distance(self.trait_coordinates, opponent.trait_coordinates) # play in-group of out-group strategy dependent on tolerance if distance <= self.tolerance: self.current_choice = self.strategy[0] if opponent.type == 0: self.ingroup_members0 += 1 else: self.ingroup_members1 += 1 else: self.current_choice = self.strategy[1] if distance <= opponent.tolerance: opponent.current_choice = opponent.strategy[0] else: opponent.current_choice = opponent.strategy[1] # compute current utility self.current_utility = max( game.utility[self.current_choice][opponent.current_choice], self.dap) # update accumulated reward values self.accumulated_utility += self.current_utility
def getE(phi): e = 65537 while True: if MyMath.GCD(e,phi) == 1: break e+= 2 return e
def calculate(x): difference = MyMath.subtraction(MyMath.maximum(x), MyMath.minimum(x)) addition = MyMath.add(MyMath.maximum(x), MyMath.minimum(x)) summation = MyMath.sumTotal(x) numEven = MyMath.evenNum(x) finalList = checkClear(x) return ( "The difference is:%d The summation is:%d The summation of all input is:%d The number of even numbers is:%d The values in the list are: %s" % (difference, addition, summation, numEven, finalList))
def choice(self, game): if MyMath.prob_choice(self.prob_coop): choice = 'C' else: choice = 'D' return choice
def doCycle(self): e = MyMath.exponent(1, 100) n = [] E = 0 for x in self.neurons: E += e**x.value for x in self.neurons: x.value = (e**x.value) / E x.pushValue()
def decrypt(self, cipher, n, e): c = int(cipher, 16) if n < 1e10: p, q = self.normal_factorising(self, n) elif n < 1e28: p, q = self.Pollard_factorising(self, n) else: print("N too big") exit(0) phi = (p - 1) * (q - 1) d, tmp = self.Euclide_Extend(self, e, phi) if d < 0: d += phi m = MyMath.powmod(c, d, n) plain = MyMath.long_to_bytes(m) return plain
def Q(a, p, m, s): x = MyMath.powMod(a, m, p) if x == 1: return True for i in range(0, s + 1): if x == p - 1: return True x *= x x %= p return False
def merge_files(): path = argv[2] fmt = argv[3] wins = [int(argv[4]), int(argv[5])] lipids = int(argv[6]) num_resamples = int(argv[7]) hs_files = [] for i in range(0, wins[0]): hs_files.append([]) for j in range(0, wins[1]): filename = fmt % ((i + j * wins[0]), lipids) filename = os.path.join(path, filename) if os.path.exists(filename): hs_files[i].append(filename) result = None for r in range(0, num_resamples): h = HistogramND(2) fs = resample(hs_files) h.read(fs[0]) for i in range(1, len(fs)): th = HistogramND(2) th.read(fs[i]) h.merge(th) h = h.norm_dos() if result == None: result = np.copy( np.append(np.reshape(h[:, 0], (h.shape[0], 1)), np.reshape(h[:, 2], (h.shape[0], 1)), axis=1) ) else: result = np.append(result, np.reshape(h[:, 2], (result.shape[0], 1)), axis=1) opath = "." final = np.reshape(result[:, 0], (result.shape[0], 1)) final = np.append(final, np.reshape(np.mean(result[:, 1:], axis=1), (result.shape[0], 1)), axis=1) final = np.append(final, np.reshape(np.std(result[:, 1:], axis=1), (result.shape[0], 1)), axis=1) np.savetxt(os.path.join(opath, "Lipid%d.dos_deriv.dat" % lipids), MyMath.derivatives(final[:, 0:2])) array_lipid = np.ones((final.shape[0], 1)) * lipids final = np.append(final, np.reshape(array_lipid, ((final.shape[0], 1))), axis=1) np.savetxt(os.path.join(opath, "Lipid%d.ave_dos.dat" % lipids), final, fmt="%.2f %.2f %.2f %d") dT = 0.01 kb = 1 num_files = 1 num_points = 1000 num_atoms = 1000 result = result[67:,] thermo_result = DOS.thermo(result, dT, num_points, 1000) np.savetxt(os.path.join(opath, "Lipid%d.thermo_dos.dat" % lipids), thermo_result)
def choice(self, game): # initialize attractions value due to the first game: if self.attraction_coop == -1 or self.attraction_def == -1: initial_attraction_values = MyMath.cognitive_hierarchy( game.payoffs, 1.5) self.attraction_coop = initial_attraction_values[0] self.attraction_def = initial_attraction_values[1] # compute cooperation probability due to attraction values self.prob_coop = self.attraction_coop / (self.attraction_coop + self.attraction_def) # make a probabilistic choice if MyMath.prob_choice(self.prob_coop): choice = 'C' else: choice = 'D' return choice
def encode(n, e, P, file): fo = open(file, "w") C = "" R = convertStringToInt(P, 4) A = createBigInt(R, len(str(n))) for i in A: M = MyMath.powMod(i, e, n) M = MyBase.toBase(M, 64) C += M + ' ' fo.write(M + ' ') fo.close() return C
def isMatched(self, robot, ball): max_e_dist = 40 their_defender = self.world.their_defender (target_x, target_y) = self.goalCentre() ball_y = self.world.ball.y ball_x = self.world.ball.x zone = self.world.pitch.zones[self.robot.zone] zone = self.world.pitch.zones[self.robot.zone] between = (ball_x - target_x) * (ball_x - self.midX) < 0.0 if between or ball_x < 1.0: def_ang = their_defender._vector.angle def_pos = their_defender._vector p1 = array( [self.midX, 0.0] ) p2 = array( [self.midX, self.max_y] ) ad = array([math.cos(def_ang), math.sin(def_ang)]) p3 = array( [def_pos.x, def_pos.y] ) p4 = array( p3 + ad) si = MyMath.seg_intersect( p1,p2, p3,p4) #log_dot(si, 'yellow', 'haha') #log('inter', si, 'MatchY') g_to_mid = self.midX - target_x y = si[1] y = clip(y, max_e_dist, self.max_y - max_e_dist) consol.log('facing', g_to_mid * ad[0] > 0.0, 'MatchY') if g_to_mid * ad[0] > 0.0: return math.fabs(robot.y - y) < ERROR else: return math.fabs(robot.y - self.midY) < ERROR else: y = clip(ball.y, max_e_dist, self.max_y - max_e_dist) return math.fabs(robot.y - y) < ERROR
def nextCommand(self): their_defender = self.world.their_defender (target_x, target_y) = self.goalCentre() ball_y = self.world.ball.y ball_x = self.world.ball.x zone = self.world.pitch.zones[self.robot.zone] zone = self.world.pitch.zones[self.robot.zone] max_e_dist = 40 between = (ball_x - target_x) * (ball_x - self.midX) < 0.0 if between or ball_x < 1.0: def_ang = their_defender._vector.angle def_pos = their_defender._vector p1 = array( [self.midX, 0.0] ) p2 = array( [self.midX, self.max_y] ) ad = array([math.cos(def_ang), math.sin(def_ang)]) p3 = array( [def_pos.x, def_pos.y] ) p4 = array( p3 + ad) si = MyMath.seg_intersect( p1,p2, p3,p4) #log_dot(si, 'yellow', 'haha') #log('inter', si, 'MatchY') g_to_mid = self.midX - target_x y = si[1] y = clip(y, max_e_dist, self.max_y - max_e_dist) consol.log('facing', g_to_mid * ad[0] > 0.0, 'MatchY') if g_to_mid * ad[0] > 0.0: command = self.go_to_asym(zone.center()[0], y, max_speed=100, min_speed=50) else: command = self.go_to_asym(self.midX, self.midY, max_speed=100, min_speed=50) else: y = clip(ball_y, max_e_dist, self.max_y - max_e_dist) command = self.go_to_asym(zone.center()[0], ball_y, max_speed=100, min_speed=50) return command
def decode(n, d, C, base, fileOut): # file PlanintextDecode fo = open(fileOut, "w") P = "" for i in C: m = MyMath.powMod(MyBase.toInt(i, 64), d, n) c = str(m) while len(c) % base != 0: c = '0' + c x = 0 while x != len(c): a = c[x:x + base] x += base P += chr(int(a)) fo.write(chr(int(a))) fo.close() return P
def main(): numberslist = checker() biggestnumber = MyMath.maximum(numberslist) smallestnumber = MyMath.minimum(numberslist) difference = MyMath.subtraction(biggestnumber, smallestnumber) bigsmallsum = MyMath.add(biggestnumber, smallestnumber) listsum = MyMath.sumTotal(numberslist) evencount = len(MyMath.evenNum(numberslist)) if smallestnumber < 5: numberslist = MyMath.clear(numberslist) output = "The difference is:%d The summation is:%d The summation of all input is:%d The number of even numbers is:%d The values in the list are: %s" \ %(difference, bigsmallsum, listsum, evencount, str(numberslist)) print(output)
def check_col(verts,curbox,exbox): # 檢查放置的箱子是否和已放置的箱子有干涉 # print('*** check_col') flag=False # 若干涉返回 True if len(exbox) > 0: #檢查所有已放置的箱子 for i in range(0,len(exbox)): # exbox[i].set_box_dir() # exbox[i].set_verts() #依方向計算八點頂座標 # flag=edge_plane_int(verts, exbox[i].verts) #邊線與對手平面是否有兩個交點 # if flag: # # print('edge_plane intersection') # return flag #有干涉 # flag=jm.face_face_int(curbox.verts, exbox[i].verts) #兩表面是否相交 # if flag: # return flag #有干涉 # flag=jm.face_face_int(exbox[i].verts, curbox.verts) #兩表面是否相交 # if flag: # return flag #有干涉 flag=jm.coboid_coboid_int(exbox[i].verts, curbox.verts) #兩方體是否相交 if flag: return flag #有干涉 # flag=jm.coboid_coboid_int(curbox.verts,exbox[i].verts ) #兩方體是否相交 # if flag: # return flag #有干涉 # for p in verts: # 檢查欲放置箱子的所有檢查點 # flag=jm.point_in_box(p,exbox[i].verts) # # print(exbox[i]) # if flag: # return flag # if flag==False: # tmp_verts=[] # tmp_verts.extend(exbox[i].verts) #加入對手件頂點 # tmp_verts.extend(edge_midPt(exbox[i].verts)) #加入對手件邊線中點 # tmp_verts.extend(face_midPt(exbox[i].verts)) #加入對手件表面中點 # tmp_verts.extend(solid_midPt(exbox[i].verts))#加入對手件體積中點 # for p in tmp_verts : # 檢查對手的頂點 # flag=jm.point_in_box(p,curbox.verts) # # print('exbox verts has inside curbox') # if flag: # return flag else : flag=False #無干涉 return flag
def __init__(self, learningBonesList, referenceBonesList, option): self.option = option self.perfEval = perf.PerformanceEvaluator() self.util = utils.Utility() self.computeUtil = utils.ComputingUtility() self.math1 = math1.SimpleMath() self.vertUtil = utils.VertexUtility() self.helperBonesList = learningBonesList self.helperBoneThetaMatList = [] # to start simple, self.referenceBonesList = referenceBonesList # Learner's learning parameters self.motionLearnerParms = config.MotionLearnerParms() self.finalError = 0 self.finalIteration = 0
def choice(self, game): if game.type == 'PD': self.prob_coop = 0.0 elif game.type == 'SH': a = game.payoffs[0][0] b = game.payoffs[0][1] c = game.payoffs[1][0] d = game.payoffs[1][1] self.prob_coop = (d - b) * 1.0 / (a - b - c + d) if MyMath.prob_choice(self.prob_coop): choice = 'C' else: choice = 'D' return choice
import MyMath import sys if len(sys.argv) < 2: print("MyMathLauncher : program's argument not specified") elif len(sys.argv) > 2: print("MyMathLauncher : too many program's arguments") else: st = open(sys.argv[1],"r").read() MyMath.Exec(st)
#!/usr/bin/python import MyMath i = 3 total = 0 primes = MyMath.erat_sieve(2000000) for x in primes: total += x print total
import MyMath MyMath.multiplicar(3, 10) MyMath.mediaAritmetica(0, 10)
def checkClear(x): if MyMath.minimum(x) < 5: x = MyMath.clear(x) return (x)
import MyMath print("10+10=", MyMath.add(10, 10), sep="") print("10-10=", MyMath.sub(10, 10), sep="") print("10*10=", MyMath.mul(10, 10), sep="") print("10/10=", MyMath.div(10, 10), sep="") print("10**10=", MyMath.power(10, 10), sep="")
import MyMath as mm import numpy as np x = [0, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2] y = [1, 0.989616, 0.958851, 0.908852 , 0.841471, 0.759188 , 0.664997, 0.562278 , 0.454649] print(mm.int_trapeze(x, y)) print(mm.int_simpson(x, y)) print(mm.int_rich(x, y))
import MyMath v = MyMath.vols(4) print (v)
#!/usr/bin/python import MyMath i=3 total = 0 primes = MyMath.erat_sieve(2000000); for x in primes : total += x print total
if self.a <= 20: x = self.a self.a += 1 return x else: raise StopIteration """ if __name__ == '__main__': A_Coefficient = 0 B_Coefficient = 0 C_Coefficient = 0 Discriminant = 0 roots = [] Points = [] myMath_obj = MyMath.MyMath_Class() """" myclass = MyNumbers() myiter = iter(myclass) for x in myiter: print(x) """ while True: ToolsScreen.ToolsScreen_Class.Make_Empty_Lines(1) A_Coefficient = MyInput_Class.InputFloat("Indtast a koefficient : ") B_Coefficient = MyInput_Class.InputFloat("Indtast b koefficient : ") C_Coefficient = MyInput_Class.InputFloat("Indtast c koefficient : ")
# Python 2.7.X # Try_006.py # Modules # Objective: Create a new module and import it # to this script # Requirement 1: Create a new script called # MyMath.py, then add 5 functions we created from # Works_Try_004 and 005. # Requirement 2: Using imported module, perform # 5 functions with given variables a = 2 b = 8 # Writer your code here import MyMath print "A + B:", MyMath.add(a, b) print "A - B:", MyMath.sub(a, b) print "A * B:", MyMath.mul(a, b) print "A / B:", MyMath.div(a, b) print "A ^ B:", MyMath.exp(a, b)
#cipher text = ...... import MyMath def Euclide_Extend( a, b): if a == 1: return 1, 0 x_, y_ = Euclide_Extend( b, a % b) x = y_ y = x_ - (a // b) * y_ return x, y m = 0 e1 = 2788276781 e2 = 2750610521 c1 = 41722827324219154502412894777929708295817269862821442985517165993161893049531 c2 = 44554975419623697543042888877641384509200031600063096793963144597106437406168 n = 52593746111299673917462180378616675287554472293960928632820865884284203124461 #256bit (77 digit) x, y = Euclide_Extend(e1, e2) if x < 0: tmp, c1_ = Euclide_Extend(n, c1) m = (MyMath.powmod(c1_, -x, n) * MyMath.powmod(c2, y, n)) % n else: tmp, c2_ = Euclide_Extend(n, c2) m = (MyMath.powmod(c1, x, n) * MyMath.powmod(c2_, -y, n)) % n print(MyMath.long_to_bytes(m))
import MyMath print(" ----- MyMathShell v1.0 by Andrea Fioraldi -----\n") while True: s = input("MyMathShell:> ") try: rt = MyMath.ExecLine(s) if rt != None: print(rt) except Exception as Err: print("Error :", Err)
def merge_files(): path = argv[2] fmt = argv[3] wins = [int(argv[4]), int(argv[5])] lipids = int(argv[6]) num_resamples = int(argv[7]) hs_files = [] for i in range(0, wins[0]): hs_files.append([]) for j in range(0, wins[1]): filename = fmt % ((i + j * wins[0]), lipids) filename = os.path.join(path, filename) if os.path.exists(filename): hs_files[i].append(filename) result = None for r in range(0, num_resamples): h = HistogramND(2) fs = resample(hs_files) h.read(fs[0]) for i in range(1, len(fs)): th = HistogramND(2) th.read(fs[i]) h.merge(th) h = h.norm_dos() if result == None: result = np.copy( np.append(np.reshape(h[:, 0], (h.shape[0], 1)), np.reshape(h[:, 2], (h.shape[0], 1)), axis=1)) else: result = np.append(result, np.reshape(h[:, 2], (result.shape[0], 1)), axis=1) opath = "." final = np.reshape(result[:, 0], (result.shape[0], 1)) final = np.append(final, np.reshape(np.mean(result[:, 1:], axis=1), (result.shape[0], 1)), axis=1) final = np.append(final, np.reshape(np.std(result[:, 1:], axis=1), (result.shape[0], 1)), axis=1) np.savetxt(os.path.join(opath, "Lipid%d.dos_deriv.dat" % lipids), MyMath.derivatives(final[:, 0:2])) array_lipid = np.ones((final.shape[0], 1)) * lipids final = np.append(final, np.reshape(array_lipid, ((final.shape[0], 1))), axis=1) np.savetxt(os.path.join(opath, "Lipid%d.ave_dos.dat" % lipids), final, fmt="%.2f %.2f %.2f %d") dT = 0.01 kb = 1 num_files = 1 num_points = 1000 num_atoms = 1000 thermo_result = DOS.thermo(result, dT, num_points, 1000) np.savetxt(os.path.join(opath, "Lipid%d.thermo_dos.dat" % lipids), thermo_result)