def qlat_from_gpt_prop(gpt_prop): ctype = "WilsonMatrix" total_site = gpt_prop.grid.fdimensions multiplicity = 1 tag = "qlat_from_gpt" plan = get_qlat_gpt_copy_plan(ctype, total_site, multiplicity, tag) geo = q.Geometry(total_site, 1) prop_msc = q.Prop(geo) plan(prop_msc.mview(), gpt_prop) prop_wm = q.Prop(geo) q.convert_wm_from_mspincolor_prop(prop_wm, prop_msc) return prop_wm
def gpt_from_qlat_prop(prop_wm): assert isinstance(prop_wm, q.Prop) geo = prop_wm.geo() ctype = "WilsonMatrix" total_site = geo.total_site() multiplicity = 1 tag = "gpt_from_qlat" plan = get_qlat_gpt_copy_plan(ctype, total_site, multiplicity, tag) prop_msc = q.Prop(geo) q.convert_mspincolor_from_wm_prop(prop_msc, prop_wm) grid = mk_grid(geo) gpt_prop = g.mspincolor(grid) plan(gpt_prop, prop_msc.mview()) return gpt_prop
"Ls": 32, "boundary_phases": [1.0, 1.0, 1.0, 1.0], } gpt_gf = qg.gpt_from_qlat(gf) qm = g.qcd.fermion.mobius(gpt_gf, mobius_params) pc = g.qcd.fermion.preconditioner inv = g.algorithms.inverter cg = inv.cg({"eps": 1e-11, "maxiter": 10000}) slv_5d = inv.preconditioned(pc.eo2_ne(), cg) slv_qm = qm.propagator(slv_5d) ginv = qg.InverterGPT(inverter=slv_qm, timer=q.Timer("py:InverterGPT")) src_p = q.mk_point_src(geo, [0, 0, 0, 0]) src_r = q.Prop(geo) src_r.set_rand(rs.split("src_r")) for src in [src_p, src_r]: sol = qinv * src sol1 = ginv * src sol_diff = sol1.copy() sol_diff -= sol q.displayln_info(sol.qnorm(), sol1.qnorm(), sol_diff.qnorm()) q.timer_display() qg.end_with_gpt()
gf = q.GaugeField(geo) gf.set_rand(rs.split("gf-init"), 0.05, 2) gf.show_info() inv_type = 1 inv_acc = 0 inv = ru.mk_inverter(gf, job_tag, inv_type, inv_acc, n_grouped=q.get_num_node()) srcs = [] for i in range(2): p = q.Prop(geo) p.set_rand(rs.split(f"prop-src {i}")) q.displayln_info(f"prop src {i} qnorm = {p.qnorm()} crc32 = {p.crc32()}") srcs.append(p) sols = inv * srcs for i in range(2): p = sols[i] q.displayln_info(f"prop sol {i} qnorm = {p.qnorm()} crc32 = {p.crc32()}") q.timer_display() qg.end_with_gpt()
inv = g.algorithms.inverter cg = inv.cg({"eps": 1e-8, "maxiter": 10000}) slv_5d = inv.preconditioned(pc.eo2_ne(), cg) slv_qm = qm.propagator(slv_5d) inv_qm = qg.InverterGPT(inverter=slv_qm, timer=timer) return inv_qm inv = mk_inverter_gpt(gf_gfix, q.Timer("py:slv_qm", True)) inv_gt = q.InverterGaugeTransform(inverter=mk_inverter_gpt( gf, q.Timer("py:slv_qm", True)), gt=gt, timer=q.Timer("py:inv_gfix", True)) src = q.Prop(geo) src.set_rand(rs.split("src_r")) sol = inv * src sol1 = inv_gt * src sol_diff = sol1.copy() sol_diff -= sol1 q.displayln_info(sol.qnorm(), sol1.qnorm(), sol_diff.qnorm()) q.timer_display() qg.end_with_gpt()
q.qremove_all_info("results") q.qmkdir_info("results") rs = q.RngState("seed") total_site = [4, 4, 4, 8] geo = q.Geometry(total_site, 1) q.displayln_info("geo.show() =", geo.show()) psel = q.PointSelection([[0, 0, 0, 0], [0, 1, 2, 0]]) n_per_tslice = 16 fsel = q.FieldSelection(geo.total_site(), n_per_tslice, rs.split("fsel")) fselc = fsel.copy() fselc.add_psel(psel) prop = q.Prop(geo) prop.set_rand(rs.split("prop-1")) q.displayln_info("prop", prop.crc32(), prop.qnorm()) sfw = q.open_fields("results/prop.fields", "w", [1, 1, 1, 8]) q.displayln_info("sfw.new_size_node()", sfw.new_size_node()) prop.save_double(sfw, "prop.d") prop.save_float_from_double(sfw, "prop") s_prop = prop.sparse(fsel) q.displayln_info("s_prop = prop.sparse(fsel)", s_prop.qnorm()) s_prop.save_float_from_double(sfw, "s_prop")
#!/usr/bin/env python3 import qlat as q import os q.begin() q.qremove_all_info("results") q.qmkdir_info("results") total_site = [4, 4, 4, 8] geo = q.Geometry(total_site, 1) q.displayln_info("geo.show() =", geo.show()) rs = q.RngState("seed") prop = q.Prop(geo) prop.set_rand(rs.split("prop-1")) q.displayln_info( f"prop.crc32() = {prop.crc32()} ; prop.qnorm() = {prop.qnorm()}") prop.save("results/prop.field") prop = q.Prop() prop.load("results/prop.field") q.displayln_info( f"prop.crc32() = {prop.crc32()} ; prop.qnorm() = {prop.qnorm()}") prop.save_double("results/prop-double.field") prop = q.Prop() prop.load_double("results/prop-double.field")