def exercise_02(): xs = [0, 0, 0] ys = [0, 0, 0] zs = [0, 0, 0] for pdb_str in [pdb_str_1, pdb_str_2, pdb_str_3, pdb_str_4]: print(pdb_str) for t in [ [0.05, 0.07, 0.09], ]: tx, ty, tz = t for x in range(3): for y in range(3): for z in range(3): if (x != y and x != z and y != z): xs_ = xs[:] ys_ = ys[:] zs_ = zs[:] xs_[x] = 1 ys_[y] = 1 zs_[z] = 1 tools.u_tls_vs_u_ens(pdb_str=pdb_str, tx=tx, ty=ty, tz=tz, vx=xs_, vy=ys_, vz=zs_, n_models=1000) print()
def exercise_00(): xs = [0, 0, 0] ys = [0, 0, 0] zs = [0, 0, 0] for pdb_str in [pdb_str_1, pdb_str_2, pdb_str_3, pdb_str_4]: print pdb_str for d in [ [0.05, 0.06, 0.07], ]: dx, dy, dz = d for x in xrange(3): for y in xrange(3): for z in xrange(3): if (x != y and x != z and y != z): xs_ = xs[:] ys_ = ys[:] zs_ = zs[:] xs_[x] = 1 ys_[y] = 1 zs_[z] = 1 tools.u_tls_vs_u_ens(pdb_str=pdb_str, dx=dx, dy=dy, dz=dz, sx=0.5, sy=0.4, sz=0.3, lx=xs_, ly=ys_, lz=zs_) print
def exercise_03(): sqrt = math.sqrt vs = [] vs.append( [(sqrt(2)/2, sqrt(2)/2, 0), (-sqrt(2)/2, sqrt(2)/2, 0), (0,0,1)] ) vs.append( [(1,0,0), (0, sqrt(2)/2, sqrt(2)/2), (0, -sqrt(2)/2, sqrt(2)/2)] ) vs.append( [(sqrt(3)/2, 1/2, 0), (-1/2, sqrt(3)/2, 0), (0,0,1)] ) vs.append( [(1,0,0), (0, sqrt(3)/2, 1/2), (0, -1/2, sqrt(3)/2)] ) for pdb_str in [pdb_str_1, pdb_str_2, pdb_str_3, pdb_str_4]: for vs_ in vs: vx,vy,vz = vs_ print vx,vy,vz tools.u_tls_vs_u_ens(pdb_str=pdb_str, tx=0.05,ty=0.07,tz=0.09, vx=vx, vy=vy, vz=vz, n_models=1000)
def exercise_01(): sqrt = math.sqrt ls = [] ls.append( [(sqrt(2)/2, sqrt(2)/2, 0), (-sqrt(2)/2, sqrt(2)/2, 0), (0,0,1)] ) ls.append( [(1,0,0), (0, sqrt(2)/2, sqrt(2)/2), (0, -sqrt(2)/2, sqrt(2)/2)] ) ls.append( [(sqrt(3)/2, 1/2, 0), (-1/2, sqrt(3)/2, 0), (0,0,1)] ) ls.append( [(1,0,0), (0, sqrt(3)/2, 1/2), (0, -1/2, sqrt(3)/2)] ) for pdb_str in [pdb_str_1, pdb_str_2, pdb_str_3, pdb_str_4]: for ls_ in ls: lx,ly,lz = ls_ print lx,ly,lz tools.u_tls_vs_u_ens(pdb_str=pdb_str, dx=0.05,dy=0.06,dz=0.07, sx=0.5, sy=0.4, sz=0.3, lx=lx, ly=ly, lz=lz)
def exercise_00(pdb_str, formula): """ TLS group 6 of 4muy. """ pdb_inp = iotbx.pdb.input(source_info=None, lines = pdb_str) pdb_hierarchy = pdb_inp.construct_hierarchy() asc = pdb_hierarchy.atom_selection_cache() cs = pdb_inp.crystal_symmetry_from_cryst1() tls_extract = mmtbx.tls.tools.tls_from_pdb_inp( remark_3_records = pdb_inp.extract_remark_iii_records(3), pdb_hierarchy = pdb_hierarchy) # deg_to_rad_scale = math.pi/180 tls_params_one_group = tls_extract.tls_params[0] T = matrix.sym(sym_mat3=tls_params_one_group.t) L = matrix.sym(sym_mat3=tls_params_one_group.l) S = matrix.sqr(tls_params_one_group.s) origin = tls_params_one_group.origin tlso = tools.tlso( t = T.as_sym_mat3(), l = L.as_sym_mat3(), s = S, origin = origin) log = open("analysis.log","w") r = analysis.run(T=T, L=L*(deg_to_rad_scale**2), S=S*deg_to_rad_scale, log=log, find_t_S_using_formula=formula).self_check(show=False) log.close() # rs = flex.double() for trial in xrange(10): o = tools.u_tls_vs_u_ens(pdb_str=pdb_str, dx = r.dx, dy = r.dy, dz = r.dz, sx = r.sx, sy = r.sy, sz = r.sz, lx = r.l_x, ly = r.l_y, lz = r.l_z, tx = r.tx, ty = r.ty, tz = r.tz, vx = r.v_x, vy = r.v_y, vz = r.v_z, w_M_lx = r.w_M_lx, w_M_ly = r.w_M_ly, w_M_lz = r.w_M_lz, origin = origin, n_models = 10000, assert_similarity=False) rs.append(o.r) return flex.mean(rs)
def exercise_03(): sqrt = math.sqrt vs = [] vs.append([(sqrt(2) / 2, sqrt(2) / 2, 0), (-sqrt(2) / 2, sqrt(2) / 2, 0), (0, 0, 1)]) vs.append([(1, 0, 0), (0, sqrt(2) / 2, sqrt(2) / 2), (0, -sqrt(2) / 2, sqrt(2) / 2)]) vs.append([(sqrt(3) / 2, 1 / 2, 0), (-1 / 2, sqrt(3) / 2, 0), (0, 0, 1)]) vs.append([(1, 0, 0), (0, sqrt(3) / 2, 1 / 2), (0, -1 / 2, sqrt(3) / 2)]) for pdb_str in [pdb_str_1, pdb_str_2, pdb_str_3, pdb_str_4]: for vs_ in vs: vx, vy, vz = vs_ print(vx, vy, vz) tools.u_tls_vs_u_ens(pdb_str=pdb_str, tx=0.05, ty=0.07, tz=0.09, vx=vx, vy=vy, vz=vz, n_models=1000)
def exercise_00(): xs=[0,0,0] ys=[0,0,0] zs=[0,0,0] for pdb_str in [pdb_str_1, pdb_str_2, pdb_str_3, pdb_str_4]: print pdb_str for d in [[0.05,0.06,0.07], ]: dx,dy,dz = d for x in xrange(3): for y in xrange(3): for z in xrange(3): if(x!=y and x!=z and y!=z): xs_ = xs[:] ys_ = ys[:] zs_ = zs[:] xs_[x]=1 ys_[y]=1 zs_[z]=1 tools.u_tls_vs_u_ens(pdb_str=pdb_str, dx=dx,dy=dy,dz=dz, sx=0.5,sy=0.4,sz=0.3, lx=xs_,ly=ys_,lz=zs_) print
def exercise_04(): sqrt = math.sqrt ls = [] ls.append( [(sqrt(2)/2, sqrt(2)/2, 0), (-sqrt(2)/2, sqrt(2)/2, 0), (0,0,1)] ) ls.append( [(1,0,0), (0, sqrt(2)/2, sqrt(2)/2), (0, -sqrt(2)/2, sqrt(2)/2)] ) ls.append( [(sqrt(3)/2, 1/2, 0), (-1/2, sqrt(3)/2, 0), (0,0,1)] ) ls.append( [(1,0,0), (0, sqrt(3)/2, 1/2), (0, -1/2, sqrt(3)/2)] ) vs = ls[:] vs.reverse() for pdb_str in [pdb_str_1, pdb_str_2, pdb_str_3, pdb_str_4]: for ls_, vs_ in zip(ls,vs): lx,ly,lz = ls_ vx,vy,vz = vs_ print lx,ly,lz print vx,vy,vz tools.u_tls_vs_u_ens(pdb_str=pdb_str, dx=0.05,dy=0.06,dz=0.07, sx=0.3, sy=0.2, sz=0.1, lx=lx, ly=ly, lz=lz, tx=0.06,ty=0.08,tz=0.09, vx=vx, vy=vy, vz=vz, w_M_lx=[0.1,0.2,0.3], w_M_ly=[-0.4,-0.3,-0.1], w_M_lz=[-0.2,0.1,0.3])
def exercise_02(): xs=[0,0,0] ys=[0,0,0] zs=[0,0,0] for pdb_str in [pdb_str_1, pdb_str_2, pdb_str_3, pdb_str_4]: print pdb_str for t in [[0.05,0.07,0.09], ]: tx,ty,tz = t for x in xrange(3): for y in xrange(3): for z in xrange(3): if(x!=y and x!=z and y!=z): xs_ = xs[:] ys_ = ys[:] zs_ = zs[:] xs_[x]=1 ys_[y]=1 zs_[z]=1 tools.u_tls_vs_u_ens(pdb_str=pdb_str, tx=tx,ty=ty,tz=tz, vx=xs_,vy=ys_,vz=zs_, n_models=1000) print
def exercise_01(): sqrt = math.sqrt ls = [] ls.append([(sqrt(2) / 2, sqrt(2) / 2, 0), (-sqrt(2) / 2, sqrt(2) / 2, 0), (0, 0, 1)]) ls.append([(1, 0, 0), (0, sqrt(2) / 2, sqrt(2) / 2), (0, -sqrt(2) / 2, sqrt(2) / 2)]) ls.append([(sqrt(3) / 2, 1 / 2, 0), (-1 / 2, sqrt(3) / 2, 0), (0, 0, 1)]) ls.append([(1, 0, 0), (0, sqrt(3) / 2, 1 / 2), (0, -1 / 2, sqrt(3) / 2)]) for pdb_str in [pdb_str_1, pdb_str_2, pdb_str_3, pdb_str_4]: for ls_ in ls: lx, ly, lz = ls_ print(lx, ly, lz) tools.u_tls_vs_u_ens(pdb_str=pdb_str, dx=0.05, dy=0.06, dz=0.07, sx=0.5, sy=0.4, sz=0.3, lx=lx, ly=ly, lz=lz)
def exercise_04(): sqrt = math.sqrt ls = [] ls.append([(sqrt(2) / 2, sqrt(2) / 2, 0), (-sqrt(2) / 2, sqrt(2) / 2, 0), (0, 0, 1)]) ls.append([(1, 0, 0), (0, sqrt(2) / 2, sqrt(2) / 2), (0, -sqrt(2) / 2, sqrt(2) / 2)]) ls.append([(sqrt(3) / 2, 1 / 2, 0), (-1 / 2, sqrt(3) / 2, 0), (0, 0, 1)]) ls.append([(1, 0, 0), (0, sqrt(3) / 2, 1 / 2), (0, -1 / 2, sqrt(3) / 2)]) vs = ls[:] vs.reverse() for pdb_str in [pdb_str_1, pdb_str_2, pdb_str_3, pdb_str_4]: for ls_, vs_ in zip(ls, vs): lx, ly, lz = ls_ vx, vy, vz = vs_ print lx, ly, lz print vx, vy, vz tools.u_tls_vs_u_ens(pdb_str=pdb_str, dx=0.05, dy=0.06, dz=0.07, sx=0.3, sy=0.2, sz=0.1, lx=lx, ly=ly, lz=lz, tx=0.06, ty=0.08, tz=0.09, vx=vx, vy=vy, vz=vz, w_M_lx=[0.1, 0.2, 0.3], w_M_ly=[-0.4, -0.3, -0.1], w_M_lz=[-0.2, 0.1, 0.3])