diff --git a/src/chemotaxis/brown-berg.jl b/src/chemotaxis/brown-berg.jl index 860e471..bc73f72 100644 --- a/src/chemotaxis/brown-berg.jl +++ b/src/chemotaxis/brown-berg.jl @@ -14,7 +14,7 @@ Default parameters: - `receptor_binding_constant = 100` μM - `memory = 1` s """ -@agent BrownBerg{D} ContinuousAgent{D,Float64} where D AbstractMicrobe{D} begin +@agent struct BrownBerg{D}(ContinuousAgent{D,Float64}) <: AbstractMicrobe{D} speed::Float64 motility::AbstractMotility = RunTumble() turn_rate::Float64 = 1 / 0.67 diff --git a/src/chemotaxis/brumley.jl b/src/chemotaxis/brumley.jl index 2de5a3b..14a46f2 100644 --- a/src/chemotaxis/brumley.jl +++ b/src/chemotaxis/brumley.jl @@ -17,7 +17,7 @@ Default parameters: - `chemotactic_precision = 6.0` → 'Π' - `radius = 0.5` μm → 'a' """ -@agent Brumley{D} ContinuousAgent{D,Float64} where D AbstractMicrobe{D} begin +@agent struct Brumley{D}(ContinuousAgent{D,Float64}) <: AbstractMicrobe{D} speed::Float64 motility::AbstractMotility = RunReverseFlick(speed_forward = [46.5]) turn_rate::Float64 = 1 / 0.45 diff --git a/src/chemotaxis/celani.jl b/src/chemotaxis/celani.jl index 1aaaf28..eb16b16 100644 --- a/src/chemotaxis/celani.jl +++ b/src/chemotaxis/celani.jl @@ -19,7 +19,7 @@ Default parameters: - `memory = 1` s - `radius = 0.5` μm """ -@agent Celani{D} ContinuousAgent{D,Float64} where {D} AbstractMicrobe{D} begin +@agent struct Celani{D}(ContinuousAgent{D,Float64}) <: AbstractMicrobe{D} speed::Float64 motility::AbstractMotility = RunTumble(speed = [30.0]) turn_rate::Float64 = 1 / 0.67 diff --git a/src/chemotaxis/xie.jl b/src/chemotaxis/xie.jl index 46faf1f..fa04a6f 100644 --- a/src/chemotaxis/xie.jl +++ b/src/chemotaxis/xie.jl @@ -29,7 +29,7 @@ Default parameters: - `chemotactic_precision = 0.0` - `radius = 0.5` μm """ -@agent Xie{D} ContinuousAgent{D,Float64} where D AbstractMicrobe{D} begin +@agent struct Xie{D}(ContinuousAgent{D,Float64}) <: AbstractMicrobe{D} speed::Float64 motility::AbstractMotility = RunReverseFlick(speed_forward = [46.5]) turn_rate_forward::Float64 = 2.3 diff --git a/src/microbes.jl b/src/microbes.jl index 740758b..5172e2b 100644 --- a/src/microbes.jl +++ b/src/microbes.jl @@ -17,7 +17,7 @@ Default parameters: - `vel::SVector{D,Float64}` unit velocity vector - `speed::Float64` magnitude of the velocity vector """ -@agent Microbe{D} ContinuousAgent{D,Float64} where D AbstractMicrobe{D} begin +@agent struct Microbe{D}(ContinuousAgent{D,Float64}) <: AbstractMicrobe{D} speed::Float64 motility::AbstractMotility = RunTumble() turn_rate::Float64 = 1.0 diff --git a/src/model.jl b/src/model.jl index 0f5e47b..2fed330 100644 --- a/src/model.jl +++ b/src/model.jl @@ -171,7 +171,7 @@ in which case the simulations stops when `n` returns true. - `showprogress = false` See `Agents.run!` and `Agents.step!` for detailed information. """ -function Agents.run!(model::AgentBasedModel{S,A}, n = 1; +function Agents.run!(model::AgentBasedModel{S}, n = 1; when = true, when_model = when, adata = nothing, @@ -179,7 +179,7 @@ function Agents.run!(model::AgentBasedModel{S,A}, n = 1; obtainer = identity, agents_first = true, showprogress = false -) where {S<:ContinuousSpace,A<:AbstractMicrobe} +) where {S<:ContinuousSpace} run!(model, microbe_step!, model.update!, n; when, when_model, adata, mdata, diff --git a/src/utils.jl b/src/utils.jl index 9d5a482..95b3dc9 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -5,7 +5,7 @@ export random_velocity, random_speed, ChainedFunction, →, distance, distanceve Generate a random velocity vector with unit norm respecting the dimensionality of `model`. """ -function random_velocity(model::AgentBasedModel{S,A}) where {S,D,A<:AbstractMicrobe{D}} +function random_velocity(model::AgentBasedModel{ContinuousSpace{D}}) where D random_velocity(abmrng(model), D) end function random_velocity(rng::AbstractRNG, D::Int)