kups.core.typing
¶
Structural typing protocols and sentinel ID types for simulation entities.
Defines :class:ParticleId, :class:SystemId, and other sentinel int/str
sub-types used as type-safe index labels, plus Has* protocols for structural
duck-typing of simulation data (positions, momenta, forces, etc.).
ExclusionId
¶
GroupId
¶
HasAtomicNumbers
¶
Bases: Protocol
Protocol for entities with atomic numbers.
Attributes:
| Name | Type | Description |
|---|---|---|
atomic_numbers |
Array
|
Array of atomic numbers for each atom. |
Source code in src/kups/core/typing.py
HasBarostatFriction
¶
Bases: Protocol
Protocol for systems with Langevin friction on the cell DOFs.
Per-component friction \(\gamma_{\alpha\beta}\) governing the
Ornstein–Uhlenbeck thermostat on cell_momentum.
Lower-triangular.
Attributes:
| Name | Type | Description |
|---|---|---|
barostat_friction |
Array
|
Cell friction tensor \(\gamma\) (units: 1/time),
shape |
Source code in src/kups/core/typing.py
HasBarostatMass
¶
Bases: Protocol
Protocol for systems with a fictitious cell mass tensor.
Per-component mass \(M_{\alpha\beta}\) of the cell DOFs, set from the
Gao–Fang–Wang formula
\(M_{\alpha\beta} = 3\det(h_0)\,(\tau/2\pi)^2 / (\kappa (h_0)_{\alpha\alpha}^2)\)
(Eq. 14–15 of the paper) at construction time. Lower-triangular to
match cell_momentum.
Attributes:
| Name | Type | Description |
|---|---|---|
barostat_mass |
Array
|
Cell mass tensor \(M\) (units: mass·length²),
shape |
Source code in src/kups/core/typing.py
HasCache
¶
Bases: Protocol
Protocol for objects carrying primary data alongside a cache.
Source code in src/kups/core/typing.py
HasCell
¶
Bases: Protocol, Generic[_P_co]
Protocol for entities with cell parameters.
Generic over the periodicity literal P, mirroring
Cell. Narrowing example:
HasCell[Periodic3D] for systems requiring fully-periodic cells.
Attributes:
| Name | Type | Description |
|---|---|---|
cell |
Cell[_P_co]
|
Cell parameters for each system. |
Source code in src/kups/core/typing.py
HasCellMomentum
¶
Bases: Protocol
Protocol for systems with an extended-variable cell-momentum tensor.
Conjugate momentum of the lower-triangular cell-vector matrix
[cell.vectors][kups.core.cell.Cell.vectors]. Stored as a
(..., 3, 3) lower-triangular array (strict-upper entries are
zero and ignored). Used by extended-variable NPT integrators such as
Gao–Fang–Wang BAOAB NPT Langevin.
Attributes:
| Name | Type | Description |
|---|---|---|
cell_momentum |
Array
|
Cell momentum \(p^h\) (units: mass·length/time),
shape |
Source code in src/kups/core/typing.py
HasCharges
¶
Bases: Protocol
Protocol for entities with charge data.
Attributes:
| Name | Type | Description |
|---|---|---|
charges |
Array
|
Array of charges for each entity (e.g., atoms). |
Source code in src/kups/core/typing.py
HasCompressibility
¶
Bases: Protocol
Protocol for systems with isothermal compressibility.
Attributes:
| Name | Type | Description |
|---|---|---|
compressibility |
Array
|
Isothermal compressibility \(\beta\) (units: length³/energy). |
Source code in src/kups/core/typing.py
HasCutoff
¶
Bases: Protocol
Protocol for entities with a distance cutoff.
Attributes:
| Name | Type | Description |
|---|---|---|
cutoff |
Array
|
Cutoff distance (units: length). |
Source code in src/kups/core/typing.py
HasExclusionIndex
¶
Bases: Protocol
Protocol for entities with exclusion group index.
Attributes:
| Name | Type | Description |
|---|---|---|
exclusion |
Index[ExclusionId]
|
Index mapping particles to exclusion groups. |
Source code in src/kups/core/typing.py
HasForces
¶
Bases: Protocol
Protocol for entities with force data.
Attributes:
| Name | Type | Description |
|---|---|---|
forces |
Array
|
Array of forces for each entity (e.g., atoms). |
Source code in src/kups/core/typing.py
HasFrictionCoefficient
¶
Bases: Protocol
Protocol for systems with Langevin friction coefficient.
Attributes:
| Name | Type | Description |
|---|---|---|
friction_coefficient |
Array
|
Friction coefficient \(\gamma\) (units: 1/time). |
Source code in src/kups/core/typing.py
HasGroupIndex
¶
HasInclusionIndex
¶
Bases: Protocol
Protocol for entities with inclusion group index.
Attributes:
| Name | Type | Description |
|---|---|---|
inclusion |
Index[InclusionId]
|
Index mapping particles to inclusion groups. |
Source code in src/kups/core/typing.py
HasIntegratorParams
¶
Bases: Protocol
Protocol for systems carrying bundled integrator control parameters.
Attributes:
| Name | Type | Description |
|---|---|---|
integrator_params |
P
|
Control knobs consumed by the chosen integrator
(time step, thermostat/barostat coupling parameters). Concrete shape
of |
Source code in src/kups/core/typing.py
HasLabels
¶
HasLogActivity
¶
Bases: Protocol
Protocol for entities with chemical activity parameters.
Attributes:
| Name | Type | Description |
|---|---|---|
log_activity |
Array
|
Natural log of chemical activity per species [dimensionless],
shape |
Source code in src/kups/core/typing.py
HasMasses
¶
Bases: Protocol
Protocol for entities with mass data.
Attributes:
| Name | Type | Description |
|---|---|---|
masses |
Array
|
Array of masses for each entity (e.g., atoms). |
Source code in src/kups/core/typing.py
HasMinimumScaleFactor
¶
Bases: Protocol
Protocol for systems with minimum barostat scale factor.
Attributes:
| Name | Type | Description |
|---|---|---|
minimum_scale_factor |
Array
|
Minimum scaling factor \(\mu_{\text{min}}\) (dimensionless). |
Source code in src/kups/core/typing.py
HasMomenta
¶
Bases: Protocol
Protocol for entities with momentum data.
Attributes:
| Name | Type | Description |
|---|---|---|
momenta |
Array
|
Array of momenta for each entity (e.g., atoms). |
Source code in src/kups/core/typing.py
HasMotifAndSystemIndex
¶
Bases: HasMotifIndex, HasSystemIndex, Protocol
Protocol for entities with both motif and system indices.
Source code in src/kups/core/typing.py
HasMotifIndex
¶
HasPositions
¶
Bases: Protocol
Protocol for entities with position data.
Attributes:
| Name | Type | Description |
|---|---|---|
positions |
Array
|
Array of positions for each entity (e.g., atoms). |
Source code in src/kups/core/typing.py
HasPositionsAndAtomicNumbers
¶
Bases: HasPositions, HasAtomicNumbers, Protocol
Protocol for entities with both position and atomic number data.
Source code in src/kups/core/typing.py
HasPositionsAndGroupIndex
¶
Bases: HasPositions, HasGroupIndex, Protocol
Protocol for entities with both position data and group index.
Source code in src/kups/core/typing.py
HasPositionsAndLabels
¶
Bases: HasPositions, HasLabels, Protocol
Protocol for entities with both position and label data.
Source code in src/kups/core/typing.py
HasPositionsAndSystemIndex
¶
Bases: HasPositions, HasSystemIndex, Protocol
Protocol for entities with both position data and system index.
Source code in src/kups/core/typing.py
HasPotentialEnergy
¶
Bases: Protocol
Protocol for systems with a potential energy.
Attributes:
| Name | Type | Description |
|---|---|---|
potential_energy |
Array
|
Potential energy in eV. |
Source code in src/kups/core/typing.py
HasPressureCouplingTime
¶
Bases: Protocol
Protocol for systems with barostat coupling time constant.
Attributes:
| Name | Type | Description |
|---|---|---|
pressure_coupling_time |
Array
|
Barostat time constant \(\tau_P\) (units: time). |
Source code in src/kups/core/typing.py
HasStressTensor
¶
Bases: Protocol
Protocol for systems with computed virial stress tensor.
Attributes:
| Name | Type | Description |
|---|---|---|
stress_tensor |
Array
|
Virial stress tensor \(\mathbf{W}\) (units: energy). |
Source code in src/kups/core/typing.py
HasSystemIndex
¶
HasTargetPressure
¶
Bases: Protocol
Protocol for systems with target pressure for barostat.
Attributes:
| Name | Type | Description |
|---|---|---|
target_pressure |
Array
|
Target pressure \(P_0\) (units: energy/length³). |
Source code in src/kups/core/typing.py
HasTemperature
¶
Bases: Protocol
Protocol for entities with temperature parameters.
Attributes:
| Name | Type | Description |
|---|---|---|
temperature |
Array
|
Temperature array [energy units], shape |
Source code in src/kups/core/typing.py
HasThermalEnergy
¶
Bases: Protocol
Protocol for systems with target thermal energy.
Attributes:
| Name | Type | Description |
|---|---|---|
thermal_energy |
Array
|
Thermal energy \(k_B T\) (units: energy). |
Source code in src/kups/core/typing.py
HasThermostatTimeConstant
¶
Bases: Protocol
Protocol for systems with thermostat coupling time constant.
Attributes:
| Name | Type | Description |
|---|---|---|
thermostat_time_constant |
Array
|
Thermostat time constant \(\tau\) (units: time). |
Source code in src/kups/core/typing.py
HasTimeStep
¶
Bases: Protocol
Protocol for systems with integration time step.
Attributes:
| Name | Type | Description |
|---|---|---|
time_step |
Array
|
Time step \(\Delta t\) (units: time). |
Source code in src/kups/core/typing.py
HasVelocities
¶
Bases: Protocol
Protocol for entities with velocity data.
Attributes:
| Name | Type | Description |
|---|---|---|
velocities |
Array
|
Array of velocities for each entity (e.g., atoms). |
Source code in src/kups/core/typing.py
HasWeights
¶
Bases: Protocol
Protocol for entities with weight/mass data.
Attributes:
| Name | Type | Description |
|---|---|---|
weights |
Array
|
Array of weights/masses for each entity (e.g., atoms). |