kups.potential.classical.blocking
¶
Blocking sphere potential for excluded volume constraints.
This module implements hard-sphere repulsion using blocking spheres that create infinite energy barriers. Useful for preventing particle overlap with framework atoms in porous materials (e.g., zeolites, MOFs) or enforcing geometric constraints.
Particles inside blocking spheres experience infinite repulsion, automatically rejecting Monte Carlo moves that violate spatial constraints.
BlockingSpheresParameters
¶
Parameters defining blocking sphere positions and radii.
Attributes:
| Name | Type | Description |
|---|---|---|
radii |
Array
|
Sphere radii, shape |
positions |
Array
|
Sphere centers, shape |
system |
Index[SystemId]
|
System assignment per sphere |
motif |
Index[MotifId]
|
Motif assignment per sphere |
Source code in src/kups/potential/classical/blocking.py
BlockingSpheresPotentialInput
¶
Input for blocking spheres energy calculation.
Attributes:
| Name | Type | Description |
|---|---|---|
parameters |
BlockingSpheresParameters
|
Blocking sphere positions and radii |
particles |
Table[ParticleId, Points]
|
Indexed particle data with positions, system, and motif index |
unitcell |
MaybeUnitCell
|
Optional unit cell for periodic boundary conditions |
edges |
Edges[Literal[2]]
|
Particle-sphere pairs to check for blocking |
Source code in src/kups/potential/classical/blocking.py
BlockingSpheresSumComposer
¶
Bases: SumComposer[State, BlockingSpheresPotentialInput[Points, UnitCell], Ptch]
Composer for blocking spheres potential in energy summation.
Attributes:
| Name | Type | Description |
|---|---|---|
particles_view |
View[State, Table[ParticleId, Points]]
|
Extracts indexed particle data from state |
systems_view |
View[State, Table[SystemId, S]]
|
Extracts indexed systems from state |
parameters_view |
View[State, BlockingSpheresParameters]
|
Extracts blocking sphere parameters from state |
neighborlist_view |
View[State, NearestNeighborList]
|
Extracts neighbor list instance from state |
probe |
Probe[State, Ptch, IsBlockingSpheresProbe] | None
|
Probe providing a IsBlockingSpheresProbe |
Source code in src/kups/potential/classical/blocking.py
IsBlockingSpheresProbe
¶
Bases: Protocol
Probe result for blocking spheres incremental updates.
Bundles changed particle indices with the updated neighbor list, enabling efficient re-evaluation when only a subset of particles move.
Source code in src/kups/potential/classical/blocking.py
IsBlockingSpheresState
¶
Bases: Protocol
Protocol for states providing all inputs for the blocking spheres potential.
Source code in src/kups/potential/classical/blocking.py
blocking_spheres_energy(inp)
¶
Calculate blocking spheres potential energy.
Returns infinite energy for particles inside blocking spheres.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
BlockingSpheresPotentialInput[Points, UC]
|
Potential input containing particles, spheres, and edges |
required |
Returns:
| Type | Description |
|---|---|
WithPatch[Table[SystemId, Energy], IdPatch]
|
Energy and patch with infinite energy for blocked particles. |
Source code in src/kups/potential/classical/blocking.py
make_blocking_spheres_from_state(state, probe=None, *, compute_position_and_unitcell_gradients=False)
¶
make_blocking_spheres_from_state(
state: Lens[State, IsBlockingSpheresState],
probe: None = None,
*,
compute_position_and_unitcell_gradients: Literal[
False
] = ...,
) -> Potential[State, EmptyType, EmptyType, Any]
make_blocking_spheres_from_state(
state: Lens[State, IsBlockingSpheresState],
probe: None = None,
*,
compute_position_and_unitcell_gradients: Literal[True],
) -> Potential[State, PositionAndUnitCell, EmptyType, Any]
Create a blocking spheres potential, optionally with incremental updates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
Any
|
Lens into the sub-state providing particles, systems, blocking sphere parameters, and neighbor list. |
required |
probe
|
Any
|
Probe returning a IsBlockingSpheresProbe; |
None
|
compute_position_and_unitcell_gradients
|
bool
|
When |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
Configured blocking spheres Potential. |
Source code in src/kups/potential/classical/blocking.py
make_blocking_spheres_potential(particles_view, systems_view, parameters_view, neighborlist_view, probe, gradient_lens, hessian_lens, hessian_idx_view, patch_idx_view=None)
¶
Create blocking sphere potential for excluded volume constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
particles_view
|
View[State, Table[ParticleId, Points]]
|
Extracts indexed particle data from state |
required |
systems_view
|
View[State, Table[SystemId, S]]
|
Extracts indexed systems from state |
required |
parameters_view
|
View[State, BlockingSpheresParameters]
|
Extracts blocking sphere parameters (positions, radii) |
required |
neighborlist_view
|
View[State, NearestNeighborList]
|
Extracts neighbor list instance |
required |
probe
|
Probe[State, Ptch, IsBlockingSpheresProbe] | None
|
Probe returning a IsBlockingSpheresProbe; |
required |
gradient_lens
|
Lens[BlockingSpheresPotentialInput[Points, UnitCell], Gradients]
|
Specifies gradients to compute |
required |
hessian_lens
|
Lens[Gradients, Hessians]
|
Specifies Hessians to compute |
required |
hessian_idx_view
|
View[State, Hessians]
|
Hessian index structure |
required |
patch_idx_view
|
View[State, PotentialOut[Gradients, Hessians]] | None
|
Cached output index structure |
None
|
Returns:
| Type | Description |
|---|---|
PotentialFromEnergy[State, BlockingSpheresPotentialInput[Points, UnitCell], Gradients, Hessians, Ptch]
|
Blocking sphere potential. |