Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Test ci remove psdef #153

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/BuildDeployDoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
statuses: write
runs-on: ubuntu-latest
steps:
- uses: QEDjl-project/gh-actions/build-docs@v1
- uses: SimeonEhrig/gh-actions/build-docs@setSetupDevDevType
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ generate_pipeline:
image: julia:1.10
stage: generate
variables:
CI_GIT_CI_TOOLS_URL: https://github.com/QEDjl-project/QuantumElectrodynamics.jl.git
CI_GIT_CI_TOOLS_BRANCH: dev
CI_GIT_CI_TOOLS_URL: https://github.com/SimeonEhrig/QED.jl.git
CI_GIT_CI_TOOLS_BRANCH: printCustonIntegURL
CI_ENABLE_CUDA_TESTS: "ON"
CI_ENABLE_AMDGPU_TESTS: "ON"
script:
Expand Down
2 changes: 0 additions & 2 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
DocumenterTools = "35a29f4d-8980-5a13-9543-d66fff28ecb8"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
QEDbase = "10e22c08-3ccb-4172-bfcf-7d7aa3d04d93"
QEDcore = "35dc0263-cb5f-4c33-a114-1d7f54ab753e"
QEDprocesses = "46de9c38-1bb3-4547-a1ec-da24d767fdad"
37 changes: 20 additions & 17 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ using DocumenterInterLinks
using DocumenterCitations

using QEDbase
using QEDcore
using QEDprocesses

bib = CitationBibliography(joinpath(@__DIR__, "Bibliography.bib"))

# some paths for links
readme_path = joinpath(project_path, "README.md")
Expand All @@ -35,14 +31,19 @@ open(readme_path, "r") do readme_in
end

# setup interlinks
links = InterLinks("QEDcore" => "https://qedjl-project.github.io/QEDcore.jl/dev/")
links = InterLinks(
"QEDcore" => "https://qedjl-project.github.io/QEDcore.jl/dev/",
"QEDprocesses" => "https://qedjl-project.github.io/QEDprocesses.jl/dev/",
)

# setup Bibliography
bib = CitationBibliography(joinpath(@__DIR__, "Bibliography.bib"))
bib = CitationBibliography(joinpath(dirname(Base.active_project()), "Bibliography.bib"))

