def testRead(self): field = Field() field.read("./Parameters/hsg1_rigid.maps.fld") em = ElectrostaticMap() em.read("./Maps/hsg1_rigid.C.map", field) # 1 exp = [ 1.092, 0.806, 0.553, 0.263, 0.190, 0.598, 2.408, 8.181, 23.834, 54.212 ] for i in xrange(10): self.assertEquals(em.map[0][0][i], exp[i]) # 316 exp = [ 2165.672, 16349.299, 70409.602, 78148.484, 21661.604, 2812.866, 387.952, 75.797, 21.270, 10.186 ] for i in xrange(10): self.assertEquals(em.map[0][5][10 + i], exp[i]) # 183110 exp = [ 425.622, 1197.815, 4611.195, 22100.568, 57932.355, 44180.094, 108190.430, 102640.172, 116771.336, 199047.891 ] for i in xrange(10): self.assertEquals(em.map[49][12][48 + i], exp[i]) # 226972 exp = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] for i in xrange(10): self.assertEquals(em.map[60][60][51 + i], exp[i])
def testRead(self): field = Field() field.read("./Parameters/hsg1_rigid.maps.fld") em = ElectrostaticMap() em.read("./Maps/hsg1_rigid.d.map", field) # 1 exp = [ 0.704, 0.701, 0.693, 0.691, 0.685, 0.689, 0.689, 0.689, 0.694, 0.690 ] for i in xrange(10): self.assertEquals(em.map[0][0][i], exp[i]) # 316 exp = [ 0.766, 0.764, 0.751, 0.753, 0.741, 0.731, 0.730, 0.728, 0.722, 0.721 ] for i in xrange(10): self.assertEquals(em.map[0][5][10 + i], exp[i]) # 183110 exp = [ 1.218, 1.232, 1.238, 1.259, 1.259, 1.255, 1.242, 1.240, 1.244, 1.243 ] for i in xrange(10): self.assertEquals(em.map[49][12][48 + i], exp[i]) # 226972 exp = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] for i in xrange(10): self.assertEquals(em.map[60][60][51 + i], exp[i])
def testRead(self): field = Field() field.read("./Parameters/hsg1_rigid.maps.fld") self.assertEquals(field.spacing, 0.375) self.assertEquals(str(field.num_points), str(Axis3(60, 60, 60))) self.assertEquals(str(field.num_points1), str(Axis3(61, 61, 61))) self.assertEquals(str(field.center), str(Axis3(2.500, 6.500, -7.500))) self.assertEquals(str(field.lo), str(Axis3(-8.750, -4.750, -18.750))) self.assertEquals(str(field.hi), str(Axis3(13.750, 17.750, 3.750)))
def testRead(self): field = Field() field.read("./Parameters/hsg1_rigid.maps.fld") em = ElectrostaticMap() em.read("./Maps/hsg1_rigid.e.map", field) # 1 exp = [ -0.486, -0.436, -0.410, -0.408, -0.426, -0.459, -0.499, -0.555, -0.620, -0.680 ] for i in xrange(10): self.assertEquals(em.map[0][0][i], exp[i]) # 316 exp = [ -0.368, -0.175, 0.001, 0.053, -0.019, -0.117, -0.187, -0.249, -0.312, -0.395 ] for i in xrange(10): self.assertEquals(em.map[0][5][10 + i], exp[i]) # 183110 exp = [ -0.622, -0.730, -0.411, 0.367, 1.223, 1.625, 1.909, 2.677, 2.379, -0.580 ] for i in xrange(10): self.assertEquals(em.map[49][12][48 + i], exp[i]) # 226972 exp = [ -0.005, -0.006, -0.007, -0.007, -0.007, -0.008, -0.008, -0.007, -0.007, -0.007 ] for i in xrange(10): self.assertEquals(em.map[60][60][51 + i], exp[i])
def testRead(self): field = Field() field.read("./Parameters/hsg1_rigid.maps.fld") em = ElectrostaticMap() em.read("./Maps/hsg1_rigid.d.map", field) # 1 exp = [0.704, 0.701, 0.693, 0.691, 0.685, 0.689, 0.689, 0.689, 0.694, 0.690] for i in xrange(10): self.assertEquals(em.map[0][0][i], exp[i]) # 316 exp = [0.766, 0.764, 0.751, 0.753, 0.741, 0.731, 0.730, 0.728, 0.722, 0.721] for i in xrange(10): self.assertEquals(em.map[0][5][10 + i], exp[i]) # 183110 exp = [1.218, 1.232, 1.238, 1.259, 1.259, 1.255, 1.242, 1.240, 1.244, 1.243] for i in xrange(10): self.assertEquals(em.map[49][12][48 + i], exp[i]) # 226972 exp = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] for i in xrange(10): self.assertEquals(em.map[60][60][51 + i], exp[i])
def testRead(self): field = Field() field.read("./Parameters/hsg1_rigid.maps.fld") em = ElectrostaticMap() em.read("./Maps/hsg1_rigid.C.map", field) # 1 exp = [1.092, 0.806, 0.553, 0.263, 0.190, 0.598, 2.408, 8.181, 23.834, 54.212] for i in xrange(10): self.assertEquals(em.map[0][0][i], exp[i]) # 316 exp = [2165.672, 16349.299, 70409.602, 78148.484, 21661.604, 2812.866, 387.952, 75.797, 21.270, 10.186] for i in xrange(10): self.assertEquals(em.map[0][5][10 + i], exp[i]) # 183110 exp = [425.622, 1197.815, 4611.195, 22100.568, 57932.355, 44180.094, 108190.430, 102640.172, 116771.336, 199047.891] for i in xrange(10): self.assertEquals(em.map[49][12][48 + i], exp[i]) # 226972 exp = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] for i in xrange(10): self.assertEquals(em.map[60][60][51 + i], exp[i])
def testRead(self): field = Field() field.read("./Parameters/hsg1_rigid.maps.fld") em = ElectrostaticMap() em.read("./Maps/hsg1_rigid.e.map", field) # 1 exp = [-0.486, -0.436, -0.410, -0.408, -0.426, -0.459, -0.499, -0.555, -0.620, -0.680] for i in xrange(10): self.assertEquals(em.map[0][0][i], exp[i]) # 316 exp = [-0.368, -0.175, 0.001, 0.053, -0.019, -0.117, -0.187, -0.249, -0.312, -0.395] for i in xrange(10): self.assertEquals(em.map[0][5][10 + i], exp[i]) # 183110 exp = [-0.622, -0.730, -0.411, 0.367, 1.223, 1.625, 1.909, 2.677, 2.379, -0.580] for i in xrange(10): self.assertEquals(em.map[49][12][48 + i], exp[i]) # 226972 exp = [-0.005, -0.006, -0.007, -0.007, -0.007, -0.008, -0.008, -0.007, -0.007, -0.007] for i in xrange(10): self.assertEquals(em.map[60][60][51 + i], exp[i])
def spins_plot(grid): #spin sectangles for x, y in grid: if grid.GetCell(x, y) == -1: col = 'red' else: col = '#28F' c.create_rectangle(51 + x * a, 51 + y * a, 51 + (x + 1) * a, 51 + (y + 1) * a, fill=col, outline=col, width=0) def latt(g): #redraw of the screen c.delete(ALL) spins_plot(g) grid() c.update() if __name__ == '__main__': x = 50 y = 50 g = Field(x, y) g.FlipSpin(2, 1) init(x, y) latt(g)
temperature, magneticField=0, show=False, showFrequency=100000): width = grid.width height = grid.height for i in range(iterationNumber): x = randint(0, width - 1) y = randint(0, height - 1) energyChange = grid.FlipEnergy(x, y, magneticField) if energyChange <= 0: grid.FlipSpin(x, y, magneticField) elif random() <= exp(-energyChange / temperature): grid.FlipSpin(x, y, magneticField) if show and (i % showFrequency == 0): latt(grid) if __name__ == '__main__': print('start') g = Field(100, 100) init(100, 100) MonteCarlo(g, 10000000, 4, show=True) print('finish')
def run(self): with open(self.docking_parameter_file, 'r') as p_file: for line in p_file: if line.startswith("intelec"): self.dock.dps.calc_inter_elec_e = True # Atomic bonding parameter file if line.startswith("b_prm"): self.dock.bond.read(line.split()[1]) if line.startswith("ligand_types"): for type in line.split('#')[0].split()[1:]: self.dock.ligand.atom_types.append(type) self.atom_type_map_files[type] = "" self.dock.bond.calc_internal_energy_tables( self.dock.ligand) if line.startswith("fld"): self.grid_field_file = "./Parameters/" + line.split()[1] self.dock.grid.field = Field(self.grid_field_file) if line.startswith("map"): filename = line.split()[1] type = filename.split('.')[1] self.atom_type_map_files[type] = "./Maps/" + filename self.dock.grid.maps[type] = AtomTypeMap( self.atom_type_map_files[type], self.dock.grid.field).map if line.startswith("elecmap"): self.electrostatic_map_file = "./Maps/" + line.split()[1] self.dock.grid.maps['e'] = ElectrostaticMap( self.electrostatic_map_file, self.dock.grid.field).map if line.startswith("desolvmap"): self.desolvation_map_file = "./Maps/" + line.split()[1] self.dock.grid.maps['d'] = DesolvationMap( self.desolvation_map_file, self.dock.grid.field).map # Set movable molecule (ligand) if line.startswith("move"): self.ligand_file = "./Inputs/" + line.split()[1] self.dock.ligand.read_pdbqt(self.ligand_file) # Set flexible portion of molecule (normally protein receptor) if line.startswith("flexres"): self.protein_file = "./Inputs/" + line.split()[1] self.dock.protein.read_flex_pdbqt(self.protein_file) if line.startswith("about"): about = Axis3(0.0, 0.0, 0.0) about.xyz = [float(axis) for axis in line.split()[1:4]] self.dock.ligand.about = about # Zero-out central point. Applicable only for all ligand # atoms (not protein atoms) for i in xrange(len(self.dock.ligand.ori_atoms)): self.dock.ligand.ori_atoms[i].tcoord -= about self.dock.ligand.reset_atoms() # Pre-energy calculation if line.startswith("pre_energy_calc"): # Get atomic non-bond lists self.dock.get_non_bond_list() # Calculate binding torsional free energy self.dock.torsional_energy = self.dock.bond.torsional_dof * \ self.dock.bond.fec_tors # --------------------------------------- Empirical Settings --- # 1-4 interactions if line.startswith("include_1_4_interactions"): # By default, 1-4 interactions is disabled. Only 1-1, 1-2, # and 1-3 interactions are considered. self.dock.bond.include_1_4_interactions = True # Torsional degrees of freedom (DoF) if line.startswith("torsdof"): self.dock.bond.torsional_dof = int(line.split()[1]) #---------------------------------------------- Optimization --- # Define optimization type to use if line.startswith("opt_type"): type = line.split()[1] if type == "ga": if self.accelerator == "sequential": self.optimization = \ Optimization.GeneticAlgorithm(self.dock) if self.accelerator == "opencl": self.optimization = \ Optimization.GeneticAlgorithmOpenCL(self.dock, \ self.cl_device_type) # Run optimization if line.startswith("opt_run"): self.optimization.run() #------------------------------------ Opt: Genetic Algorithm --- if line.startswith("opt_ga"): words = line.split() type = words[1] value = words[2] if type == "community_size": self.optimization.community_size = int(value) if type == "pop_size": self.optimization.population_size = int(value) if type == "num_generations": self.optimization.num_gen = int(value) #----------------------------------------------- Accelerator --- # Define parallel processing accelerator if line.startswith("accelerator"): self.accelerator = line.split()[1] if self.accelerator == "sequential": self.dock = Dock() if self.accelerator == "opencl": self.dock = DockOpenCL() # Define OpenCL device types if line.startswith("ocl_device_type"): self.cl_device_type = line.split()[1]
def testCalcEnergy(self): ligand = Ligand() ligand.read_pdbqt("./Inputs/ind.pdbqt") ligand.update_tcoord_model("./Results/ind_1.model") grid = Grid() grid.field = Field("./Parameters/hsg1_rigid.maps.fld") grid.maps['e'] = ElectrostaticMap("./Maps/hsg1_rigid.e.map", grid.field).map grid.maps['d'] = DesolvationMap("./Maps/hsg1_rigid.d.map", grid.field).map grid.maps['A'] = AtomTypeMap("./Maps/hsg1_rigid.A.map", grid.field).map grid.maps['C'] = AtomTypeMap("./Maps/hsg1_rigid.C.map", grid.field).map grid.maps['HD'] = AtomTypeMap("./Maps/hsg1_rigid.HD.map", grid.field).map grid.maps['N'] = AtomTypeMap("./Maps/hsg1_rigid.N.map", grid.field).map grid.maps['NA'] = AtomTypeMap("./Maps/hsg1_rigid.NA.map", grid.field).map grid.maps['OA'] = AtomTypeMap("./Maps/hsg1_rigid.OA.map", grid.field).map dock = Dock() dock.ligand = ligand dock.grid = grid dock.calc_energy() exp_elecs = [-0.037623435264000013, -0.11408866126250672, \ -0.13002690236871114, -0.11316478799697538, \ 0.079400682425344024, 0.16382104147968005, \ 0.35572237014565938, -0.13983584352051195, \ -0.14455922704497778, -0.2437679729095111, \ -0.2233031453627734, -0.057756149112888927, \ -0.079042238535680001, -0.032257681663999997, \ -0.14416303698488891, 0.10750629826486036, \ 0.24778700799999992, -0.084038775587896894, \ -0.106404338719744, -0.052751354779306661, \ 0.024654531648227552, -0.0042321141760000005, \ -0.00035986557866666673, -0.00033659216281599992, \ -0.0041046807466666672, 0.012465198300672001, \ -0.090822509727725043, -0.17177248957202962, \ 1.1082351947605333, -0.89707293013333311, \ 0.026757765866666665, -0.0020757145903407409, \ -0.00025216804266666674, -0, -0.00048987137962666649, \ -0.0041342845067377787, -0.077292167626752006, \ 0.0028771771022222214, -0.035468487893333331, \ 0.061588514183964438, -0.025041379570346665, \ -0.0055949960533333357, -0.0031704985600000007, \ -0.0069595652002702214, -0.012058230703198818, \ -0.0079140675343170441, -0.012375409536000002, \ 0.3866265132258988, -0.20299363642879997] self.assertEquals(dock.elecs, exp_elecs) exp_elec_total = -0.689862915434 self.assertLessEqual(dock.elec_total - exp_elec_total, 0.000000000001) self.assertGreaterEqual(dock.elec_total - exp_elec_total, -0.000000000001) exp_emaps = [-0.27127903027200001, -0.16588333043273959, \ -0.20299416690915556, -0.21193308408991288, \ -0.22342833248403907, -0.10887097308672009, \ -0.069412406582518515, -0.32392036196890539, \ -0.22020219191751092, -0.35971221242311113, \ -0.36151369650175996, -0.33589534698001067, \ -0.31399731050837326, -0.37602125178402135, \ -0.18051097352533335, -0.17621873305273847, \ -0.092143525887999983, -0.2309628750124183, \ -0.24049173290393594, -0.30815793025564453, \ -0.39344854528779372, -0.50645809636693317, \ -0.53159663755332287, -0.49475817361601443, \ -0.34577077998990213, -0.31340080937233067, \ 0.083165888601903395, -0.37009113352391104, \ -0.26495262599680025, -0.35829845333333321, \ -0.27628956787200004, -0.36140396483508141, \ -0.31815226712832012, -0.2094688831146666, \ -0.23815943764081771, -0.24906767845688918, \ -0.22192987677536707, -0.25745685461333312, \ -0.19937555381333344, -0.2350488774924894, \ -0.19400907040085333, -0.14228789478968887, \ -0.23528794258204436, -0.4346495467977386, \ -0.44998934942632773, -0.52384750919471401, \ -0.51774914410666673, -0.26729886470788744, \ 0.052065064174933465] self.assertEquals(dock.emaps, exp_emaps) exp_emap_total = -13.5485660526 self.assertLessEqual(dock.emap_total - exp_emap_total, 0.0000000001) self.assertGreaterEqual(dock.emap_total - exp_emap_total, -0.0000000001)
def testCalcLinInterp3(self): ligand = Ligand() ligand.read_pdbqt("./Inputs/ind.pdbqt") ligand.update_tcoord_model("./Results/ind_1.model") grid = Grid() grid.field = Field("./Parameters/hsg1_rigid.maps.fld") grid.maps['e'] = ElectrostaticMap("./Maps/hsg1_rigid.e.map", grid.field).map grid.maps['d'] = DesolvationMap("./Maps/hsg1_rigid.d.map", grid.field).map grid.maps['A'] = AtomTypeMap("./Maps/hsg1_rigid.A.map", grid.field).map grid.maps['C'] = AtomTypeMap("./Maps/hsg1_rigid.C.map", grid.field).map grid.maps['HD'] = AtomTypeMap("./Maps/hsg1_rigid.HD.map", grid.field).map grid.maps['N'] = AtomTypeMap("./Maps/hsg1_rigid.N.map", grid.field).map grid.maps['NA'] = AtomTypeMap("./Maps/hsg1_rigid.NA.map", grid.field).map grid.maps['OA'] = AtomTypeMap("./Maps/hsg1_rigid.OA.map", grid.field).map protein = Protein() u0, v0, w0, u1, v1, w1, \ p000, p001, p010, p011, p100, p101, p110, p111 = \ Dock.calc_linInterp3(grid, ligand, protein) exp_u0 = [24, 27, 30, 33, 33, 36, 28, 24, 22, 29, 29, 32, 32, 35, 29, \ 28, 27, 25, 25, 21, 18, 15, 13, 15, 19, 21, 36, 28, 29, 28, \ 35, 36, 36, 35, 35, 35, 22, 23, 25, 26, 26, 25, 23, 40, 41, \ 40, 42, 26, 23] self.assertEquals(u0, exp_u0) exp_v0 = [29, 30, 27, 29, 31, 28, 25, 25, 27, 22, 23, 25, 25, 27, 27, \ 30, 26, 28, 27, 28, 28, 27, 27, 27, 27, 28, 26, 24, 19, 18, \ 28, 31, 31, 28, 25, 25, 31, 33, 37, 38, 36, 32, 31, 29, 28, \ 33, 27, 24, 22] self.assertEquals(v0, exp_v0) exp_w0 = [18, 19, 21, 22, 24, 20, 24, 23, 21, 26, 30, 32, 36, 37, 37, \ 35, 40, 42, 46, 47, 44, 44, 41, 38, 38, 41, 18, 41, 31, 29, \ 41, 43, 46, 49, 47, 43, 16, 13, 12, 10, 7, 6, 10, 20, 24, \ 19, 18, 46, 46] self.assertEquals(w0, exp_w0) exp_u1 = [25, 28, 31, 34, 34, 37, 29, 25, 23, 30, 30, 33, 33, 36, 30, \ 29, 28, 26, 26, 22, 19, 16, 14, 16, 20, 22, 37, 29, 30, 29, \ 36, 37, 37, 36, 36, 36, 23, 24, 26, 27, 27, 26, 24, 41, 42, \ 41, 43, 27, 24] self.assertEquals(u1, exp_u1) exp_v1 = [30, 31, 28, 30, 32, 29, 26, 26, 28, 23, 24, 26, 26, 28, 28, \ 31, 27, 29, 28, 29, 29, 28, 28, 28, 28, 29, 27, 25, 20, 19, \ 29, 32, 32, 29, 26, 26, 32, 34, 38, 39, 37, 33, 32, 30, 29, \ 34, 28, 25, 23] self.assertEquals(v1, exp_v1) exp_w1 = [19, 20, 22, 23, 25, 21, 25, 24, 22, 27, 31, 33, 37, 38, 38, \ 36, 41, 43, 47, 48, 45, 45, 42, 39, 39, 42, 19, 42, 32, 30, \ 42, 44, 47, 50, 48, 44, 17, 14, 13, 11, 8, 7, 11, 21, 25, \ 20, 19, 47, 47] self.assertEquals(w1, exp_w1) exp_p000 = [0.0049920000000003, 0.07082279822222158, \ 0.010670762666666705, 0.014893662814814962, \ 0.05954753422222141, 0.06692323555555484, \ 0.02218827851851877, 0.05730432948148176, \ 0.09164231111110999, 0.11063039999999903, \ 0.07689557333333293, 0.05574929066666695, \ 0.15205717333333324, 0.510503367111111, \ 0.13600474074074018, 0.3160871632592622, \ 0.14260223999999969, 0.020969604740741634, \ 0.07576166400000024, 0.43352632888888754, \ 0.24339291022222376, 0.11683840000000191, \ 0.06234385066666788, 0.0069254826666658295, \ 0.049472398222222956, 0.004077568000000049, \ 0.005478324148148441, 0.001810014814814871, \ 0.04792319999999972, 0.0, 0.11909688888888928, \ 0.06675531851851867, 0.34005930666666545, \ 0.019190670222224544, 0.022714595555556102, \ 0.02363960888888848, 0.04932630755555612, \ 0.028551111111111964, 0.0027955200000004095, \ 0.002817744592593219, 0.013583075555555114, \ 0.2548221724444463, 0.007528391111110991, \ 0.04061548088888999, 0.031737780148146724, \ 0.017002571851849876, 0.1769813333333323, \ 0.061945476740739906, 0.7125060266666654] self.assertEquals(p000, exp_p000) exp_p001 = [0.0046080000000002855, 0.028647423999999776, \ 0.052845681777776904, 0.038809448296297094, \ 0.010895132444444356, 0.12177009777777835, \ 0.06019394370370367, 0.010699226074073875, \ 0.0982243555555557, 0.40154737777778016, \ 0.22347775999999855, 0.18181870933333166, \ 0.3616494933333342, 0.1806112995555552, \ 0.14577303703703634, 0.0034079478518515044, \ 0.2535150933333334, 0.04401883970370486, \ 0.17345433599999888, 0.17308700444444436, \ 0.018132423111111077, 0.022254933333333133, \ 0.052258816000000166, 0.010048739555554584, \ 0.06794626844444453, 0.004370432000000051, \ 0.02819989807407561, 0.006367762962963142, \ 0.6432768000000015, 0.2736355555555557, \ 0.05954844444444527, 0.16720023703703696, \ 0.009316693333334796, 0.5805177742222254, \ 0.032240071111111795, 0.01006705777777773, \ 0.06143635911111165, 0.3997155555555576, \ 8.448000000000805e-05, 0.5255093665185175, \ 0.28604359111111133, 0.012100494222221909, \ 0.3957782755555553, 0.008835185777778117, \ 0.009876442074073755, 0.0010596503703702597, \ 0.039907555555555606, 0.0033060788148146308, \ 0.01752064000000065] self.assertEquals(p001, exp_p001) exp_p010 = [0.01580800000000109, 0.43991853511111095, \ 0.02382523733333365, 0.1596414482962953, \ 0.5130249102222195, 0.10615409777777662, \ 0.002949499259259329, 0.10673478162962986, \ 0.004891022222222317, 0.013209599999999733, \ 0.10332842666666649, 0.1244747093333352, \ 0.03738282666666654, 0.2064957440000002, \ 0.024884148148148186, 0.15615461451851684, \ 0.11083775999999886, 0.010866839703704239, \ 0.004494336000000094, 0.014331448888888855, \ 0.4986586453333299, 0.017561600000000257, \ 0.23359214933333552, 0.22917051733333157, \ 0.05838893511111133, 0.0383970986666671, \ 0.001462120296296389, 0.06606554074074122, \ 0.011980799999999877, 0.0, 0.4462364444444414, \ 0.0664002370370377, 0.0726340266666656, \ 0.004958663111111672, 0.02357873777777808, \ 0.08857372444444203, 0.0029261368888889743, \ 0.020337777777778118, 0.20686847999999752, \ 0.0013920331851854889, 0.018452479999999438, \ 0.00484716088888932, 0.006658275555555493, \ 0.04261296355555679, 0.006903997629629396, \ 0.6205938725925908, 0.36701866666666505, \ 0.1253896343703712, 0.19322197333333457] self.assertEquals(p010, exp_p010) exp_p011 = [0.01459200000000103, 0.17794457600000016, \ 0.11799165155555476, 0.41598877392592776, \ 0.09386575644444448, 0.19315256888888976, \ 0.008001611851851947, 0.019928329481481058, \ 0.005242311111111285, 0.04794595555555529, \ 0.3002982399999991, 0.4059572906666669, \ 0.08891050666666664, 0.07305625599999993, \ 0.026671407407407432, 0.001683607703703498, \ 0.19704490666666513, 0.02281138251851927, \ 0.010289664000000117, 0.0057218844444444465, \ 0.0371493546666661, 0.003345066666666631, \ 0.19580518399999866, 0.3325219271111166, \ 0.08019239822222142, 0.04115490133333377, \ 0.007526324148148633, 0.2324233481481492, \ 0.16081919999999966, 0.5156977777777759, \ 0.22311822222222305, 0.16631087407407527, \ 0.0019899733333336236, 0.14999955911111074, \ 0.033466595555555895, 0.03771960888888834, \ 0.0036445297777778743, 0.2847288888888866, \ 0.006251519999999605, 0.2596141890370355, \ 0.38858752000000113, 0.0002301724444444573, \ 0.3500350577777798, 0.009269703111111484, \ 0.002148446814814769, 0.03867723851851886, \ 0.08275911111111132, 0.00669214340740717, \ 0.004751360000000215] self.assertEquals(p011, exp_p011) exp_p100 = [0.11980799999999879, 0.027907868444444307, \ 0.04129723733333381, 0.008772114962962983, \ 0.028367132444444516, 0.0702145422222216, \ 0.21554327703703846, 0.23706722607407538, \ 0.36656924444444156, 0.082329599999999, \ 0.03233109333333362, 0.016840931555555577, \ 0.08553215999999973, 0.015427299555555727, \ 0.2720094814814818, 0.34610661451852076, \ 0.059957760000000714, 0.19156017303703798, \ 0.21121433600000142, 0.2582710044444453, \ 0.061865756444445814, 0.6134016000000012, \ 0.05225881600000055, 0.005042517333332682, \ 0.1437791573333353, 0.042258432000000005, \ 0.12291989807407339, 0.004092207407407501, \ 0.007543466666666573, 0.0, 0.021347555555555793, \ 0.07629179259259218, 0.4619673599999994, \ 0.006238663111111675, 0.18009429333333427, \ 0.12410794666666769, 0.37106835911111075, \ 0.010382222222222482, 0.010146702222223856, \ 0.0007520331851853598, 0.005638257777777585, \ 0.6820240497777759, 0.002377386666666608, \ 0.36019518577777554, 0.5946657754074057, \ 0.008099650370369561, 0.0884906666666671, \ 0.2519674121481454, 0.05528063999999922] self.assertEquals(p100, exp_p100) exp_p101 = [0.11059199999999907, 0.011288575999999958, \ 0.2045196515555538, 0.022858107259259554, \ 0.005190200888888931, 0.12775879111111194, \ 0.5847411674074044, 0.044262551703702906, \ 0.3928974222222245, 0.2988259555555563, \ 0.09396224000000072, 0.05492440177777706, \ 0.20342783999999997, 0.0054580337777778275, \ 0.29154607407407424, 0.0037316077037033123, \ 0.10659157333333487, 0.4021180491851807, \ 0.48356966399999857, 0.10311566222222283, \ 0.0046089102222222865, 0.11683839999999726, \ 0.04380518399999974, 0.00731659377777701, \ 0.19746884266666664, 0.045293567999999985, \ 0.6327352130370342, 0.014396681481481769, \ 0.10125653333333291, 0.07303111111111188, \ 0.010673777777778011, 0.19108598518518363, \ 0.012656640000002016, 0.18871955911110633, \ 0.2556177066666673, 0.05285205333333443, \ 0.46216897422222053, 0.14535111111111115, \ 0.00030663111111114483, 0.14025418903703818, \ 0.11873507555555546, 0.03238661688888772, \ 0.12498261333333217, 0.07835414755555593, \ 0.18505333570370552, 0.0005047940740740295, \ 0.019953777777778015, 0.01344769896296225, \ 0.0013593600000000336] self.assertEquals(p101, exp_p101) exp_p110 = [0.3793919999999994, 0.1733507982222229, \ 0.09220676266666863, 0.09402610725925796, \ 0.24439375644444714, 0.11137479111111008, \ 0.028652278518519068, 0.4415603294814827, \ 0.019564088888889355, 0.009830399999999769, \ 0.0434449066666672, 0.03760173511111153, \ 0.021027839999999878, 0.006240256000000077, \ 0.04976829629629663, 0.1709849410370347, \ 0.04660224000000018, 0.09927004918518634, \ 0.012529664000000305, 0.00853788444444448, \ 0.12674935466666779, 0.09219840000000003, \ 0.19580518400000008, 0.16686148266666403, \ 0.1696928426666671, 0.3979335679999997, \ 0.0328063241481483, 0.14936557037037024, \ 0.0018858666666666348, 0.0, 0.07998577777777786, \ 0.07588598518518534, 0.09867263999999876, \ 0.0016120035555556883, 0.18694570666666555, \ 0.4650120533333325, 0.022012529777778147, \ 0.007395555555555644, 0.7508559644444464, \ 0.0003715223703704551, 0.007659519999999756, \ 0.012973283555556579, 0.0021026133333332956, \ 0.3779097031111094, 0.12935911348148255, \ 0.29563723851852247, 0.18350933333333447, \ 0.5100308100740788, 0.01499135999999991] self.assertEquals(p110, exp_p110) exp_p111 = [0.3502080000000001, 0.07011942400000036, \ 0.45664301511111166, 0.2450103371851844, \ 0.04471557688888963, 0.2026518755555568, \ 0.07772994370370429, 0.08244322607407237, \ 0.020969244444445232, 0.03568071111111079, \ 0.1262617600000014, 0.12263293155555516, \ 0.05001215999999986, 0.002207744000000023, \ 0.05334281481481515, 0.0018435034074071772, \ 0.08284842666666718, 0.20838506192592499, \ 0.02868633600000042, 0.0034087822222222453, \ 0.009442645333333338, 0.01756159999999956, \ 0.1641308159999974, 0.2421127395555576, \ 0.23305915733333074, 0.4265144319999994, \ 0.16887189807407502, 0.5254788740740721, \ 0.025314133333333114, 0.13763555555555645, \ 0.039992888888889355, 0.19006957037037026, \ 0.0027033600000004004, 0.048763107555553936, \ 0.26534229333333104, 0.19802794666666879, \ 0.02741680355555594, 0.10353777777777645, \ 0.02269070222222112, 0.06928892207407435, \ 0.16130048000000022, 0.0006160497777778058, \ 0.11053738666666636, 0.08220763022222277, \ 0.040255108740741584, 0.018424983703704163, \ 0.041379555555556106, 0.027220745481480586, \ 0.0003686400000000121] self.assertEquals(p111, exp_p111)