def offset_momentum(ref, bodies, px=0.0, py=0.0, pz=0.0):
	for w in bodies:
		r, v, m = w
		vx, vy, vz = v

		px -= vx * m
		py -= vy * m
		pz -= vz * m
	(r, v, m) = ref
	v[0] = px / m
	v[1] = py / m
	v[2] = pz / m
dataset/ETHPy150Open PythonJS/PythonJS/regtests/bench/nbody.py/offset_momentum/original