0.23027432016909377 + 1j * (-0.03530801572584271), 0.3368765581549033 + 1j * (0), 0.7305711010541054 + 1j * (0), 1.1686138337986505 + 1j * (0.3506492418109086), 1.1686138337986505 + 1j * (-0.3506492418109086), 0.994175013717952 + 1j * (0), 0.5029903152251229 + 1j * (0), 0.23027432016909377 + 1j * (0.03530801572584271), 0.17661651536320583 + 1j * (-0.14907774771612217), ], "boundary_phases": [1.0, 1.0, 1.0, 1.0], }, ) # create point source src = g.mspincolor(grid) g.create.point(src, [0, 1, 0, 0]) # solver pc = g.qcd.fermion.preconditioner inv = g.algorithms.inverter cg = inv.cg({"eps": 1e-5, "maxiter": 1000}) cg_kappa = inv.cg({"eps": 1e-5, "maxiter": 1000}) cg_e = inv.cg({"eps": 1e-8, "maxiter": 1000}) slv_5d = inv.preconditioned(pc.eo2_ne(), cg) # kappa: RBC/UKQCD solver for zmobius strange quark # use cg_kappa instead of identical cg to keep # track of iteration counts separately slv_5d_kappa = inv.preconditioned(pc.eo2_kappa_ne(), cg_kappa)
#!/usr/bin/env python3 import gpt as g grid = g.grid([8, 8, 8, 16], g.double) rng = g.random("d") prop = g.mspincolor(grid) rng.cnormal(prop) w = g.qcd.wick() x, y = w.coordinate(2) ud_propagators = { (x, y): prop[0, 0, 0, 0], (y, x): g(g.gamma[5] * g.adj(prop[0, 0, 0, 0]) * g.gamma[5]), } u = w.fermion(ud_propagators) d = w.fermion(ud_propagators) s = w.fermion(ud_propagators) na = w.color_index() nalpha, nbeta = w.spin_index(2) C = 1j * g.gamma[1].tensor() * g.gamma[3].tensor() Cg5 = w.spin_matrix(C * g.gamma[5].tensor()) Pp = w.spin_matrix((g.gamma["I"].tensor() + g.gamma[3].tensor()) * 0.5) ##### # Baryon tests
#!/usr/bin/env python3 # # Authors: Christoph Lehner 2022 # import gpt as g import numpy as np # load configuration rng = g.random("test") grid = g.grid([8, 8, 8, 16], g.double) V = rng.element(g.mcolor(grid)) # fake propagator U = g.mspincolor(grid) D = g.mspincolor(grid) S = g.mspincolor(grid) rng.cnormal([U, D, S]) def uud_two_point(Q1, Q2, kernel): # # eps(a,b,c) eps(a',b',c') (kernel)_alpha'beta' (kernel)_alphabeta Pp_gammagamma' Q2_beta'beta_b'b # (Q1_alpha'alpha_a'a Q1_gamma'gamma_c'c - Q1_alpha'gamma_a'c Q1_gamma'alpha_c'a) # # = # # eps(a,b,c) eps(a',b',c') (kernel)_alpha'beta' (kernel)_alphabeta Pp_gammagamma' Q2_beta'beta_b'b # Q1_alpha'alpha_a'a Q1_gamma'gamma_c'c # - # eps(a,b,c) eps(a',b',c') (kernel)_alpha'beta' (kernel)_alphabeta Pp_gammagamma' Q2_beta'beta_b'b
# quark w = g.qcd.fermion.wilson_clover( U, { "kappa": 0.137, "csw_r": 0, "csw_t": 0, "xi_0": 1, "nu": 1, "isAnisotropic": False, "boundary_phases": [1.0, 1.0, 1.0, -1.0], }, ) # create point source src = g.mspincolor(grid) g.create.point(src, [0, 0, 0, 0]) # even-odd preconditioned matrix eo = g.qcd.fermion.preconditioner.eo2_ne() # build solver inv = g.algorithms.inverter pc = g.qcd.fermion.preconditioner cg = inv.cg({"eps": 1e-6, "maxiter": 1000}) propagator = w.propagator(inv.preconditioned(pc.eo1_ne(), cg)) # propagator dst = g.mspincolor(grid) dst @= propagator * src
# plan_info = plan.info()[0, 0][0, 0] # block_size = plan_info["size"] // plan_info["blocks"] # g.message(" " * 51 + f"block_size = {block_size}") # warmup plan(lhs, rhs) t0 = g.time() for n in range(N): plan(lhs, rhs) t1 = g.time() g.message("%-50s %g GB/s %g s" % ("copy_plan:", GB / (t1 - t0), (t1 - t0) / N)) # spin/color separate/merge msc = g.mspincolor(grid) rng.cnormal(msc) # 2 * N for read/write GB = 2 * N * msc.otype.nfloats * grid.precision.nbytes * grid.fsites / 1e9 xc = g.separate_color(msc) g.merge_color(msc, xc) t0 = g.time() for n in range(N): xc = g.separate_color(msc) t1 = g.time() for n in range(N): g.merge_color(msc, xc) t2 = g.time() g.message("%-50s %g GB/s %g s" % ("separate_color:", GB / (t1 - t0),
# the following code also tests that # the vector -> matrix distribution is # consistent with multi_shift inverter # ordering of dst fields. def mat_shift(dst, src, s): dst @= mat * src + s * src cg = inv.cg({"eps": 1e-8, "maxiter": 500}) shifts = [0.5, 1.0, 1.7] mat = eo2_odd(w).Mpc # also test with multiple sources src = [rng.cnormal(g.mspincolor(w.F_grid_eo)), rng.cnormal(g.mspincolor(w.F_grid_eo))] dst_all = g(inv.multi_shift(cg, shifts)(mat) * src) for i, s in enumerate(shifts): for jsrc in range(2): eps2 = g.norm2( mat * dst_all[2 * i + jsrc] + s * dst_all[2 * i + jsrc] - src[jsrc] ) / g.norm2(src[jsrc]) g.message(f"Test general multi-shift inverter solution: {eps2}") assert eps2 < 1e-14 g.default.set_verbose("multi_shift_cg") mscg = inv.multi_shift_cg({"eps": 1e-8, "maxiter": 1024, "shifts": shifts}) g.default.set_verbose("multi_shift_fom") msfom = inv.multi_shift_fom( {"eps": 1e-8, "maxiter": 1024, "restartlen": 10, "shifts": shifts}
def quark_contract_xx(mspincolor1, mspincolor2, components): """ This routine is written for Nc = 3 y^{k2, k1} = \\sum_{i1, i2, j1, j2} \\epsilon^{i1, j1, k1} \\epsilon^{i2, j2, k2} xc1^{i1, i2} xc2^{j1, j2} Permutations: +(0, 1, 2), +(1, 2, 0), +(2, 0, 1), -(1, 0, 2), -(0, 2, 1), -(2, 1, 0) i.e. - y^{0, 0} = \\epsilon^{i1, j1, 0} \\epsilon^{i2, j2, 0} xc1^{i1, i2} xc2^{j1, j2} Permutations: +(1, 2, 0), -(2, 1, 0); +(1, 2, 0), -(2, 1, 0) - y^{0, 1} = \\epsilon^{i1, j1, 1} \\epsilon^{i2, j2, 0} xc1^{i1, i2} xc2^{j1, j2} Permutations: +(2, 0, 1), -(0, 2, 1); +(1, 2, 0), -(2, 1, 0) - y^{0, 2} = \\epsilon^{i1, j1, 2} \\epsilon^{i2, j2, 0} xc1^{i1, i2} xc2^{j1, j2} Permutations: +(0, 1, 2), -(1, 0, 2) +(1, 2, 0), -(2, 1, 0) - y^{1, 0} = \\epsilon^{i1, j1, 0} \\epsilon^{i2, j2, 1} xc1^{i1, i2} xc2^{j1, j2} Permutations: +(1, 2, 0), -(2, 1, 0) +(2, 0, 1), -(0, 2, 1) - y^{1, 1} = \\epsilon^{i1, j1, 1} \\epsilon^{i2, j2, 1} xc1^{i1, i2} xc2^{j1, j2} Permutations: +(2, 0, 1), -(0, 2, 1) +(2, 0, 1), -(0, 2, 1) - y^{1, 2} = \\epsilon^{i1, j1, 2} \\epsilon^{i2, j2, 1} xc1^{i1, i2} xc2^{j1, j2} Permutations: +(0, 1, 2), -(1, 0, 2) +(2, 0, 1), -(0, 2, 1) - y^{2, 0} = \\epsilon^{i1, j1, 0} \\epsilon^{i2, j2, 2} xc1^{i1, i2} xc2^{j1, j2} Permutations: +(1, 2, 0), -(2, 1, 0) +(0, 1, 2), -(1, 0, 2) - y^{2, 1} = \\epsilon^{i1, j1, 1} \\epsilon^{i2, j2, 2} xc1^{i1, i2} xc2^{j1, j2} Permutations: +(2, 0, 1), -(0, 2, 1) +(0, 1, 2), -(1, 0, 2) - y^{2, 2} = \\epsilon^{i1, j1, 2} \\epsilon^{i2, j2, 2} xc1^{i1, i2} xc2^{j1, j2} Permutations: +(0, 1, 2), -(1, 0, 2) +(0, 1, 2), -(1, 0, 2) """ t_separatespin, t_separatecolor, t_create, t_bilinear, t_merge = 0.0, 0.0, 0.0, 0.0, 0.0 t_start = gpt.time() comps1, comps2 = dict(), dict() for mspincolor, comps in [[mspincolor1, comps1], [mspincolor2, comps2]]: if isinstance(mspincolor, gpt.lattice): t_separatespin -= gpt.time() spin_separated = gpt.separate_spin(mspincolor) t_separatespin += gpt.time() for spinkey in spin_separated: t_separatecolor -= gpt.time() comps[spinkey] = gpt.separate_color(spin_separated[spinkey]) t_separatecolor += gpt.time() elif isinstance(mspincolor, dict): for spinkey in mspincolor: n_keys = len(mspincolor[spinkey]) n_colors = np.sqrt(n_keys) assert n_colors == int(n_colors) assert (int(n_colors) - 1, int(n_colors) - 1) in mspincolor[spinkey] comps[spinkey] = mspincolor[spinkey] grid = comps1[0, 0][0, 0].grid t_create -= gpt.time() dst = gpt.mspincolor(grid) spinsep_dst = {(ii // 4, ii % 4): gpt.mcolor(grid) for ii in range(16)} bilinear_result = [gpt.complex(grid) for _ in range(9)] t_create += gpt.time() leftbase = np.array( [[4, 5, 7, 8], [7, 8, 1, 2], [1, 2, 4, 5], [5, 3, 8, 6], [8, 6, 2, 0], [2, 0, 5, 3], [3, 4, 6, 7], [6, 7, 0, 1], [0, 1, 3, 4]], dtype=np.int32) rightbase = np.array( [[8, 7, 5, 4], [2, 1, 8, 7], [5, 4, 2, 1], [6, 8, 3, 5], [0, 2, 6, 8], [3, 5, 0, 2], [7, 6, 4, 3], [1, 0, 7, 6], [4, 3, 1, 0]], dtype=np.int32) for spin_key in components.keys(): lefts, rights = [], [] bilin_coeffs, bilin_leftbasis, bilin_rightbasis = [], [], [] for nn, comps in enumerate(components[spin_key]): c0_0, c0_1, c1_0, c1_1 = comps for ii in range(9): lefts.append(comps1[c0_0, c0_1][ii // 3, ii % 3]) rights.append(comps2[c1_0, c1_1][ii // 3, ii % 3]) bilin_coeffs = np.append(bilin_coeffs, [1.0, -1.0, -1.0, +1.0]) bilin_leftbasis.append(leftbase + nn * 9) bilin_rightbasis.append(rightbase + nn * 9) bilin_coeffs = np.array([bilin_coeffs for _ in range(9)], dtype=np.int32) bilin_leftbasis = np.concatenate(bilin_leftbasis, axis=1) bilin_rightbasis = np.concatenate(bilin_rightbasis, axis=1) t_bilinear -= gpt.time() gpt.bilinear_combination(bilinear_result, lefts, rights, bilin_coeffs, bilin_leftbasis, bilin_rightbasis) t_bilinear += gpt.time() cmat_dict = dict() for ii in range(9): cmat_dict[ii // 3, ii % 3] = bilinear_result[ii] t_merge -= gpt.time() gpt.merge_color(spinsep_dst[spin_key], cmat_dict) t_merge += gpt.time() t_merge -= gpt.time() gpt.merge_spin(dst, spinsep_dst) t_merge += gpt.time() t_total = gpt.time() - t_start t_profiled = t_separatespin + t_separatecolor + t_create + t_bilinear + t_merge if gpt.default.is_verbose("quark_contract_xx"): gpt.message("quark_contract_xx: total", t_total, "s") gpt.message("quark_contract_xx: t_separatespin", t_separatespin, "s", round(100 * t_separatespin / t_total, 1), "%") gpt.message("quark_contract_xx: t_separatecolor", t_separatecolor, "s", round(100 * t_separatecolor / t_total, 1), "%") gpt.message("quark_contract_xx: t_create", t_create, "s", round(100 * t_create / t_total, 1), "%") gpt.message("quark_contract_xx: t_bilinear", t_bilinear, "s", round(100 * t_bilinear / t_total, 1), "%") gpt.message("quark_contract_xx: t_merge", t_merge, "s", round(100 * t_merge / t_total, 1), "%") gpt.message("quark_contract_xx: unprofiled", t_total - t_profiled, "s", round(100 * (t_total - t_profiled) / t_total, 1), "%") return dst
# import gpt as g import numpy as np import sys rng = g.random("test") vol = [16, 16, 16, 32] grid_rb = g.grid(vol, g.single, g.redblack) grid = g.grid(vol, g.single) field = g.vcolor Nlat = 12 ################################################################################ # Spin/Color separation ################################################################################ msc = g.mspincolor(grid_rb) rng.cnormal(msc) xs = g.separate_spin(msc) xc = g.separate_color(msc) for s1 in range(4): for s2 in range(4): eps = np.linalg.norm(msc[0, 0, 0, 0].array[s1, s2, :, :] - xs[s1, s2][0, 0, 0, 0].array) assert eps < 1e-13 for c1 in range(3): for c2 in range(3): eps = np.linalg.norm(msc[0, 0, 0, 0].array[:, :, c1, c2] - xc[c1, c2][0, 0, 0, 0].array)
def __init__(self, U, params): shift_eo.__init__(self, U, boundary_phases=params["boundary_phases"]) Nc = U[0].otype.Nc otype = g.ot_vector_spin_color(4, Nc) grid = U[0].grid grid_eo = grid.checkerboarded(g.redblack) self.F_grid = grid self.U_grid = grid self.F_grid_eo = grid_eo self.U_grid_eo = grid_eo self.vector_space_F = g.vector_space.explicit_grid_otype( self.F_grid, otype) self.vector_space_U = g.vector_space.explicit_grid_otype( self.U_grid, otype) self.vector_space_F_eo = g.vector_space.explicit_grid_otype( self.F_grid_eo, otype) self.src_e = g.vspincolor(grid_eo) self.src_o = g.vspincolor(grid_eo) self.dst_e = g.vspincolor(grid_eo) self.dst_o = g.vspincolor(grid_eo) self.dst_e.checkerboard(g.even) self.dst_o.checkerboard(g.odd) if params["kappa"] is not None: assert params["mass"] is None self.m0 = 1.0 / params["kappa"] / 2.0 - 4.0 else: self.m0 = params["mass"] self.xi_0 = params["xi_0"] self.csw_r = params["csw_r"] / self.xi_0 self.csw_t = params["csw_t"] self.nu = params["nu"] self.kappa = 1.0 / (2.0 * (self.m0 + 1.0 + 3.0 * self.nu / self.xi_0)) self.open_bc = params["boundary_phases"][self.nd - 1] == 0.0 if self.open_bc: assert all([ self.xi_0 == 1.0, self.nu == 1.0, self.csw_r == self.csw_t, "cF" in params, ]) # open bc only for isotropic case, require cF passed self.cF = params["cF"] T = self.L[self.nd - 1] # compute field strength tensor if self.csw_r != 0.0 or self.csw_t != 0.0: self.clover = g.mspincolor(grid) self.clover[:] = 0 I = g.identity(self.clover) for mu in range(self.nd): for nu in range(mu + 1, self.nd): if mu == (self.nd - 1) or nu == (self.nd - 1): cp = self.csw_t else: cp = self.csw_r self.clover += (-0.5 * cp * g.gamma[mu, nu] * I * g.qcd.gauge.field_strength(U, mu, nu)) if self.open_bc: # set field strength tensor to unity at the temporal boundaries value = -0.5 * self.csw_t self.clover[:, :, :, 0, :, :, :, :] = 0.0 self.clover[:, :, :, T - 1, :, :, :, :] = 0.0 for alpha in range(4): for a in range(Nc): self.clover[:, :, :, 0, alpha, alpha, a, a] = value self.clover[:, :, :, T - 1, alpha, alpha, a, a] = value if self.cF != 1.0: # add improvement coefficients next to temporal boundaries value = self.cF - 1.0 for alpha in range(4): for a in range(Nc): self.clover[:, :, :, 1, alpha, alpha, a, a] += value self.clover[:, :, :, T - 2, alpha, alpha, a, a] += value # integrate kappa into clover matrix for inversion self.clover += 1.0 / 2.0 * 1.0 / self.kappa * I self.clover_inv = g.matrix.inv(self.clover) self.clover_eo = { g.even: g.lattice(grid_eo, self.clover.otype), g.odd: g.lattice(grid_eo, self.clover.otype), } self.clover_inv_eo = { g.even: g.lattice(grid_eo, self.clover.otype), g.odd: g.lattice(grid_eo, self.clover.otype), } for cb in self.clover_eo: g.pick_checkerboard(cb, self.clover_eo[cb], self.clover) g.pick_checkerboard(cb, self.clover_inv_eo[cb], self.clover_inv) else: self.clover = None self.clover_inv = None self.Meooe = g.matrix_operator( mat=lambda dst, src: self._Meooe(dst, src), vector_space=self.vector_space_F_eo, ) self.Mooee = g.matrix_operator( mat=lambda dst, src: self._Mooee(dst, src), inv_mat=lambda dst, src: self._MooeeInv(dst, src), vector_space=self.vector_space_F_eo, ) self.Dhop = g.matrix_operator( mat=lambda dst, src: self._Dhop(dst, src), vector_space=self.vector_space_F) matrix_operator.__init__(self, lambda dst, src: self._M(dst, src), vector_space=self.vector_space_F) self.G5M = g.matrix_operator(lambda dst, src: self._G5M(dst, src), vector_space=self.vector_space_F) self.Mdiag = g.matrix_operator(lambda dst, src: self._Mdiag(dst, src), vector_space=self.vector_space_F) self.ImportPhysicalFermionSource = g.matrix_operator( lambda dst, src: g.copy(dst, src), vector_space=self.vector_space_F) self.ExportPhysicalFermionSolution = g.matrix_operator( lambda dst, src: g.copy(dst, src), vector_space=self.vector_space_F) self.ExportPhysicalFermionSource = g.matrix_operator( lambda dst, src: g.copy(dst, src), vector_space=self.vector_space_F) self.Dminus = g.matrix_operator(lambda dst, src: g.copy(dst, src), vector_space=self.vector_space_F)
eps = g.norm2(ref - val) g.message("Reference value test (arbitrary momentum with origin): ", eps) assert eps < 1e-25 ################################################################################ # Test slice sums ################################################################################ for lattice_object in [ g.complex(grid_dp), g.vcomplex(grid_dp, 10), g.vspin(grid_dp), g.vcolor(grid_dp), g.vspincolor(grid_dp), g.mspin(grid_dp), g.mcolor(grid_dp), g.mspincolor(grid_dp), ]: g.message(f"Testing slice with random {lattice_object.describe()}") obj_list = [g.copy(lattice_object) for _ in range(3)] rng.cnormal(obj_list) for dimension in range(4): tmp = g.slice(obj_list, dimension) full_sliced = np.array([[g.util.tensor_to_value(v) for v in obj] for obj in tmp]) for n, obj in enumerate(obj_list): tmp = g.slice(obj, dimension) sliced = np.array([g.util.tensor_to_value(v) for v in tmp]) assert np.allclose(full_sliced[n], sliced, atol=0.0, rtol=1e-13)
w(dst, src) t2 = g.time() for i in range(100): dst = w(src) t3 = g.time() for i in range(100): dst @= w * src t4 = g.time() g.message("Reference time/s: ", t1 - t0) g.message("Grid time/s (reuse lattices): ", t2 - t1) g.message("Grid time/s (with temporaries): ", t3 - t2) g.message("Grid time/s (with expressions): ", t4 - t3) # create point source src = g.mspincolor(grid) g.create.point( src, [1, 0, 0, 0 ]) # pick point 1 so that "S" in preconditioner contributes to test # build solver using g5m and cg inv = g.algorithms.inverter pc = g.qcd.fermion.preconditioner cg = inv.cg({"eps": 1e-6, "maxiter": 1000}) slv = w.propagator(inv.preconditioned(pc.g5m_ne(), cg)) slv_eo1 = w.propagator(inv.preconditioned(pc.eo1_ne(), cg)) slv_eo2 = w.propagator(inv.preconditioned(pc.eo2_ne(), cg)) # propagator dst_eo1 = g.mspincolor(grid)
0.3368765581549033 + 1j * (0), 0.7305711010541054 + 1j * (0), 1.1686138337986505 + 1j * (0.3506492418109086), 1.1686138337986505 + 1j * (-0.3506492418109086), 0.994175013717952 + 1j * (0), 0.5029903152251229 + 1j * (0), 0.23027432016909377 + 1j * (0.03530801572584271), 0.17661651536320583 + 1j * (-0.14907774771612217), ], "boundary_phases": [1.0, 1.0, 1.0, 1.0], }, ) # create point source src = g.mspincolor(grid) g.create.point(src, [0, 1, 0, 0]) # solver pc = g.qcd.fermion.preconditioner inv = g.algorithms.inverter cg = inv.cg({"eps": 1e-5, "maxiter": 1000}) cg_e = inv.cg({"eps": 1e-6, "maxiter": 1000}) slv_5d = inv.preconditioned(pc.eo2_ne(), cg) slv_5d_e = inv.preconditioned(pc.eo2_ne(), cg_e) slv_qm = qm.propagator(slv_5d) slv_qm_e = qm.propagator(slv_5d_e) slv_qz = qz.propagator(slv_5d) slv_madwf = qm.propagator(pc.mixed_dwf(slv_5d, slv_5d, qz)) slv_madwf_dc = qm.propagator(
def point(src, pos): src[:] = 0 src[tuple(pos)] = gpt.mspincolor( np.multiply.outer(np.identity(4), np.identity(3)))
G_src = operators[op_src] corr = g.slice( g.trace(G_src * g.gamma[5] * g.adj(prop) * g.gamma[5] * G_snk * prop), 3 ) corr = corr[t0:] + corr[:t0] corr_tag = "%s/snk%s-src%s" % (prop_tag, op_snk, op_src) output_correlator.write(corr_tag, corr) g.message("Correlator %s\n" % corr_tag, corr) # calculate correlators for exact positions for pos in source_positions_exact: # exact_sloppy src = g.mspincolor(l_sloppy.U_grid) g.create.point(src, pos) contract(pos, g.eval(prop_l_sloppy * src), "sloppy") # exact src = g.mspincolor(l_exact.U_grid) g.create.point(src, pos) contract(pos, g.eval(prop_l_exact * src), "exact") # calculate correlators for sloppy positions for pos in source_positions_sloppy: # sloppy src = g.mspincolor(l_sloppy.U_grid) g.create.point(src, pos) contract(pos, g.eval(prop_l_sloppy * src), "sloppy")
#!/usr/bin/env python3 # # Authors: Christoph Lehner 2020 # import gpt as g import numpy as np # test sources rng = g.random("test") L = [8, 8, 8, 16] grid = g.grid(L, g.double) c = g.create src = g.mspincolor(grid) c.wall.z2(src, 1, rng) g.message("Test Z2 wall") # simple test of correct norm x_val = g.sum(g.trace(src * src)) x_exp = L[0] * L[1] * L[2] * 12 eps = abs(x_val - x_exp) / abs(x_val) g.message(f"Norm test: {eps}") assert eps < 1e-13 # test wall test1 = rng.cnormal(g.mspincolor(grid), mu=1.0, sigma=1.0) test2 = rng.cnormal(g.mspincolor(grid), mu=1.0, sigma=1.0) x_val = g.sum(g.trace(src * test1 * src * test2)) tmp1 = g.lattice(test1) tmp1[:] = 0 tmp1[:, :, :, 1] = test1[:, :, :, 1]
for i in range(params["APE"]["APE_iter"]): U_ape = g.qcd.gauge.smear.ape(U_ape, params_link_smear) g.message("Done APE-link smearing.") def sanity_check(dst, measurement): g.message(f"sanity check {measurement}") correlator = g.slice(g.eval(g.trace(g.adj(dst) * dst)), 3) for t, c in enumerate(correlator): g.message(t, c) # create point source src_pos = params["source_position"] g.message(f"Creating point source in {src_pos}...") src = g.mspincolor(grid) g.create.point(src, src_pos) g.message("Done creating point source.") sanity_check(src, f"point_src") # smear point source params_quark_src_smear = params["wuppertal_smear_source"] smear = g.create.smear.wuppertal(U_ape, params_quark_src_smear) g.message("Start Wuppertal smearing to the source...") src_smeared = g(smear * src) g.message("Done Wuppertal smearing.") sanity_check(src_smeared, f"shell_src") del src # build solver using g5m and cg inv = g.algorithms.inverter