# densityToNumberOfKpoints¶

densityToNumberOfKpoints(kpoint_density, configuration, parity=None)

Convert a k-point density to numbers of k-points in the kA, kB, and kC directions.

Parameters: kpoint_density (Positive PhysicalQuantity of type length | Positive PhysicalQuantity(3) of type length) – The density of k-points for the kA, kB, and kC directions specified collectively by one value or individually by three values e.g. 12*Angstrom or [10.0, 12.0, 11.0]*Angstrom. configuration (BulkConfiguration) – The configuration whose Brillouin zone should be resolved. parity (None | Odd | Even | list(3) of Odd, Even, and None) – Forces the number of k-points to be odd or even. It can be specified collectively by one parity flag or individually by a list of three parity flags for the kA, kB, and kC directions. Default: None (No favored parity) A list with the numbers of k-points in the kA, kB, and kC directions. array(3) of int

## Usage Examples¶

Calculate the number of k-points in the A, B, and C direction corresponding to a k-point density

# Set up configuration
bulk_configuration = BulkConfiguration(
bravais_lattice=FaceCenteredCubic(5.4306*Angstrom),
elements=[Silicon, Silicon],
cartesian_coordinates=[[0.0    , 0.0    , 0.0     ],
[1.35765, 1.35765, 1.35765]]*Angstrom
)

# Get the number of k-points for a given k-point density.
[n_kx, n_ky, n_kz] = densityToNumberOfKpoints(9.5*Ang, bulk_configuration)

# Yields [20.0, 20.0, 20.0]


Calculate the odd numbers of k-points corresponding to a k-point density:

[n_kx, n_ky, n_kz] = densityToNumberOfKpoints(9.5*Ang, bulk_configuration, Odd)

# Yields [ 21.0,  21.0,  21.0]


Calculate the numbers of k-points corresponding to an anisotropic k-point density:

[n_kx, n_ky, n_kz] = densityToNumberOfKpoints([7.5, 10.0, 10.0]*Ang, bulk_configuration)

# Yields [ 16.0,  21.0,  21.0]


Calculate the even numbers of k-points corresponding to an anisotropic k-point density:

[n_kx, n_ky, n_kz] = densityToNumberOfKpoints([7.5, 10.0, 10.0]*Ang, bulk_configuration, Even)

# Yields [ 16.,  22.,  22.]


Calculate the odd numbers of k-points in the A direction, and even numbers of k-points in the B and C directions corresponding to an anisotropic k-point density:

[n_kx, n_ky, n_kz] = densityToNumberOfKpoints([7.5, 10.0, 10.0]*Ang, bulk_configuration, [Odd, Even, Even])

# Yields [17.0, 22.0, 22.0]


## Notes¶

The number of k-points are determined by ceiling to the nearest integer, or in the Even/Odd case rounding up to the nearest even/odd integer.