kups.potential.classical.ewald
¶
Ewald electrostatics with cached, incremental reciprocal-space updates.
parameters prepares cutoffs and lattice shifts, reciprocal implements
the numerical kernels, and potential composes energies and cache updates.
ewald_short_range_energy = GraphPairEnergy(ewald_short_range_pair)
module-attribute
¶
Ewald short-range graph evaluator derived from the shared pair term.
EwaldCache
¶
Compensated structure factors, prefactors and component outputs for updates.
Source code in src/kups/potential/classical/ewald/potential.py
make(n_sys, n_kvecs, gradient=EMPTY, hessian=EMPTY)
classmethod
¶
Create zeroed caches with the supplied derivative shapes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_sys
|
int
|
Number of systems. |
required |
n_kvecs
|
int
|
Number of reciprocal vectors per system, including padding. |
required |
gradient
|
G
|
Template defining cached gradient shapes. |
EMPTY
|
hessian
|
H
|
Template defining cached Hessian shapes. |
EMPTY
|
Returns:
| Type | Description |
|---|---|
EwaldCache[G, H]
|
Structure-factor, prefactor and component-output caches set to zero. |
Source code in src/kups/potential/classical/ewald/potential.py
EwaldCacheDeltaPatch
¶
Bases: Patch[State]
Add each accepted system's structure-factor change to the compensated cache.
Source code in src/kups/potential/classical/ewald/potential.py
__call__(state, accept)
¶
Apply structure-factor updates for accepted systems.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
State
|
State containing the Ewald cache. |
required |
accept
|
Accept
|
Per-system acceptance mask. |
required |
Returns:
| Type | Description |
|---|---|
State
|
State with accepted structure factors and their compensation updated. |
Source code in src/kups/potential/classical/ewald/potential.py
EwaldCachePatch
¶
Bases: Patch[State]
Accept or reject each system's structure factor and prefactor.
Source code in src/kups/potential/classical/ewald/potential.py
__call__(state, accept)
¶
Apply structure-factor updates for accepted systems.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
State
|
State containing the Ewald cache. |
required |
accept
|
Accept
|
Per-system acceptance mask. |
required |
Returns:
| Type | Description |
|---|---|
State
|
State with accepted structure factors, their compensation and |
State
|
prefactors updated. |
Source code in src/kups/potential/classical/ewald/potential.py
EwaldLongRangeComposer
¶
Build current particles and retain previous values for incremental updates.
Source code in src/kups/potential/classical/ewald/potential.py
__call__(state, patch)
¶
Compose the reciprocal-energy input for a full evaluation or proposal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
State
|
State providing particles, systems, parameters and optional cache. |
required |
patch
|
Ptch | None
|
Optional proposed state patch to inspect with the particle probe. |
required |
Returns:
| Type | Description |
|---|---|
Sum[EwaldLongRangeInput[State]]
|
A single-summand input with current particles and any probed previous values. |
Source code in src/kups/potential/classical/ewald/potential.py
EwaldLongRangeInput
¶
Current particles and optional changed rows for a cached update.
changes_from_prev holds the previous and current values of the changed
rows; energy-only evaluation reads only these, derivatives point_cloud.
Source code in src/kups/potential/classical/ewald/potential.py
EwaldParameterEstimates
¶
Estimated optimal Ewald parameters for given accuracy.
Source code in src/kups/potential/classical/ewald/parameters.py
EwaldParameters
¶
Per-system cutoffs and reciprocal shifts prepared before evaluation.
reciprocal_lattice_shifts stores sphere-filtered shifts padded for
batching. reciprocal_shift_bound always stores three axis bounds.
(0, 0, 0) selects explicit sums over the shifts; other bounds select
factored phase grids over that box, from which the shifts are gathered.
Rebuild parameters and the structure-factor cache when changing the cell
or cutoff. reciprocal_dtype is the precision of structure-factor
evaluations; float32 is much faster on GPUs with slow double precision.
Source code in src/kups/potential/classical/ewald/parameters.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
from_cutoffs(cell, alpha, cutoff, k_max, *, reciprocal_particle_chunk_size=None, reciprocal_k_chunk_size=_DEFAULT_RECIPROCAL_K_CHUNK, reciprocal_dtype=jnp.float64)
classmethod
¶
Prepare reciprocal shifts once from supplied physical cutoffs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Table[SystemId, HasCell[Periodic3D]]
|
System table with periodic cells. |
required |
alpha
|
Table[SystemId, Array]
|
Screening parameters in 1/Å. |
required |
cutoff
|
Table[SystemId, Array]
|
Real-space cutoffs in Å. |
required |
k_max
|
Table[SystemId, Array]
|
Reciprocal cutoffs in 1/Å. |
required |
reciprocal_particle_chunk_size
|
int | None
|
Maximum particles per response tile; defaults to 8192 on GPU and 1024 elsewhere. |
None
|
reciprocal_k_chunk_size
|
int
|
Maximum k-vectors per tile. |
_DEFAULT_RECIPROCAL_K_CHUNK
|
reciprocal_dtype
|
DTypeLike
|
Precision of structure-factor evaluations. |
float64
|
Returns:
| Type | Description |
|---|---|
EwaldParameters
|
Parameters with stored integer shifts and reciprocal cutoffs. |
Source code in src/kups/potential/classical/ewald/parameters.py
make(charges, cell, epsilon_total=1e-08, real_cutoff=None, *, reciprocal_particle_chunk_size=None, reciprocal_k_chunk_size=_DEFAULT_RECIPROCAL_K_CHUNK, reciprocal_dtype=jnp.float64)
classmethod
¶
Estimate each system's parameters and prepare its reciprocal shifts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
charges
|
Table[ParticleId, IsEwaldPointData]
|
Particle table with charges and system assignments. |
required |
cell
|
Table[SystemId, HasCell[Periodic3D]]
|
System table with periodic cells. |
required |
epsilon_total
|
float
|
Target combined real-space and reciprocal-space error. |
1e-08
|
real_cutoff
|
float | None
|
Optional fixed real-space cutoff in Å. |
None
|
reciprocal_particle_chunk_size
|
int | None
|
Maximum particles per response tile; defaults to 8192 on GPU and 1024 elsewhere. |
None
|
reciprocal_k_chunk_size
|
int
|
Maximum explicit k-vectors per tile; also sets the grid workspace budget. |
_DEFAULT_RECIPROCAL_K_CHUNK
|
reciprocal_dtype
|
DTypeLike
|
Precision of structure-factor evaluations. |
float64
|
Returns:
| Type | Description |
|---|---|
EwaldParameters
|
Ewald parameters with stored integer shifts and reciprocal cutoffs. |
Source code in src/kups/potential/classical/ewald/parameters.py
EwaldPotential
¶
Bases: SummedPotential[State, Gradients, Hessians, P]
Complete Ewald potential with named access to each component term.
Source code in src/kups/potential/classical/ewald/potential.py
exclusion_correction
property
¶
Subtract excluded pair interactions; requires exclusions enabled.
long_range
property
¶
Reciprocal-space potential.
net_charge
property
¶
Neutralizing-background correction for net-charged systems.
self_interaction
property
¶
Subtract each charge's interaction with its screening cloud.
short_range
property
¶
Real-space screened Coulomb potential.
IsChargedTemplate
¶
Bases: HasPositions, HasCharges, Protocol
Properties needed to prepare intramolecular Coulomb energies.
Source code in src/kups/potential/classical/ewald/potential.py
IsEwaldPointData
¶
Bases: HasCharges, NeighborListPoints, Protocol
Particle data required by Ewald: charges, positions, system/inclusion/exclusion indices.
Source code in src/kups/potential/classical/ewald/parameters.py
estimate_ewald_parameters(charges, cell, /, real_cutoff=None, alpha=None, epsilon_total=1e-08)
¶
Estimate cutoffs and screening for one system before JIT compilation.
Split epsilon_total equally between real and reciprocal error targets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
charges
|
Array | ndarray
|
Charges in e for one system, shaped |
required |
cell
|
Cell[AnyPeriodicity]
|
Single simulation cell. |
required |
real_cutoff
|
float | None
|
Optional fixed real-space cutoff in Å; otherwise optimized. |
None
|
alpha
|
float | None
|
Optional screening parameter in 1/Å; ignored with a fixed real cutoff. |
None
|
epsilon_total
|
float
|
Target combined real-space and reciprocal-space error. |
1e-08
|
Returns:
| Type | Description |
|---|---|
EwaldParameterEstimates
|
Screening, cutoffs and estimated errors. |
Source code in src/kups/potential/classical/ewald/parameters.py
194 195 196 197 198 199 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 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
ewald_long_range_energy(inp)
¶
Reciprocal energy with an acceptance cache patch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
EwaldLongRangeInput[State]
|
Current particles, reciprocal parameters and optional incremental cache. |
required |
Returns:
| Type | Description |
|---|---|
WithPatch[Table[SystemId, Energy], Patch[State]]
|
Per-system energies in eV with the structure-factor acceptance patch. |
Source code in src/kups/potential/classical/ewald/potential.py
ewald_net_charge_energy(inp)
¶
Uniform neutralizing-background correction -π Q² / (2 V α²) per system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
EwaldSelfInput
|
Particle graph and per-system screening parameters. |
required |
Returns:
| Type | Description |
|---|---|
WithPatch[Table[SystemId, Energy], IdPatch[Any]]
|
Per-system neutralizing-background energies in eV and an identity patch. |
Source code in src/kups/potential/classical/ewald/potential.py
ewald_self_interaction_energy(inp)
¶
Subtract each charge's interaction with its own Gaussian screening cloud.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
EwaldSelfInput
|
Particle graph and per-system screening parameters. |
required |
Returns:
| Type | Description |
|---|---|
WithPatch[Table[SystemId, Energy], IdPatch[Any]]
|
Per-system self-interaction energies in eV and an identity patch. |
Source code in src/kups/potential/classical/ewald/potential.py
ewald_short_range_pair_kernel(parameters, charges_i, charges_j, rij, r2, system)
¶
Screened Coulomb pair kernel shared by graph and fused evaluation.
Callers apply the cutoff; pair inputs broadcast to a common shape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
EwaldParameters
|
Per-system screening parameters. |
required |
charges_i
|
Array
|
Left-particle charges in e. |
required |
charges_j
|
Array
|
Right-particle charges in e. |
required |
rij
|
Array
|
Pair displacement vectors; unused by this radial kernel. |
required |
r2
|
Array
|
Squared pair distances in Ų. |
required |
system
|
Index[SystemId]
|
Left-particle system indices. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Pair energies in eV. |
Source code in src/kups/potential/classical/ewald/potential.py
kvecs_from_kmax(cell, kmax)
¶
Integer half-space lattice coefficients within the reciprocal kmax sphere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell[AnyPeriodicity]
|
Cell defining the reciprocal lattice. |
required |
kmax
|
float
|
Maximum reciprocal-vector magnitude in 1/Å. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Integer half-space lattice coefficients shaped |
Source code in src/kups/potential/classical/ewald/parameters.py
long_range(inp, structure_factor)
¶
Compute the unscaled reciprocal sum sum_k P(k) |S(k)|².
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
EwaldLongRangeInput[Any]
|
System cells, reciprocal-space parameters and, for incremental inputs, the cached prefactor. |
required |
structure_factor
|
Array
|
Real/imaginary structure factors, shaped |
required |
Returns:
| Type | Description |
|---|---|
Energy
|
Per-system reciprocal sums before |
Energy
|
excluding the neutralizing-background correction. |
Source code in src/kups/potential/classical/ewald/potential.py
make_ewald_exclusion_correction_potential(particles_view, systems_view, probe, gradient_lens, hessian_lens, hessian_idx_view, patch_idx_view=None, cache_lens=None, *, composition=None)
¶
Subtract intramolecular Coulomb interactions, with optional rigid templates.
The graph and template paths share the Coulomb pair kernel. Template energies are linear in molecular counts. Large templates and excluded fixed particles retain geometric evaluation to preserve minimum-image distances and topology. The cache stores the unscaled Coulomb sum, as in the other Ewald components.
Source code in src/kups/potential/classical/ewald/potential.py
1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 | |
make_ewald_long_range_potential(particles_view, systems_view, parameter_lens, cache_lens, probe=None, gradient_lens=EMPTY_LENS, hessian_lens=EMPTY_LENS, hessian_idx_view=EMPTY_LENS, patch_idx_view=None)
¶
Create the Ewald reciprocal-space (long-range) potential.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
particles_view
|
View[State, Table[ParticleId, IsEwaldPointData]]
|
View of the particle table. |
required |
systems_view
|
View[State, Table[SystemId, HasCell[Periodic3D]]]
|
View of the system table and periodic cells. |
required |
parameter_lens
|
View[State, EwaldParameters]
|
View of Ewald parameters. |
required |
cache_lens
|
Lens[State, EwaldCache[Gradients, Hessians]] | None
|
Optional lens to structure-factor and component-output caches. |
required |
probe
|
Probe[State, Ptch, WithIndices[ParticleId, IsEwaldPointData]] | None
|
Optional probe returning proposed particle updates. |
None
|
gradient_lens
|
Lens[PointCloud[IsEwaldPointData, HasCell[Periodic3D]], Gradients]
|
Lens selecting point-cloud variables to differentiate. |
EMPTY_LENS
|
hessian_lens
|
Lens[Gradients, Hessians]
|
Lens selecting gradient entries to differentiate again. |
EMPTY_LENS
|
hessian_idx_view
|
View[State, Hessians]
|
View supplying Hessian row and column indices. |
EMPTY_LENS
|
patch_idx_view
|
View[State, PotentialOut[Gradients, Hessians]] | None
|
Optional view supplying indices for output-cache updates. |
None
|
Returns:
| Type | Description |
|---|---|
Potential[State, Gradients, Hessians, Ptch]
|
Reciprocal potential with optional incremental structure-factor updates. |
Source code in src/kups/potential/classical/ewald/potential.py
make_ewald_net_charge_potential(particles_view, systems_view, parameter_view, gradient_lens=EMPTY_LENS, hessian_lens=EMPTY_LENS, hessian_idx_view=EMPTY_LENS, patch_idx_view=None, cache_lens=None, *, composition=None)
¶
Neutralizing-background energy of each system's net charge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
particles_view
|
View[State, Table[ParticleId, IsEwaldPointData]]
|
View of the particle table. |
required |
systems_view
|
View[State, Table[SystemId, HasCell[Periodic3D]]]
|
View of the system table and periodic cells. |
required |
parameter_view
|
View[State, EwaldParameters]
|
View of Ewald parameters. |
required |
gradient_lens
|
Lens[PointCloud[IsEwaldPointData, HasCell[Periodic3D]], Gradients]
|
Lens selecting point-cloud variables to differentiate. |
EMPTY_LENS
|
hessian_lens
|
Lens[Gradients, Hessians]
|
Lens selecting gradient entries to differentiate again. |
EMPTY_LENS
|
hessian_idx_view
|
View[State, Hessians]
|
View supplying Hessian row and column indices. |
EMPTY_LENS
|
patch_idx_view
|
View[State, PotentialOut[Gradients, Hessians]] | None
|
Optional view supplying indices for output-cache updates. |
None
|
cache_lens
|
Lens[State, KahanSummand[PotentialOut[Gradients, Hessians]]] | None
|
Optional lens to the compensated net-charge output cache. |
None
|
composition
|
RigidBodyComposition[State, HasCharges] | None
|
Optional rigid-body input for an energy-only count sum. |
None
|
Returns:
| Type | Description |
|---|---|
Potential[State, Gradients, Hessians, Ptch]
|
Net-charge potential recomputed from all current charges. |
Source code in src/kups/potential/classical/ewald/potential.py
999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 | |
make_ewald_potential(particles_view, systems_view, neighborlist_view, parameter_lens, cache_lens, probe, gradient_lens, hessian_lens, hessian_idx_view, patch_idx_view=None, include_exclusion_mask=False, *, composition=None)
¶
Combine real-space, reciprocal-space and self-interaction energies.
Compute all same-system interactions before subtracting optional molecular exclusions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
particles_view
|
View[State, Table[ParticleId, IsEwaldPointData]]
|
View of particles with charges and inclusion/exclusion groups. |
required |
systems_view
|
View[State, Table[SystemId, HasCell[Periodic3D]]]
|
View of the system table and periodic cells. |
required |
neighborlist_view
|
View[State, NeighborList[Literal[2]]]
|
View of the real-space pair neighbor list. |
required |
parameter_lens
|
Lens[State, EwaldParameters]
|
Lens to Ewald parameters. |
required |
cache_lens
|
Lens[State, EwaldCache[Gradients, Hessians]] | None
|
Optional lens to structure-factor and component-output caches. |
required |
probe
|
Probe[State, Ptch, IsParticleProbe[IsEwaldPointData]] | None
|
Optional probe returning changed particles. |
required |
gradient_lens
|
Lens[PointCloud[IsEwaldPointData, HasCell[Periodic3D]], Gradients]
|
Lens selecting point-cloud variables to differentiate. |
required |
hessian_lens
|
Lens[Gradients, Hessians]
|
Lens selecting gradient entries to differentiate again. |
required |
hessian_idx_view
|
View[State, Hessians]
|
View supplying Hessian row and column indices. |
required |
patch_idx_view
|
View[State, PotentialOut[Gradients, Hessians]] | None
|
Optional view supplying indices for output-cache updates. |
None
|
include_exclusion_mask
|
bool
|
Whether to subtract molecular-exclusion pair energies. |
False
|
composition
|
RigidBodyComposition[State, IsChargedTemplate] | None
|
Optional rigid-body input fixing cells and parameters for energy-only evaluation. Large templates retain geometric exclusions. |
None
|
Returns:
| Type | Description |
|---|---|
EwaldPotential[State, Gradients, Hessians, Ptch]
|
Combined Ewald potential with four components, or five with exclusions. |
Source code in src/kups/potential/classical/ewald/potential.py
1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 | |
make_ewald_self_interaction_potential(particles_view, systems_view, parameter_view, gradient_lens=EMPTY_LENS, hessian_lens=EMPTY_LENS, hessian_idx_view=EMPTY_LENS, patch_idx_view=None, cache_lens=None, *, composition=None)
¶
Recompute the inexpensive charge-only sum to avoid drift from cached deltas.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
particles_view
|
View[State, Table[ParticleId, IsEwaldPointData]]
|
View of the particle table. |
required |
systems_view
|
View[State, Table[SystemId, HasCell[Periodic3D]]]
|
View of the system table and periodic cells. |
required |
parameter_view
|
View[State, EwaldParameters]
|
View of Ewald parameters. |
required |
gradient_lens
|
Lens[PointCloud[IsEwaldPointData, HasCell[Periodic3D]], Gradients]
|
Lens selecting point-cloud variables to differentiate. |
EMPTY_LENS
|
hessian_lens
|
Lens[Gradients, Hessians]
|
Lens selecting gradient entries to differentiate again. |
EMPTY_LENS
|
hessian_idx_view
|
View[State, Hessians]
|
View supplying Hessian row and column indices. |
EMPTY_LENS
|
patch_idx_view
|
View[State, PotentialOut[Gradients, Hessians]] | None
|
Optional view supplying indices for output-cache updates. |
None
|
cache_lens
|
Lens[State, KahanSummand[PotentialOut[Gradients, Hessians]]] | None
|
Optional lens to the compensated self-interaction output cache. |
None
|
composition
|
RigidBodyComposition[State, HasCharges] | None
|
Optional rigid-body input for an energy-only count sum. |
None
|
Returns:
| Type | Description |
|---|---|
Potential[State, Gradients, Hessians, Ptch]
|
Self-interaction potential recomputed from all current charges. |
Source code in src/kups/potential/classical/ewald/potential.py
make_ewald_short_range_potential(particles_view, systems_view, neighborlist_view, parameter_view, probe, gradient_lens, hessian_lens, hessian_idx_view, patch_idx_view=None, cache_lens=None)
¶
Create the Ewald real-space (short-range) potential.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
particles_view
|
View[State, Table[ParticleId, IsEwaldPointData]]
|
View of the particle table. |
required |
systems_view
|
View[State, Table[SystemId, HasCell[Periodic3D]]]
|
View of the system table and periodic cells. |
required |
neighborlist_view
|
View[State, NeighborList[Literal[2]]]
|
View of the real-space pair neighbor list. |
required |
parameter_view
|
View[State, EwaldParameters]
|
View of Ewald parameters. |
required |
probe
|
Probe[State, Ptch, IsParticleProbe[IsEwaldPointData]] | None
|
Optional probe returning changed particles. |
required |
gradient_lens
|
Lens[PointCloud[IsEwaldPointData, HasCell[Periodic3D]], Gradients]
|
Lens selecting point-cloud variables to differentiate. |
required |
hessian_lens
|
Lens[Gradients, Hessians]
|
Lens selecting gradient entries to differentiate again. |
required |
hessian_idx_view
|
View[State, Hessians]
|
View supplying Hessian row and column indices. |
required |
patch_idx_view
|
View[State, PotentialOut[Gradients, Hessians]] | None
|
Optional view supplying indices for output-cache updates. |
None
|
cache_lens
|
Lens[State, KahanSummand[PotentialOut[Gradients, Hessians]]] | None
|
Optional lens to the compensated short-range output cache. |
None
|
Returns:
| Type | Description |
|---|---|
Potential[State, Gradients, Hessians, Ptch]
|
Real-space potential using the pair-graph evaluator. |
Source code in src/kups/potential/classical/ewald/potential.py
prefactor(inp)
¶
Weights 2π/V exp(-k²/(4α²))/k², zero outside the reciprocal cutoff.
Double contributions with nonzero first lattice coefficient for the omitted half-space; the zero plane already contains both signs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
EwaldLongRangeInput[Any]
|
System cells, screening parameters and reciprocal cutoffs. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Weights shaped |
Source code in src/kups/potential/classical/ewald/potential.py
reciprocal_grid_bound(cell, kmax)
¶
Uniform coefficient bound enclosing the reciprocal kmax sphere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell[AnyPeriodicity]
|
Cell defining the reciprocal lattice. |
required |
kmax
|
float
|
Maximum reciprocal-vector magnitude in 1/Å. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Integer bound enclosing the reciprocal cutoff sphere. |
Source code in src/kups/potential/classical/ewald/parameters.py
reciprocal_grid_index(shifts, bound)
¶
Flat positions of shifts in reciprocal_grid_shifts(bound).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shifts
|
Array
|
Integer shifts inside |
required |
bound
|
ReciprocalGridBound
|
Grid axis bounds. |
required |
Returns:
| Type | Description |
|---|---|
Array | ndarray
|
Grid indices shaped |
Array | ndarray
|
shifts, so kernels can specialize on them. |
Source code in src/kups/potential/classical/ewald/parameters.py
reciprocal_grid_shifts(bound)
¶
Integer half-space grid: nonnegative x, signed y/z, x-major.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bound
|
int | ReciprocalGridBound
|
Nonnegative maximum absolute lattice coefficients, or one bound for all three axes. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Integer coefficients shaped |
Source code in src/kups/potential/classical/ewald/parameters.py
structure_factor(inp)
¶
Return the full or incrementally updated structure factor and cache patch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
EwaldLongRangeInput[State]
|
Current particles and optional cache and previous particle values. |
required |
Returns:
| Type | Description |
|---|---|
KahanSummand[Array]
|
Compensated structure factors shaped |
Patch[State]
|
an acceptance patch, or an identity patch when no cache lens is supplied. |