GridSampling

class GridSampling(na, nb=None, nc=None)

Class for representing the grid sampling for real space grids.

The constructor takes the number of grid points in the three unitcell directions.

Parameters:
  • na (int) – Number of grid points to use along the primitive direction a. Must be larger than 3.

  • nb (int) – Number of grid points to use along the primitive direction b. Must be larger than 3.
    Default: The value of na

  • nc (int) – Number of grid points to use along the primitive direction c. Must be larger than 3.
    Default: The value of na

nA()
Returns:

The sampling along the direction of unit cell vector a.

Return type:

int

nB()
Returns:

The sampling along the direction of unit cell vector b.

Return type:

int

nC()
Returns:

The sampling along the direction of unit cell vector c.

Return type:

int

sampling()
Returns:

The grid sampling data as a tuple of three integers.

Return type:

tuple of int

setNA(value)

Set the sampling in the direction parallel to unit vector a to a specified value.

Parameters:

value (int) – The value to set the a sampling to. Must be larger than 3.

setNB(value)

Set the sampling in the direction parallel to unit vector b to a specified value.

Parameters:

value (int) – The value to set the b sampling to. Must be larger than 3.

setNC(value)

Set the sampling in the direction parallel to unit vector c to a specified value.

Parameters:

value (int) – The value to set the c sampling to. Must be larger than 3.

setSampling(sampling)

Set the sampling in all directions to a specified value.

Parameters:

sampling (int | tuple of int) – The number of grid points in the three unitcell directions as a tuple of three integers larger than 3. If a single number is given, it is used for all three directions.

uniqueString()

Return a unique string representing the state of the object.

Usage Examples

Use GridSampling to set density mesh cutoff.

numerical_accuracy_parameters=NumericalAccuracyParameters(
    density_mesh_cutoff=GridSampling(30,32,31),
    )

Use uniform GridSampling

# Set same grid sampling in each direction.
numerical_accuracy_parameters=NumericalAccuracyParameters(
    density_mesh_cutoff=GridSampling(30),
    )