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.
BlockingSpheresConfig
¶
Bases: Protocol
Protocol for a single blocking sphere description (center and radius).
Source code in src/kups/potential/classical/blocking.py
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
from_data(data)
staticmethod
¶
Build parameters from a nested sequence of sphere configurations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Sequence[Sequence[Sequence[BlockingSpheresConfig]]]
|
Nested sequence indexed as |
required |
Returns:
| Type | Description |
|---|---|
|
BlockingSpheresParameters with flattened arrays of radii, positions, |
|
|
system assignments, and motif assignments. |
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, _BlockingParticles]
|
Indexed particle data with positions, system, and group index |
groups |
Table[GroupId, HasMotifIndex]
|
Indexed group data providing the motif index for each group |
cell |
Table[SystemId, Cell]
|
Per-system cell used for periodic boundary wrapping |
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, Ptch]
Composer for blocking spheres potential in energy summation.
Attributes:
| Name | Type | Description |
|---|---|---|
particles_view |
View[State, Table[ParticleId, _BlockingParticles]]
|
Extracts indexed particle data from state |
groups_view |
View[State, Table[GroupId, HasMotifIndex]]
|
Extracts indexed group data (motif assignments) from state |
systems_view |
View[State, Table[SystemId, HasCell]]
|
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
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
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
|
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)
¶
Create a blocking spheres potential, optionally with incremental updates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
Any
|
Lens into the sub-state providing particles, groups, systems, blocking sphere parameters, and neighbor list. |
required |
probe
|
Any
|
Probe returning a IsBlockingSpheresProbe; |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
Configured blocking spheres Potential. |
Source code in src/kups/potential/classical/blocking.py
make_blocking_spheres_potential(particles_view, groups_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, _BlockingParticles]]
|
Extracts indexed particle data from state |
required |
groups_view
|
View[State, Table[GroupId, HasMotifIndex]]
|
Extracts indexed group data (motif assignments) from state |
required |
systems_view
|
View[State, Table[SystemId, HasCell]]
|
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, 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, Gradients, Hessians, Ptch]
|
Blocking sphere potential. |