do_binning#

diffsims.utils.discretise_utils.do_binning(x, loc, Rmax, d, GPU)[source]#

Utility function which takes in a mesh, atom locations, atom radius and minimal grid-spacing and returns a binned array of atom indices.

Parameters:
  • x (list [np.ndarray [float]], of shape [(nx,), (ny,), ...]) – Dictates the range of the box over which to bin atoms.

  • loc (np.ndarray, (n, 3)) – Atoms to bin.

  • Rmax (float > 3) – Maximum radius of an atom (rounded up to 3).

  • d (list of float > 0) – The finest permitted binning.

  • GPU (bool) – If True then constrains to memory of GPU rather than RAM.

Returns:

  • subList (np.ndarray [int]) – subList[i0,i1,i2] is a list of indices [j0, j1, …, jn, -1,…] such that the only atoms which are contained in the box: [x[0].min()+i0*r,x[0].min(),+(i0+1)*r] x [x[1].min()+i1*r,x[1].min(),+(i1+1)*r]…

  • r (np.ndarray [float]) – Size of each bin.

  • mem (int) – Upper limit of memory in bytes.