pynbody.gravity.all_pm#
- pynbody.gravity.all_pm(f: SimSnap, ngrid: int = 10)[source]#
Calculate the potential and acceleration for all particles in the snapshot using a Particle-Mesh algorithm. This is faster than, but much less accurate than,
pynbody.gravity.all_direct()
. It also takes into account periodicity of the box.The results are stored inside the snapshot itself, as
f['phi']
andf['acc']
.Warning
PM calculations assume periodic boundary conditions, and are only accurate on large scales (much larger than
- Parameters:
f – The snapshot to calculate the potential and acceleration for
ngrid – The number of grid points to use in each dimension for the Particle-Mesh calculation.