View source on GitHub |
A multi-dimension grid of points with an assigned length scale.
openfermion.utils.Grid(
dimensions, length, scale
)
Used in the notebooks
Used in the tutorials |
---|
This grid acts as a helper class for parallelpiped super cells. It tracks a mapping from indices to grid points and stores the associated reciprocal lattice with respect to the original real-space lattice. This enables calculations with non-trivial unit cells.
Methods
all_points_indices
all_points_indices()
Returns: iterable[tuple[int]]: The index-coordinate tuple of each point in the grid.
grid_indices
grid_indices(
qubit_id, spinless
)
This function is the inverse of orbital_id.
Args | |
---|---|
qubit_id
|
int
The tensor factor to map to grid indices. |
spinless
|
bool
Whether to use the spinless model or not. |
Returns | |
---|---|
grid_indices
|
numpy.ndarray[int]
The location of the qubit on the grid. |
index_to_momentum_ints
index_to_momentum_ints(
index
)
Args: index (tuple): d-dimensional tuple specifying index in the grid Returns: Integer momentum vector
momentum_ints_to_index
momentum_ints_to_index(
momentum_ints
)
Args: momentum_ints (tuple): d-dimensional tuple momentum integers Returns: d-dimensional tuples of indices
momentum_ints_to_value
momentum_ints_to_value(
momentum_ints, periodic=True
)
Args: momentum_ints (tuple): d-dimensional tuple momentum integers periodic (bool): Alias the momentum Returns: ndarray containing the momentum vector.
momentum_vector
momentum_vector(
momentum_indices, periodic=True
)
Given grid point coordinate, return momentum vector with dimensions.
Args | |
---|---|
momentum_indices
|
list
integers giving momentum indices. Allowed values are ints in [0, grid_length). |
periodic
|
bool
Wrap the momentum indices according to periodicity |
Returns
|
momentum_vector: A numpy array giving the momentum vector with dimensions. |
orbital_id
orbital_id(
grid_coordinates, spin=None
)
Return the tensor factor of a orbital with given coordinates and spin.
Args | |
---|---|
grid_coordinates
|
List or tuple of ints giving coordinates of grid element. Acceptable to provide an int(instead of tuple or list) for 1D case. |
spin
|
bool
0 means spin down and 1 means spin up. If None, assume spinless model. |
Returns | |
---|---|
tensor_factor
|
int
tensor factor associated with provided orbital label. |
position_vector
position_vector(
position_indices
)
Given grid point coordinate, return position vector with dimensions.
Args | |
---|---|
position_indices (int|iterable[int]): List or tuple of integers giving grid point coordinate. Allowed values are ints in [0, grid_length). |
Returns | |
---|---|
position_vector (numpy.ndarray[float]) |
volume_scale
volume_scale()
Returns: float: The volume of a length-scale hypercube within the grid.
__eq__
__eq__(
other
)
Return self==value.
__ne__
__ne__(
other
)
Return self!=value.