Tutorial: Custom Physics Model Definition
In this tutorial, we define a custom physics model by implementing the AbstractModelDefinition interface from QEDbase.
First we need particle definitions from the particles tutorial:
    include(joinpath(dirname(Base.active_project()), "src", "tutorial", "particle.jl"))    # to get predefined particles
struct CustomModel <: AbstractModelDefinition endThe fundamental interaction must be defined by a symbol:
QEDbase.fundamental_interaction_type(::CustomModel) = :electromagneticNext, we define the incoming and outgoing phase space dimensions:
function QEDbase.in_phase_space_dimension(proc::AbstractProcessDefinition, ::CustomModel)
    return 3 * number_incoming_particles(proc) - 4 - 1
end
function QEDbase.out_phase_space_dimension(proc::AbstractProcessDefinition, ::CustomModel)
    return 3 * number_outgoing_particles(proc) - 4
endThe isphysical function should return whether the given process is physical in this model. For the electromagnetic interaction this means the fermion and anti-fermions need to match up.
function isphysical(proc::AbstractProcessDefinition, ::CustomModel)
    return (
        number_particles(proc, Incoming(), Muon()) +
            number_particles(proc, Outgoing(), AntiMuon()) ==
            number_particles(proc, Incoming(), AntiMuon()) +
            number_particles(proc, Outgoing(), Muon())
    ) && number_particles(proc, Incoming()) + number_particles(proc, Outgoing()) >= 2
endisphysical (generic function with 1 method)This page was generated using Literate.jl.