schr.utils.grid module

Grid generation utilities for quantum simulations.

schr.utils.grid.create_grid_1d(x_min: float, x_max: float, nx: int, dtype: ~numpy.dtype = <class 'jax.numpy.float32'>) tuple[Array, float][source]

Create 1D spatial grid.

Parameters:
  • x_min – Minimum x coordinate (a.u.).

  • x_max – Maximum x coordinate (a.u.).

  • nx – Number of grid points.

  • dtype – JAX dtype (default: float32).

Returns:

Grid points and spacing (a.u.).

Return type:

Tuple (x, dx)

Raises:

ValueError – If nx < 2 or x_max <= x_min.

schr.utils.grid.create_grid_2d(x_min: float, x_max: float, nx: int, y_min: float, y_max: float, ny: int, dtype: ~numpy.dtype = <class 'jax.numpy.float32'>) tuple[Array, Array, float, float][source]

Create 2D spatial grid.

Parameters:
  • x_min – Minimum x coordinate (a.u.).

  • x_max – Maximum x coordinate (a.u.).

  • nx – Number of x grid points.

  • y_min – Minimum y coordinate (a.u.).

  • y_max – Maximum y coordinate (a.u.).

  • ny – Number of y grid points.

  • dtype – JAX dtype (default: float32).

Returns:

2D meshgrid arrays (shape: ny × nx) and spacings (a.u.).

Return type:

Tuple (X, Y, dx, dy)

Raises:

ValueError – If grid parameters are invalid.

schr.utils.grid.create_grid_3d(x_min: float, x_max: float, nx: int, y_min: float, y_max: float, ny: int, z_min: float, z_max: float, nz: int, dtype: ~numpy.dtype = <class 'jax.numpy.float32'>) tuple[Array, Array, Array, float, float, float][source]

Create 3D spatial grid.

Parameters:
  • x_min – Minimum x coordinate (a.u.).

  • x_max – Maximum x coordinate (a.u.).

  • nx – Number of x grid points.

  • y_min – Minimum y coordinate (a.u.).

  • y_max – Maximum y coordinate (a.u.).

  • ny – Number of y grid points.

  • z_min – Minimum z coordinate (a.u.).

  • z_max – Maximum z coordinate (a.u.).

  • nz – Number of z grid points.

  • dtype – JAX dtype (default: float32).

Returns:

3D meshgrid arrays (shape: nz × ny × nx) and spacings (a.u.).

Return type:

Tuple (X, Y, Z, dx, dy, dz)

Raises:

ValueError – If grid parameters are invalid.