kups.potential.classical.coulomb
¶
Coulomb electrostatic potential for vacuum/non-periodic systems.
This module provides a simple pairwise Coulomb potential for charged systems without periodic boundary conditions. For periodic systems with long-range electrostatics, use Ewald summation instead.
Potential: \(U = \frac{1}{4\pi\epsilon_0} \sum_{i<j} \frac{q_i q_j}{r_{ij}}\)
IsCoulombVacuumState
¶
Bases: Protocol
Protocol for states providing all inputs for the Coulomb vacuum potential.
Source code in src/kups/potential/classical/coulomb.py
coulomb_vacuum_energy(inp)
¶
Compute Coulomb electrostatic energy for all charge pairs.
Calculates pairwise electrostatic energy using Coulomb's law and sums over all systems. Accounts for double counting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
CoulombVacuumInput
|
Graph potential input |
required |
Returns:
| Type | Description |
|---|---|
WithPatch[Table[SystemId, Energy], IdPatch]
|
Total electrostatic energy per system |
Source code in src/kups/potential/classical/coulomb.py
make_coulomb_vacuum_from_state(state, probe=None, *, compute_position_and_unitcell_gradients=False)
¶
make_coulomb_vacuum_from_state(
state: Lens[State, IsCoulombVacuumState],
probe: None = None,
*,
compute_position_and_unitcell_gradients: Literal[
False
] = ...,
) -> Potential[State, EmptyType, EmptyType, Any]
make_coulomb_vacuum_from_state(
state: Lens[State, IsCoulombVacuumState],
probe: None = None,
*,
compute_position_and_unitcell_gradients: Literal[True],
) -> Potential[State, PositionAndUnitCell, EmptyType, Any]
Create a Coulomb vacuum potential from a typed state, optionally with incremental updates.
Convenience wrapper around
make_coulomb_vacuum_potential.
When probe is None, creates a plain potential for states satisfying
IsCoulombVacuumState.
When a probe is provided, wires incremental patch-based updates for the same state type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
Any
|
Lens into the sub-state providing particles, systems, and neighbor list. |
required |
probe
|
Any
|
Detects which particles and neighbor-list edges changed since the last step.
Pass |
None
|
compute_position_and_unitcell_gradients
|
bool
|
When |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
Configured Coulomb vacuum Potential. |
Source code in src/kups/potential/classical/coulomb.py
make_coulomb_vacuum_potential(particles_view, systems_view, cutoffs_view, neighborlist_view, probe, gradient_lens, hessian_lens, hessian_idx_view, patch_idx_view=None, out_cache_lens=None)
¶
Create simple Coulomb potential for non-periodic systems.
Computes pairwise electrostatic interactions using Coulomb's law. Suitable for gas-phase or cluster systems. For periodic/bulk systems, use Ewald summation for proper treatment of long-range electrostatics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
particles_view
|
View[State, Table[ParticleId, IsCoulombGraphParticles]]
|
Extracts indexed particle data (positions, charges, system index) |
required |
systems_view
|
View[State, Table[SystemId, HasUnitCell]]
|
Extracts indexed system data (unit cell) |
required |
cutoffs_view
|
View[State, Table[SystemId, Array]]
|
Extracts cutoff array from state |
required |
neighborlist_view
|
View[State, NearestNeighborList]
|
Extracts neighbor list |
required |
probe
|
Probe[State, Ptch, IsRadiusGraphProbe[IsCoulombGraphParticles]] | None
|
Grouped probe for incremental updates (particles, neighborlist_after, neighborlist_before) |
required |
gradient_lens
|
Lens[CoulombVacuumInput, 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 (optional) |
None
|
out_cache_lens
|
Lens[State, PotentialOut[Gradients, Hessians]] | None
|
Cache location lens (optional) |
None
|
Returns:
| Type | Description |
|---|---|
Potential[State, Gradients, Hessians, Ptch]
|
Coulomb potential for vacuum. |