diff --git a/src/particles/particle_types.jl b/src/particles/particle_types.jl index 2ef3c72..be51684 100644 --- a/src/particles/particle_types.jl +++ b/src/particles/particle_types.jl @@ -81,7 +81,7 @@ is_anti_particle(::MajoranaFermion) = true Concrete type for *electrons* as a particle species. Mostly used for dispatch. ```jldoctest -julia> using QEDbase +julia> using QEDcore julia> Electron() electron @@ -104,7 +104,7 @@ Base.show(io::IO, ::Electron) = print(io, "electron") Concrete type for *positrons* as a particle species. Mostly used for dispatch. ```jldoctest -julia> using QEDbase +julia> using QEDcore julia> Positron() positron @@ -182,7 +182,7 @@ is_anti_particle(::MajoranaBoson) = true Concrete type for the *photons* as a particle species. Mostly used for dispatch. ```jldoctest -julia> using QEDbase +julia> using QEDcore julia> Photon() photon diff --git a/src/particles/propagators.jl b/src/particles/propagators.jl index 4d5da68..1b69de5 100644 --- a/src/particles/propagators.jl +++ b/src/particles/propagators.jl @@ -16,18 +16,14 @@ function _fermion_propagator(P::QEDbase.AbstractFourMomentum) return (slashed(P)) * _scalar_propagator(P) end -function QEDbase.propagator( - particle_type::QEDbase.BosonLike, K::QEDbase.AbstractFourMomentum -) +function QEDbase.propagator(particle_type::BosonLike, K::QEDbase.AbstractFourMomentum) return _scalar_propagator(K, QEDbase.mass(particle_type)) end -function QEDbase.propagator(particle_type::QEDbase.Photon, K::QEDbase.AbstractFourMomentum) +function QEDbase.propagator(particle_type::Photon, K::QEDbase.AbstractFourMomentum) return _scalar_propagator(K) end -function QEDbase.propagator( - particle_type::QEDbase.FermionLike, P::QEDbase.AbstractFourMomentum -) +function QEDbase.propagator(particle_type::FermionLike, P::QEDbase.AbstractFourMomentum) return _fermion_propagator(P, QEDbase.mass(particle_type)) end diff --git a/src/phase_spaces/types.jl b/src/phase_spaces/types.jl index 255c5ca..610b80e 100644 --- a/src/phase_spaces/types.jl +++ b/src/phase_spaces/types.jl @@ -20,7 +20,7 @@ end Representation of a particle with a state. It has four fields: - `dir::QEDbase.ParticleDirection`: The direction of the particle, `QEDbase.Incoming()` or `QEDbase.Outgoing()`. -- `species::QEDbase.AbstractParticleType`: The species of the particle, `QEDbase.Electron()`, `QEDbase.Positron()` etc. +- `species::QEDbase.AbstractParticleType`: The species of the particle, `Electron()`, `Positron()` etc. - `mom::QEDbase.AbstractFourMomentum`: The momentum of the particle. Overloads for [`is_fermion`](@ref), [`is_boson`](@ref), [`is_particle`](@ref), [`is_anti_particle`](@ref), [`is_incoming`](@ref), [`is_outgoing`](@ref), [`mass`](@ref), and [`charge`](@ref) are provided, delegating the call to the correct field and thus implementing the [`QEDbase.AbstractParticle`](@ref) interface. @@ -28,11 +28,11 @@ Overloads for [`is_fermion`](@ref), [`is_boson`](@ref), [`is_particle`](@ref), [ ```jldoctest julia> import QEDbase; using QEDprocesses -julia> ParticleStateful(QEDbase.Incoming(), QEDbase.Electron(), SFourMomentum(1, 0, 0, 0)) +julia> ParticleStateful(QEDbase.Incoming(), Electron(), SFourMomentum(1, 0, 0, 0)) ParticleStateful: incoming electron momentum: [1.0, 0.0, 0.0, 0.0] -julia> ParticleStateful(QEDbase.Outgoing(), QEDbase.Photon(), SFourMomentum(1, 0, 0, 0)) +julia> ParticleStateful(QEDbase.Outgoing(), Photon(), SFourMomentum(1, 0, 0, 0)) ParticleStateful: outgoing photon momentum: [1.0, 0.0, 0.0, 0.0] ``` @@ -72,12 +72,12 @@ julia> PhaseSpacePoint( PerturbativeQED(), PhasespaceDefinition(SphericalCoordinateSystem(), ElectronRestFrame()), ( - ParticleStateful(QEDbase.Incoming(), QEDbase.Electron(), SFourMomentum(1, 0, 0, 0)), - ParticleStateful(QEDbase.Incoming(), QEDbase.Photon(), SFourMomentum(1, 0, 0, 0)) + ParticleStateful(QEDbase.Incoming(), Electron(), SFourMomentum(1, 0, 0, 0)), + ParticleStateful(QEDbase.Incoming(), Photon(), SFourMomentum(1, 0, 0, 0)) ), ( - ParticleStateful(QEDbase.Outgoing(), QEDbase.Electron(), SFourMomentum(1, 0, 0, 0)), - ParticleStateful(QEDbase.Outgoing(), QEDbase.Photon(), SFourMomentum(1, 0, 0, 0)) + ParticleStateful(QEDbase.Outgoing(), Electron(), SFourMomentum(1, 0, 0, 0)), + ParticleStateful(QEDbase.Outgoing(), Photon(), SFourMomentum(1, 0, 0, 0)) ) ) PhaseSpacePoint: diff --git a/src/phase_spaces/utility.jl b/src/phase_spaces/utility.jl index 2c8a6c2..8d0eea5 100644 --- a/src/phase_spaces/utility.jl +++ b/src/phase_spaces/utility.jl @@ -22,7 +22,11 @@ end ::Tuple{Vararg{QEDbase.AbstractParticleType,M}}, dir::QEDbase.ParticleDirection, ) where {N,M} - throw(InvalidInputError("expected $(M) $(dir) particles for the process but got $(N)")) + throw( + QEDbase.InvalidInputError( + "expected $(M) $(dir) particles for the process but got $(N)" + ), + ) return nothing end @@ -39,7 +43,7 @@ end SPECIES_T<:QEDbase.AbstractParticleType, } throw( - InvalidInputError( + QEDbase.InvalidInputError( "expected $(dir) $(SPECIES_T()) but got $(DIR_IN_T()) $(SPECIES_IN_T())" ), ) @@ -132,7 +136,7 @@ function _build_particle_statefuls( dir::QEDbase.ParticleDirection, ) where {N,ELEMENT<:QEDbase.AbstractFourMomentum} N == QEDbase.number_particles(proc, dir) || throw( - InvalidInputError( + QEDbase.InvalidInputError( "expected $(QEDbase.number_particles(proc, dir)) $(dir) particles for the process but got $(N)", ), ) diff --git a/test/phase_spaces.jl b/test/phase_spaces.jl index 2c2b3ae..3716386 100644 --- a/test/phase_spaces.jl +++ b/test/phase_spaces.jl @@ -20,7 +20,7 @@ end @testset "Stateful Particle" begin DIRECTIONS = [QEDbase.Incoming(), QEDbase.Outgoing()] - SPECIES = [QEDbase.Electron(), QEDbase.Positron()] #=, Muon(), AntiMuon(), Tauon(), AntiTauon()=# + SPECIES = [Electron(), Positron()] #=, Muon(), AntiMuon(), Tauon(), AntiTauon()=# for (species, dir) in Iterators.product(SPECIES, DIRECTIONS) mom = rand(RNG, SFourMomentum) @@ -62,10 +62,10 @@ end out_el_mom = rand(RNG, SFourMomentum) out_ph_mom = rand(RNG, SFourMomentum) - in_el = ParticleStateful(QEDbase.Incoming(), QEDbase.Electron(), in_el_mom) - in_ph = ParticleStateful(QEDbase.Incoming(), QEDbase.Photon(), in_ph_mom) - out_el = ParticleStateful(QEDbase.Outgoing(), QEDbase.Electron(), out_el_mom) - out_ph = ParticleStateful(QEDbase.Outgoing(), QEDbase.Photon(), out_ph_mom) + in_el = ParticleStateful(QEDbase.Incoming(), Electron(), in_el_mom) + in_ph = ParticleStateful(QEDbase.Incoming(), Photon(), in_ph_mom) + out_el = ParticleStateful(QEDbase.Outgoing(), Electron(), out_el_mom) + out_ph = ParticleStateful(QEDbase.Outgoing(), Photon(), out_ph_mom) in_particles_valid = (in_el, in_ph) in_particles_invalid = (in_el, out_ph) @@ -74,9 +74,7 @@ end out_particles_invalid = (out_el, in_ph) model = TESTMODEL - process = TestImplementation.TestProcess( - (QEDbase.Electron(), QEDbase.Photon()), (QEDbase.Electron(), QEDbase.Photon()) - ) + process = TestImplementation.TestProcess((Electron(), Photon()), (Electron(), Photon())) phasespace_def = TESTPSDEF psp = PhaseSpacePoint( @@ -151,19 +149,19 @@ end @test_throws BoundsError psp[QEDbase.Incoming(), 4] @test_throws BoundsError psp[QEDbase.Outgoing(), 4] - @test_throws InvalidInputError PhaseSpacePoint( + @test_throws QEDbase.InvalidInputError PhaseSpacePoint( process, model, phasespace_def, in_particles_invalid, out_particles_valid ) - @test_throws InvalidInputError PhaseSpacePoint( + @test_throws QEDbase.InvalidInputError PhaseSpacePoint( process, model, phasespace_def, in_particles_valid, out_particles_invalid ) - @test_throws InvalidInputError PhaseSpacePoint( + @test_throws QEDbase.InvalidInputError PhaseSpacePoint( process, model, phasespace_def, (in_ph, in_el), out_particles_valid ) - @test_throws InvalidInputError PhaseSpacePoint( + @test_throws QEDbase.InvalidInputError PhaseSpacePoint( process, model, phasespace_def, in_particles_valid, (out_ph, out_el) ) end @@ -185,7 +183,7 @@ end @testset "Error handling from momenta" for (i, o) in Iterators.product([1, 3, 4, 5], [1, 3, 4, 5]) - @test_throws InvalidInputError PhaseSpacePoint( + @test_throws QEDbase.InvalidInputError PhaseSpacePoint( process, model, phasespace_def, @@ -218,18 +216,18 @@ end @test out_psp_from_moms isa OutPhaseSpacePoint @test !(out_psp_from_moms isa InPhaseSpacePoint) - @test_throws InvalidInputError InPhaseSpacePoint( + @test_throws QEDbase.InvalidInputError InPhaseSpacePoint( process, model, phasespace_def, in_particles_invalid ) - @test_throws InvalidInputError OutPhaseSpacePoint( + @test_throws QEDbase.InvalidInputError OutPhaseSpacePoint( process, model, phasespace_def, out_particles_invalid ) @testset "Error handling from momenta" for i in [1, 3, 4, 5] - @test_throws InvalidInputError InPhaseSpacePoint( + @test_throws QEDbase.InvalidInputError InPhaseSpacePoint( process, model, phasespace_def, TestImplementation._rand_momenta(RNG, i) ) - @test_throws InvalidInputError OutPhaseSpacePoint( + @test_throws QEDbase.InvalidInputError OutPhaseSpacePoint( process, model, phasespace_def, TestImplementation._rand_momenta(RNG, i) ) end diff --git a/test/runtests.jl b/test/runtests.jl index d595ee4..5b7a4b1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -38,7 +38,7 @@ begin end @time @safetestset "particle base states" begin - include("particles/base_states.jl") + include("particles/states.jl") end @time @safetestset "particle propagators" begin diff --git a/test/test_implementation/test_process.jl b/test/test_implementation/test_process.jl index 41bd224..0c03dcc 100644 --- a/test/test_implementation/test_process.jl +++ b/test/test_implementation/test_process.jl @@ -1,6 +1,6 @@ # dummy particles -struct TestParticleFermion <: QEDbase.FermionLike end -struct TestParticleBoson <: QEDbase.BosonLike end +struct TestParticleFermion <: FermionLike end +struct TestParticleBoson <: BosonLike end const PARTICLE_SET = [TestParticleFermion(), TestParticleBoson()]