jax_md_mod.custom_quantity.init_bond_length

jax_md_mod.custom_quantity.init_bond_length#

init_bond_length(displacement_fn, bonds, average=False)[source]#

Initializes a function that computes bond lengths for given atom pairs.

Parameters:
  • displacement_fn – Displacement function

  • bonds – (n, 2) array defining IDs of bonded particles

  • average – If False, returns per-pair bond lengths. If True, returns scalar average over all pairs

Returns:

A function that takes a simulation state and returns bond lengths