jaxdem.colliders.naive#
Naive \(O(N^2)\) collider implementation.
Classes
Implementation that computes forces and potential energies using a naive \(O(N^2)\) all-pairs interaction loop. |
- class jaxdem.colliders.naive.NaiveSimulator[source]#
Bases:
ColliderImplementation that computes forces and potential energies using a naive \(O(N^2)\) all-pairs interaction loop.
Notes
Due to its \(O(N^2)\) complexity, NaiveSimulator is suitable for simulations with a relatively small number of particles. For larger systems, a more efficient spatial partitioning collider should be used. However, this collider should be the fastest option for small systems (\(<1k-5k\) spheres depending on the GPU).
- static compute_potential_energy(state: State, system: System) jax.Array[source][source]#
Computes the potential energy associated with each particle using a naive \(O(N^2)\) all-pairs loop.
This method iterates over all particle pairs (i, j) and sums the potential energy contributions computed by the
system.force_model.- Parameters:
- Returns:
One-dimensional array containing the total potential energy contribution for each particle.
- Return type:
jax.Array
Note
This method donates state and system
- static create_neighbor_list(state: State, system: System, cutoff: float, max_neighbors: int) Tuple[State, System, jax.Array, jax.Array][source][source]#
Naive O(N^2) neighbor list build.
Matches the cell-list neighbor-list API: returns (state, system, neighbor_list, overflow) where neighbor indices refer to the returned state (unsorted for naive).
- static compute_force(state: State, system: System) Tuple[State, System][source][source]#
Computes the total force acting on each particle using a naive \(O(N^2)\) all-pairs loop.
This method sums the force contributions from all particle pairs (i, j) as computed by the
system.force_modeland updates the particle forces.- Parameters:
- Returns:
A tuple containing the updated
Stateobject with computed forces and the unmodifiedSystemobject.- Return type:
Note
This method donates state and system