# NumericalAccuracyParameters¶

class NumericalAccuracyParameters(density_mesh_cutoff=None, k_point_sampling=None, radial_step_size=None, density_cutoff=None, interaction_max_range=None, number_of_reciprocal_points=None, reciprocal_energy_cutoff=None, bands_per_electron=None, occupation_method=None, exx_grid_cutoff=None, exact_exchange_parameters=None, compensation_charge_mesh_cutoff=None, grid_mesh_cutoff=None, electron_temperature=None)

Class for representing the parameters for setting the numerical accuracy of a calculation.

Some parameter defaults are specific for each calculator, see HuckelCalculator, SlaterKosterCalculator, SemiEmpiricalCalculator, LCAOCalculator, PlaneWaveCalculator, DeviceHuckelCalculator, DeviceSlaterKosterCalculator, DeviceSemiEmpiricalCalculator, or DeviceLCAOCalculator.

Parameters: density_mesh_cutoff (PhysicalQuantity of type energy | GridSampling | OptimizedFFTGridSampling) – The mesh cutoff to be used to determine the density grid sampling. The mesh cutoff must be a positive energy or a GridSampling object. Default: Specific for each calculator. k_point_sampling (sequence (size 3) of int | MonkhorstPackGrid | KpointDensity) – The k-point sampling in reciprocal space given either as a grid (specifying the three Monkhorst-Pack indices or a MonkhorstPackGrid object), or a density (specifying a MonkhorstPackGrid object). Default: Specific for each calculator. radial_step_size (PhysicalQuantity of type length) – The maximum sampling step size in all the radial grids. Must be positive. Default: Specific for each calculator. density_cutoff (float) – The density cutoff determines the limit where a density is considered to to be zero. Smaller values therefore leads to longer ranges and less sparsity of the models. Must be positive. Default: 1.0e-6 interaction_max_range (PhysicalQuantity of type length) – The maximum allowed interaction distance between two orbitals. Default: Specific for each calculator. number_of_reciprocal_points (int) – The number of reciprocal points used for evaluating two-center integrals. Must be larger than 1. Default: 1024 reciprocal_energy_cutoff (PhysicalQuantity of type energy) – The energy cutoff in reciprocal space used for evaluating of the two-center integrals. Must be positive. Default: 1250 * Hartree bands_per_electron (float) – The number of bands per electron. The number must be 1.0 or larger. Only used by the PlaneWaveCalculator. The bands_per_electron determines how many bands are included in the PlaneWaveCalculator scf loop for calculating the electron density. A value of 1.0 implies that only occupied states are included, which would only be correct at zero temperature. The default value of 1.2 means that if there are 10 electrons in a configuration there will be 5 occupied bands (assuming spin degeneracy) and one unoccupied band included in the calculation. In case of slow or non-converging calculations, increasing the bands_per_electron can in some cases help convergence. For Bandstructure calculations, the default number of bands included for a PlaneWaveCalculator is also determined by the bands_per_electron. Default: 1.2 occupation_method (FermiDirac | GaussianSmearing | MethfesselPaxton | ColdSmearing) – The method to calculate state occupations. Default: Specific for each calculator. exx_grid_cutoff (PhysicalQuantity | GridSampling | OptimizedFFTGridSampling) – The energy cutoff/grid sampling that determines the grid size used for representing the the local exact exchange potential in plane-wave hybrid functional calculations. For lossless calculations the grid sizes should be twice that needed to represent the wave functions. However, one may use a smaller grid for faster calculations. Default: The same value as used for ‘density_mesh_cutoff’ exact_exchange_parameters (ExactExchangeParameters) – The parameters that control the accuracy of exact exchange. compensation_charge_mesh_cutoff (PhysicalQuantity | GridSampling | OptimizedFFTGridSampling) – The energy cutoff/grid sampling that determines the grid size on which the compensation charge is stored in a PAW calculation. When running HSE calculations, a higher value may be necessary because the screened XC potential used in HSE is more sensitive to grid fluctuations. Default: The same value as used for ‘density_mesh_cutoff’. electron_temperature (PhysicalQuantity of type temperature) – Deprecated since version 2016.1: Use occupation_method=FermiDirac(electron_temperature) instead. The electron temperature used in determining the shape of the Fermi function. Must be positive.
bandsPerElectron()
Returns: The bands per electron. float
compensationChargeMeshCutoff()
Returns: The energy cutoff/grid sampling used for the compensation charge. PhysicalQuantity | GridSampling | OptimizedFFTGridSampling
densityCutoff()
Returns: The density cutoff. float
densityMeshCutoff()
Returns: The density mesh cutoff. PhysicalQuantity of type energy | GridSampling
electronTemperature()
Returns: The electron temperature. PhysicalQuantity of type energy
exactExchangeParameters()
Returns: parameters for setting the numerical accuracy of an exact exchange calculation. ExactExchangeParameters
exxGridCutoff()
Returns: The energy cutoff/grid sampling used for the exact exchange potential. PhysicalQuantity | GridSampling | OptimizedFFTGridSampling
gridMeshCutoff()
Returns: The density mesh cutoff. PhysicalQuantity of type energy | GridSampling

Deprecated since version Use: densityMeshCutoff() instead.

interactionMaxRange()
Returns: The interaction max range. PhysicalQuantity of type length
kPointSampling()
Returns: The k-point sampling. MonkhorstPackGrid | KpointDensity
numberOfReciprocalPoints()
Returns: The number of reciprocal points used in two-center integration. int
occupationMethod()
Returns: The occupation method. FermiDirac | GaussianSmearing | MethfesselPaxton | ColdSmearing
radialStepSize()
Returns: The radial grid sampling. PhysicalQuantity of type length
reciprocalEnergyCutoff()
Returns: The reciprocal cutoff energy. PhysicalQuantity of type energy

## Usage Examples¶

Define the k-point sampling and real space grid mesh-cutoff.

numerical_accuracy_parameters = NumericalAccuracyParameters(
density_mesh_cutoff=12.0*Hartree,
k_point_sampling=MonkhorstPackGrid(2, 1, 1),
electron_temperature = 200*Kelvin
)

calculator = HuckelCalculator(
iteration_control_parameters=iteration_control_parameters,
)


Specify the electron temperature in units of eV instead of Kelvin

numerical_accuracy_parameters = NumericalAccuracyParameters(
electron_temperature=0.02 * electronVolt/boltzmann_constant
)


## Notes¶

• The distance between the points in the real space grid, $$\Delta x$$, is related to the density_mesh_cutoff, $$E^\mathrm{grid}$$, through

$\Delta x = \frac{\pi \hbar}{\sqrt{2 m E^{grid}}}.$

In atomic units $$m = \hbar = 1$$ , thus for energies in Hartree and distances in Bohr, $$\Delta x = \pi/\sqrt{2 E^\mathrm{grid}}$$.

• When setting interaction_max_range some matrix elements are set to zero. For very long ranged basis sets this can make the overlap matrix ill defined at certain k-points (i.e. it is not positive definite), in such cases the matrix diagonalization routine will give a segmentation fault. The cure is to change the interaction_max_range, i.e. either make it very large to include all long range elements, or make it small so no long range elements are included.