Changing the sample volume within the script

It can be useful to take a configuration corresponding to one density and rescale the box and particle coordinates such that it has a different density. This is accomplished by the following lines (which also show how to get the current volume and number of particles).

  nParticles = sim.GetNumberOfParticles()
  vol = sim.GetVolume()
  currentDensity = nParticles/vol
  sim.ScaleSystem( pow(newDensity/currentDensity, -1./3) )
where newDensity is understood to be the desired density.

Heine Larsen 2017-07-21