def vv_half_head

bend-prot@0.1.0.0 · sim.bend:175

import bend-prot@0.1.0.0/sim.bend as Sim
import Base
import bend-prot@0.1.0.0/geom.bend as G

175# Velocity Verlet halves over explicit state (forces must be fresh).
176def vv_half_head(h: DynAtom, +dt: F32) -> DynAtom:
177  match h:
178    case DA{serial, elem, pos, vel, +frc, +mass}:
179      acc = G.Vec3.scale(((1.0 / mass : F32) * acc_conv() : F32), frc)
180      +vh = G.Vec3.add(vel, G.Vec3.scale((0.5 * dt : F32), acc))
181      DA{serial, elem, G.Vec3.add(pos, G.Vec3.scale(dt, vh)), vh, frc, mass}

Uses (7)

Used by (2)