示例#1
0
    def __init__(self, name, U, params, Ls=None):
        self.name = name
        self.U = U
        self.U_grid = U[0].grid
        self.U_grid_eo = gpt.grid(self.U_grid.gdimensions,
                                  self.U_grid.precision, gpt.redblack)
        if Ls is None:
            self.F_grid = self.U_grid
            self.F_grid_eo = self.U_grid_eo
        else:
            self.F_grid = gpt.grid([Ls] + self.U_grid.gdimensions,
                                   self.U_grid.precision)
            self.F_grid_eo = gpt.grid(self.F_grid.gdimensions,
                                      self.U_grid.precision, gpt.redblack)

        self.params = {
            "U_grid": self.U_grid.obj,
            "U_grid_rb": self.U_grid_eo.obj,
            "F_grid": self.F_grid.obj,
            "F_grid_rb": self.F_grid_eo.obj,
            "U": [u.v_obj[0] for u in self.U]
        }

        for k in params:
            assert (not k
                    in ["U_grid", "U_grid_rb", "F_grid", "F_grid_rb", "U"])
            self.params[k] = params[k]

        self.obj = cgpt.create_fermion_operator(name, self.U_grid.precision,
                                                self.params)

        # register matrix operations
        gpt.qcd.fermion.register(self)
示例#2
0
    def __init__(self, name, U, params, otype=None):
        super().__init__(name, U, params, otype, False)

        self.obj = []
        for i in range(len(U[0].v_obj)):
            self.params["U"] = [a.v_obj[i] for a in self.U]
            self.obj.append(
                cgpt.create_fermion_operator(
                    self.name, self.U_grid.precision, self.params
                )
            )
示例#3
0
    def __init__(self, name, U, params, otype=None):
        super().__init__(name, U, params, otype, True)
        self.tmp = gpt.lattice(self.F_grid, otype)
        self.tmp_eo = gpt.lattice(self.F_grid_eo, otype)
        self.U_self_inv = gpt.matrix.inv(self.U[8])

        self.obj = []
        for i in range(len(U[0].v_obj)):
            self.params["U"] = [a.v_obj[i] for a in self.U]
            self.params["U_self_inv"] = self.U_self_inv.v_obj[i]
            self.params["dag_factor"] = gpt.coarse.prefactor_dagger(
                self.U[8], i)
            self.obj.append(
                cgpt.create_fermion_operator(self.name, self.U_grid.precision,
                                             self.params))
示例#4
0
文件: operator.py 项目: wettig/gpt
    def __init__(self, name, U, params, otype=None):
        super().__init__(name, U, params, otype, True)

        self.obj = cgpt.create_fermion_operator(name, self.U_grid.precision,
                                                self.params)
示例#5
0
    def __init__(self, name, U, params, Ls=None, otype=None):

        # keep constructor parameters
        self.name = name
        self.U = U
        self.params_constructor = params
        self.Ls = Ls

        # derived objects
        self.U_grid = U[0].grid
        self.U_grid_eo = gpt.grid(
            self.U_grid.gdimensions,
            self.U_grid.precision,
            gpt.redblack,
            parent=self.U_grid.parent,
            mpi=self.U_grid.mpi,
        )
        if Ls is None:
            self.F_grid = self.U_grid
            self.F_grid_eo = self.U_grid_eo
        else:
            self.F_grid = self.U_grid.inserted_dimension(0, Ls)
            self.F_grid_eo = gpt.grid(
                self.F_grid.gdimensions,
                self.U_grid.precision,
                gpt.redblack,
                parent=self.F_grid.parent,
                mpi=self.F_grid.mpi,
            )

        # parameter for create_fermion_operator
        self.params = {
            "U_grid": self.U_grid.obj,
            "U_grid_rb": self.U_grid_eo.obj,
            "F_grid": self.F_grid.obj,
            "F_grid_rb": self.F_grid_eo.obj,
            "U": [u.v_obj[0] for u in self.U],
        }

        for k in params:
            assert k not in ["U_grid", "U_grid_rb", "F_grid", "F_grid_rb", "U"]
            self.params[k] = params[k]

        # create fermion operator
        self.obj = cgpt.create_fermion_operator(
            name, self.U_grid.precision, self.params
        )

        # register matrix operators
        class registry:
            pass

        gpt.qcd.fermion.register(registry, self)

        # map Grid matrix operations to clean matrix_operator structure
        super().__init__(
            mat=registry.M, adj_mat=registry.Mdag, otype=otype, grid=self.F_grid
        )
        self.Meooe = gpt.matrix_operator(
            mat=registry.Meooe,
            adj_mat=registry.MeooeDag,
            otype=otype,
            grid=self.F_grid_eo,
        )
        self.Mooee = gpt.matrix_operator(
            mat=registry.Mooee,
            adj_mat=registry.MooeeDag,
            inv_mat=registry.MooeeInv,
            adj_inv_mat=registry.MooeeInvDag,
            otype=otype,
            grid=self.F_grid_eo,
        )
        self.Mdiag = gpt.matrix_operator(registry.Mdiag, otype=otype, grid=self.F_grid)
        self.Dminus = gpt.matrix_operator(
            mat=registry.Dminus,
            adj_mat=registry.DminusDag,
            otype=otype,
            grid=self.F_grid,
        )
        self.ImportPhysicalFermionSource = gpt.matrix_operator(
            registry.ImportPhysicalFermionSource,
            otype=otype,
            grid=(self.F_grid, self.U_grid),
        )
        self.ImportUnphysicalFermion = gpt.matrix_operator(
            registry.ImportUnphysicalFermion,
            otype=otype,
            grid=(self.F_grid, self.U_grid),
        )
        self.ExportPhysicalFermionSolution = gpt.matrix_operator(
            registry.ExportPhysicalFermionSolution,
            otype=otype,
            grid=(self.U_grid, self.F_grid),
        )
        self.ExportPhysicalFermionSource = gpt.matrix_operator(
            registry.ExportPhysicalFermionSource,
            otype=otype,
            grid=(self.U_grid, self.F_grid),
        )
        self.G5M = gpt.matrix_operator(
            lambda dst, src: self._G5M(dst, src), otype=otype, grid=self.F_grid
        )
示例#6
0
 def setup(self, name, grid, params):
     self.obj = cgpt.create_fermion_operator(name, grid.precision, params)