sample_initial_volume¶
- jaxrens.init.cells.sample_initial_volume(key, n_atoms, max_volume_per_atom, flat_V_prior=False, min_volume_per_atom=0.0)[source]¶
Sample an initial cell edge length (cubic cell) from the NS volume prior.
Returns the scalar edge length lc such that cell = lc * I_3.
The draw is over the volume interval [V_lo, V_hi], with V_lo = n_atoms * min_volume_per_atom and V_hi = n_atoms * max_volume_per_atom.
min_volume_per_atomis the initial volume floor: it lets walkers start on a low-density grid, decoupled from the sampling-constraint floor. The default of 0.0 puts no lower bound on the volume.Two prior modes:
- flat_V_prior=True:
V ~ Uniform(V_lo, V_hi). The edge length is lc = V ** (1/3).
- flat_V_prior=False (default, pymatnest convention):
V drawn with density proportional to V^N (N = n_atoms) truncated to [V_lo, V_hi], biasing toward larger volumes. With V_lo = 0 this reduces to lc = (V_hi * U ** (1 / (n_atoms + 1))) ** (1/3), U ~ Uniform(0, 1).
- Parameters:
key (Array) – JAX PRNG key.
n_atoms (int) – Number of atoms in the cell.
max_volume_per_atom (float) – Upper bound on volume per atom (Angstrom^3 or similar).
flat_V_prior (bool) – If True, draw from a flat volume prior; otherwise use the V^N biased prior.
min_volume_per_atom (float) – Lower bound on the initial volume per atom. Defaults to 0.0 (no floor).
- Returns:
the cubic cell edge length lc.
- Return type:
Scalar (0-d) jnp.ndarray