def dyn_set_force

bend-prot@0.1.0.0 · sim.bend:144

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

144# Set per-atom forces from a force list (truncates to the shorter).
145def dyn_set_force(ds: List<&2, DynAtom>, fs: List<&2, G.Vec3>) -> List<&2, DynAtom>:
146  match ds:
147    case Nil{}:
148      Nil{}
149    case h <> t:
150      match h:
151        case DA{serial, elem, pos, vel, frc, mass}:
152          match fs:
153            case Nil{}:
154              DA{serial, elem, pos, vel, G.V3{0.0, 0.0, 0.0}, mass} <> t
155            case f <> ft:
156              DA{serial, elem, pos, vel, f, mass} <> dyn_set_force(t, ft)

Uses (3)

Used by (2)