Skip to content

kups.application.observables.stress

State-binding constructors for virial stress observables.

These adapters extract particles, groups, and systems from a concrete simulation state and delegate to the state-agnostic virial-theorem functions in kups.observables.stress.

IsMolecularVirialState

Bases: IsState[IsMolecularVirialParticles, IsVirialSystems], Protocol

State with groups for molecular virial stress.

Source code in src/kups/application/observables/stress.py
class IsMolecularVirialState(
    IsState[IsMolecularVirialParticles, IsVirialSystems], Protocol
):
    """State with groups for molecular virial stress."""

    @property
    def groups(self) -> Table[GroupId, HasSystemIndex]: ...

molecular_virial_stress_from_state(key, state)

Compute molecular virial stress from a state.

Source code in src/kups/application/observables/stress.py
def molecular_virial_stress_from_state(
    key: Array, state: IsMolecularVirialState
) -> Table[SystemId, Array]:
    """Compute molecular virial stress from a state."""
    del key
    return molecular_stress_via_virial_theorem(
        state.particles, state.groups, state.systems
    )

virial_stress_from_state(key, state)

Compute atomic virial stress from a state.

Source code in src/kups/application/observables/stress.py
def virial_stress_from_state(
    key: Array, state: IsState[IsVirialParticles, IsVirialSystems]
) -> Table[SystemId, Array]:
    """Compute atomic virial stress from a state."""
    del key
    return stress_via_virial_theorem(state.particles, state.systems)