def md_thermo
import bend-prot@0.1.0.0/sim.bend as Simimport Base
203# Berendsen thermostat folded into the step (T == 0 keeps velocities).
204def md_thermo(+ds: List<&2, DynAtom>, +dt: F32, +tau: F32, +temp0: F32, +n: Nat) -> List<&2, DynAtom>:
205 +now = temp_of_ds(ds, n)
206 vv_scale(ds, Bool.pick(F32, F32.is_eq(now, 0.0), 1.0, F32.sqrt((1.0 + (dt / tau : F32) * ((temp0 / now : F32) - 1.0 : F32) : F32))))