title: Is it possible to make this function on numpy array more efficient?
body: <p>Here <code>a</code> is a 1D array of integer indices. To give some context, <code>a</code> is the atom indices of the 1st molecules. The return is the atom indices for <code>n</code> identical molecules, each of which contains <code>step</code> atoms. This function basically applies the same atom selection to many molecules</p>
  <pre><code>def f(a, step, n):
      a.shape=1,-1
      got = np.repeat(a, n, axis=0)
      blocks = np.arange(0, n*step, step)
      blocks.shape = n, -1
      return got + blocks
  </code></pre>
  <p>For example</p>
  <pre><code>In [52]: f(np.array([1,3,4]), 10, 4)
  Out[52]:
  array([[ 1,  3,  4],
         [11, 13, 14],
         [21, 23, 24],
         [31, 33, 34]])
  
  </code></pre>