#cellular #cell #simulation

cellular_raza-building-blocks

cellular_raza Building Blocks

4 releases

0.0.8 Feb 16, 2024
0.0.7 Feb 15, 2024
0.0.6 Feb 2, 2024
0.0.5 Dec 12, 2023
0.0.4 Dec 6, 2023

#784 in Math


Used in cellular_raza

GPL-2.0 license

195KB
3K SLoC

cellular_raza building-blocks

This crate contains building blocks that can be combined to yield a fully working simulation.


lib.rs:

cellular_raza - Building Blocks

Building blocks allow users to quickly construct complex cellular agents. The simplest approach is to use fully-defined cell models which are contained in [cell_models] with fitting [domains]. However, users can also build their own complex models by combining existing ones.

To create your own agent with physical mechanics and interactions, we need to include the building blocks for them as fields of our agent struct.

struct MyAgent {
    mechanics: NewtonDamped2D,
    interaction: BoundLennardJones,
}

Furthermore, we can derive desired concepts by using the CellAgent derive macro.

#[derive(CellAgent)]
struct MyAgent {
    #[Mechanics(Vector2<f64>, Vector2<f64>, Vector2<f64>)]
    mechanics: NewtonDamped2D,
    #[Interaction(Vector2<f64>, Vector2<f64>, Vector2<f64>)]
    interaction: BoundLennardJones,
}
#

For technical reasons, we are required to also once more specify the types for position, velocity and force when specifying which struct field to derive from. The optional Inf generic parameter of the Interaction trait was left out and thus defaults to (). It can and needs to also be specified when choosing interactions with non-trivial interaction information.

Optional Features

Features guard implementations which introduce additional dependencies. To simplify usability, we enable commonly used features by default.

  • pyo3 Rust bindings to the Python interpreter

Dependencies

~18–26MB
~257K SLoC