# setup examples using Literate.jl
literate_paths = [
Base.Filesystem.joinpath(project_path, "docs/src/tutorial/four_momentum.jl"),
Base.Filesystem.joinpath(project_path, "docs/src/tutorial/lorentz_vectors.jl"),
Base.Filesystem.joinpath(project_path, "docs/src/tutorial/model.jl"),
Base.Filesystem.joinpath(project_path, "docs/src/tutorial/particle.jl"),
Base.Filesystem.joinpath(project_path, "docs/src/tutorial/particle_stateful.jl"),
Base.Filesystem.joinpath(project_path, "docs/src/tutorial/process.jl"),
Expand All @@ -56,26 +57,28 @@ tutorial_output_dir_name = splitpath(tutorial_output_dir)[end]

pages = [
"Home" => "index.md",
"Phase Space Points" => "phase_space_point.md",
"Tutorials" => [
#"Dirac Tensors" => "dirac_tensors.md",
"Four Momentum" => joinpath(tutorial_output_dir_name, "four_momentum.md"),
"Lorentz Vectors" => joinpath(tutorial_output_dir_name, "lorentz_vectors.md"),
"Particles" => joinpath(tutorial_output_dir_name, "particle.md"),
"Stateful Particles" =>
joinpath(tutorial_output_dir_name, "particle_stateful.md"),
"Physics Model" => joinpath(tutorial_output_dir_name, "model.md"),
"Scattering Process" => joinpath(tutorial_output_dir_name, "process.md"),
"Phase Space Points" =>
joinpath(tutorial_output_dir_name, "phase_space_point.md"),
],
"API reference" => [
"Contents" => "library/outline.md",
"Lorentz vectors" => "library/lorentz_vector.md",
"Dirac tensors" => "library/dirac_objects.md",
"Particles" => "library/particles.md",
"Scattering process" => "library/process.md",
"Phase space layout" => "library/phase_space_layout.md",
"Phase space description" => "library/phase_space.md",
"Probability and cross section" => "library/cross_section.md",
"Function index" => "library/function_index.md",
"Contents" => joinpath("library", "outline.md"),
"Lorentz vectors" => joinpath("library", "lorentz_vector.md"),
"Dirac tensors" => joinpath("library", "dirac_objects.md"),
"Particles" => joinpath("library", "particles.md"),
"Scattering process" => joinpath("library", "process.md"),
"Phase space layout" => joinpath("library", "phase_space_layout.md"),
"Phase space description" => joinpath("library", "phase_space.md"),
"Probability and cross section" => joinpath("library", "cross_section.md"),
"Function index" => joinpath("library", "function_index.md"),
],
"refs.md",
]
Expand All @@ -86,7 +89,7 @@ try
Literate.markdown(file, tutorial_output_dir; documenter=true)
end

# geneate docs with Documenter.jl
# generate docs with Documenter.jl
makedocs(;
modules=[QEDbase],
checkdocs=:exports,
Expand Down
10 changes: 1 addition & 9 deletions docs/src/library/phase_space.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# Phase Space Description

## Frames and Coordinate Systems

```@docs
AbstractCoordinateSystem
AbstractFrameOfReference
AbstractPhasespaceDefinition
```

## Stateful Particles

```@docs
Expand All @@ -30,7 +22,7 @@ AbstractOutPhaseSpacePoint
```@docs
process
model
phase_space_definition
phase_space_layout
```

### Convenience Functions
Expand Down
10 changes: 2 additions & 8 deletions docs/src/phase_space_point.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,5 @@ For any given process, we need a way to:
number and type of particles, momentum conservation).
- Access the momenta of individual particles or compute derived quantities.

In [this tutorial], we show how to create and use an `ExamplePhaseSpacePoint`,
following the interface specification given by [`AbstractPhaseSpacePoint']. We'll be using
particles and momenta from libraries like `QEDcore` and `QEDprocesses`, focusing on the
electron-positron annihilation process.

## Reference implementation

TBW
In [this tutorial](@ref tutorial_psp), we show how to create and use an `ExamplePhaseSpacePoint`,
following the interface specification given by [`AbstractPhaseSpacePoint`](@ref).
40 changes: 40 additions & 0 deletions docs/src/tutorial/four_momentum.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# # Tutorial: Custom Four Momentum Vector
#
# This tutorial explains how to define a custom [`AbstractFourMomentum`](@ref) type that
# can be used to represent, for example, particle momenta in an [`AbstractParticleStateful`](@ref).
#
# ## Defining a Custom Four Momentum Type
#
# The `FourMomentum` interface in `QEDbase.jl` is designed to be extendable. By implementing
# a simple API, you can make any custom type behave like a Lorentz vector and unlock access
# to various kinematic functions in the package.

# ### Step 1: Define Your Custom Type
#
# To define a valid `AbstractFourMomentum` type, create a type with the fields `.E`, `.px`, `.py` and `.pz`.
using QEDbase

struct CustomFourMomentum <: AbstractFourMomentum
E::Float64 # energy component
px::Float64 # x component
py::Float64 # y component
pz::Float64 # z component
end

# ### Step 2: Add the necessary accessor functions

QEDbase.getT(p::CustomFourMomentum) = p.E
QEDbase.getX(p::CustomFourMomentum) = p.px
QEDbase.getY(p::CustomFourMomentum) = p.py
QEDbase.getZ(p::CustomFourMomentum) = p.pz

# ### Step 3: Register the type as a LorentzVectorLike

register_LorentzVectorLike(CustomFourMomentum)

# A mutable version can also be implemented by also defining the interface functions `setT!`, `setX!`, `setY!`, and `setZ!`.

# Example Usage:

mom = CustomFourMomentum(1.0, 0.0, 0.0, 1.0)
println("Defined momentum $mom is on shell: $(isonshell(mom))")
38 changes: 38 additions & 0 deletions docs/src/tutorial/model.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# # Tutorial: Custom Physics Model Definition

# In this tutorial, we define a custom physics model by implementing the [`AbstractModelDefinition`](@ref)
# interface from QEDbase.

# First we need particle definitions from the particles tutorial:

redirect_stdout(devnull) do # hide
include(joinpath(dirname(Base.active_project()), "src", "tutorial", "particle.jl")) # to get predefined particles
end # hide

struct CustomModel <: AbstractModelDefinition end

# The fundamental interaction must be defined by a symbol:

QEDbase.fundamental_interaction_type(::CustomModel) = :electromagnetic

# Next, 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
end

# The [`isphysical`](@extref QEDprocesses.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
end
24 changes: 12 additions & 12 deletions docs/src/tutorial/particle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ struct Muon <: AbstractParticleType end

# Since Muon is a subtype of AbstractParticleType, it is a singleton (no stateful properties).
# Implementing static functions for particle classification
is_fermion(::Muon) = true # Muon is a fermion
is_boson(::Muon) = false # Muon is not a boson
is_particle(::Muon) = true # Muon is a particle (not an anti-particle)
is_anti_particle(::Muon) = false # Muon is not an anti-particle
QEDbase.is_fermion(::Muon) = true # Muon is a fermion
QEDbase.is_boson(::Muon) = false # Muon is not a boson
QEDbase.is_particle(::Muon) = true # Muon is a particle (not an anti-particle)
QEDbase.is_anti_particle(::Muon) = false # Muon is not an anti-particle

# ## Define Physical Properties
#
# Next, we need to define the required property functions for `mass` and `charge`.
# These functions return the mass and charge of the `Muon`.

# Define the physical properties of the Muon
mass(::Muon) = 105.66 # Muon mass in MeV/c^2
charge(::Muon) = -1.0 # Muon has a charge of -1 (same as electron)
QEDbase.mass(::Muon) = 105.66 # Muon mass in MeV/c^2
QEDbase.charge(::Muon) = -1.0 # Muon has a charge of -1 (same as electron)

# ## Anti-Particle Implementation (Optional)
#
Expand All @@ -42,14 +42,14 @@ charge(::Muon) = -1.0 # Muon has a charge of -1 (same as electron)
struct AntiMuon <: AbstractParticleType end

# Implement static functions for the AntiMuon
is_fermion(::AntiMuon) = true # AntiMuon is also a fermion
is_boson(::AntiMuon) = false # AntiMuon is not a boson
is_particle(::AntiMuon) = false # AntiMuon is not a regular particle (it's an anti-particle)
is_anti_particle(::AntiMuon) = true # AntiMuon is an anti-particle
QEDbase.is_fermion(::AntiMuon) = true # AntiMuon is also a fermion
QEDbase.is_boson(::AntiMuon) = false # AntiMuon is not a boson
QEDbase.is_particle(::AntiMuon) = false # AntiMuon is not a regular particle (it's an anti-particle)
QEDbase.is_anti_particle(::AntiMuon) = true # AntiMuon is an anti-particle

# Define the physical properties for the AntiMuon
mass(::AntiMuon) = 105.66 # AntiMuon has the same mass as Muon
charge(::AntiMuon) = 1.0 # AntiMuon has the opposite charge of Muon
QEDbase.mass(::AntiMuon) = 105.66 # AntiMuon has the same mass as Muon
QEDbase.charge(::AntiMuon) = 1.0 # AntiMuon has the opposite charge of Muon

# ## Example Usage
#
Expand Down
37 changes: 22 additions & 15 deletions docs/src/tutorial/particle_stateful.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,47 +39,54 @@ end
# These functions extract the respective properties from the `ExampleParticleStateful` object.

# Define the particle_direction function
function particle_direction(part::ExampleParticleStateful)
function QEDbase.particle_direction(part::ExampleParticleStateful)
return part.direction
end

# Define the particle_species function
function particle_species(part::ExampleParticleStateful)
function QEDbase.particle_species(part::ExampleParticleStateful)
return part.species
end

# Define the momentum function
function momentum(part::ExampleParticleStateful)
function QEDbase.momentum(part::ExampleParticleStateful)
return part.mom
end

# ## Example Usage
#
# We can now create instances of `ExampleParticleStateful` for, say, `Electron` and `Positron`.
using QEDcore # to get predefined particles and four-momentum
# We can now create instances of `ExampleParticleStateful` for, say, `Muon` and `AntiMuon`.

redirect_stdout(devnull) do # hide
include(joinpath(dirname(Base.active_project()), "src", "tutorial", "particle.jl")) # to get predefined particles
include(joinpath(dirname(Base.active_project()), "src", "tutorial", "four_momentum.jl")) # to get custom four momentum vector
end # hide

# Create a four-momentum vector (dummy example)
momentum_electron = SFourMomentum(1.0, 0.0, 0.0, 0.0); # E, px, py, pz
momentum_muon = CustomFourMomentum(1.0, 0.0, 0.0, 0.0); # E, px, py, pz

# Create an incoming Electron using ExampleParticleStateful
incoming_electron = ExampleParticleStateful(Incoming(), Electron(), momentum_electron);
# Create an incoming Muon using ExampleParticleStateful
incoming_muon = ExampleParticleStateful(Incoming(), Muon(), momentum_muon);

# Create an outgoing Positron using ExampleParticleStateful
outgoing_positron = ExampleParticleStateful(Outgoing(), Positron(), momentum_electron);
# Create an outgoing AntiMuon using ExampleParticleStateful
outgoing_antimuon = ExampleParticleStateful(Outgoing(), AntiMuon(), momentum_muon);

# Access particle properties
println("Incoming electron mass: ", mass(particle_species(incoming_electron)))
println("Incoming muon mass: ", mass(particle_species(incoming_muon)))
println(
"Is the outgoing positron a fermion? ", is_fermion(particle_species(outgoing_positron))
"Is the outgoing antimuon a fermion? ", is_fermion(particle_species(outgoing_antimuon))
)

# Access momentum
println("Incoming electron momentum: ", momentum(incoming_electron))
println("Outgoing positron momentum: ", momentum(outgoing_positron))
println("Incoming muon momentum: ", momentum(incoming_muon))
println("Outgoing antimuon momentum: ", momentum(outgoing_antimuon))

# ## Summary
#
# In this tutorial, we created a general `ExampleParticleStateful` type that can represent any particle species (like `Electron`,`Positron` from `QEDcore`, but also `Muon` or `AntiMuon` implemented in [this tutorial](@ref tutorial_particle)) by using the species as a type parameter. This approach avoids the need to define separate stateful types for each particle, making the implementation more flexible and reusable.
# In this tutorial, we created a general `ExampleParticleStateful` type that can represent any particle species
# (like `Muon` or `AntiMuon` implemented in [this tutorial](@ref tutorial_particle), but also [`Electron`](@extref QEDcore.Electron) and
# [`Positron`](@extref QEDcore.Positron) from `QEDcore`) by using the species as a type parameter. This approach avoids the need to define
# separate stateful types for each particle, making the implementation more flexible and reusable.
#
# The key steps were:
#
Expand Down
Loading
Loading