Tutorial 1: Setting up Simple ONETEP Calculations
Nicholas D.M. Hine and Chris-Kriton Skylaris
Input files
The value in eV’s will be converted internally to atomic units (Eh in this case). If a keyword is not specified in the input file, it is given a default value which is intended to work across a broad range of systems. A full list of keywords and blocks, giving their meaning, syntax and default values, can be found on the ONETEP keyowrd database: https://onetep.org/resources/keyword-database/
#' or!’ characters. Anything after
these characters on a given line will be ignored.Setting up the Input File
The number of NGWFs required can usually be judged from the symmetry of the atomic orbitals involved: In this case four for silicon and one for hydrogen will be adequate (can you think why?).
Running the Job
Convergence Convergence Convergence
Cutoff Energy
NGWF radius
Kernel Cutoff
This SiH\(_4\) system is too small to investigate convergence with respect to the cutoff of the density kernel. In larger systems truncation of the density kernel can be a good way to speed up the calculation. Indeed, asymptotically it is only by truncating the kernel that true `linear-scaling’ behaviour of the computational effort will be observed.
The kernel cutoff is controlled by the kernel_cutoff keyword. This defaults to 1000 Bohr (i.e. effectively infinite). Density kernel truncation should be used with a degree of caution: generally speaking, one would want to be able to run a full calculation for a fairly large system first, with an infinite cutoff, to establish a known baseline. Then, try decreasing the kernel cutoff from that point and see what the effect is on the total energy, on the level of NGWF convergence (as measured by the NGWF RMS gradient), and on the computation time. If significant time savings can be achieved without trading in too much accuracy, it may be worthwhile to bring down the cutoff for all similar calculations. Proceed with care, though as calculations with a truncated kernel tend to converge in a less stable manner.
Crystalline Silicon
Adjust your script to write a 5 × 5 × 5 supercell of the crystal (1000 atoms). Reduce the kernel cutoff to 25 bohr with kernel_cutoff: 25.0 and set the code to perform 1 NGWF iteration only maxit_ngwf_cg: 1 (otherwise the calculation would take longer to run, you can try this if you have time). To restore the symmetry, adjust the psinc_spacing value to be a divisor of the supercell length such that an exact number of grid points spans each unit cell of the crystal (pick a value which gives an effective cutoff energy close to 600.0 eV so as not to increase the run time too much) and and set off the 1000 atom job. This should not take too long on 32 cores.
Beyond around 500 atoms, the calculation should be into the so-called `linear-scaling’ regime, so the 8000 atom calculation should only take a little over 8 times the 1000 atom calculation. This is rather better than the nearly 512 times longer it would take with traditional cubic-scaling DFT!
Diagnosing Common Failures
With badly-chosen input settings, even fairly standard calculations in ONETEP will not converge, or may even converge to the wrong result. Fortunately, many of these problems are easy to fix with a bit of experience. In general, it is advisable to run with full output verbosity (output_detail: VERBOSE) the first few times you run a new kind of system, and to be on the lookout for any warnings or garbage numbers in the output (eg ****‘s in place of what should be real numbers). Remember that for the energy to be accurate, we must have simultaneous convergence of both the density kernel and the NGWFs. If either of these are not converging well by the end of the calculation, there may be a problem. In this section, we will briefly examine some reasons behind common types of convergence failure, and what to do to eliminate those failures and perform accurate simulations.
Problem: Repeated ’safe’ steps (of 0.150 or 0.100) during NGWF Conjugate Gradients optimisation, leading to poor or no convergence. This often means that the step length cap for NGWF CG is too short. Solution: increase ngwf_cg_max_step, eg to 8.0.
Problem: Repeated ‘safe’ steps (of 0.150 or 0.100) during LNV Conjugate Gradients optimisation, leading to poor or no convergence. This often means that the step length cap for LNV CG is too short. Solution: increase lnv_cg_max_step, eg to 8.0.
Problem: Occupancies `break’ during LNV optimisation of kernel. Examine the output with output_detail: VERBOSE and look at the occupancy error and occupancy bounds during the “Penalty functional idempotency correction” section of each LNV step. Check for occupancies outside the stable range (approx -0.3:1.3) or RMS occupancy errors not decreasing (particularly if no kernel truncation is applied). Solution: Activate LNV line step checking with lnv_check_trial_steps: T. This checks that the kernel is still stable after the proposed line step is taken.
Problem: Occupancies are `broken’ from start of calculation. Symptoms as above. Palser Manolopoulos may be unstable due to degeneracy or near-degeneracy at the Fermi level. Check the output of Palser Manolopoulos for warnings. Solution: If there is an initial degeneracy at the Fermi level, an O(N3 ) diagonalisation may be required to get a good starting kernel. Set maxit_palser_mano : -1.
Problem: RMS Commutator (HKS-SKH) of kernel and Hamiltonian stagnates (stops going down with each iteration) during LNV optimisation. This is a sign that the current set of NGWFs is not able to represent a density matrix that both reproduces the electron density that generated the Hamiltonian while simultaneously describing the occupied eigenstates of that Hamiltonian. If this problem does not start to go away after a few steps of NGWF optimisation, a better or larger initial set of NGWFs may be required. Solutions: Increase number of NGWFs per atom, increase radius of NGWFs, improve initial guess for NGWFs.
Problem: RMS NGWF gradient stagnates (stops going down) during NGWF CG optimisation, while energy is still going down slowly. This often suggests that the NGWFs may have expanded away from their centres to have significant value near the edge of their localisation region, and thus cannot optimise successfully. Solution: Increase NGWF radius. Sometimes increasing the kinetic energy cutoff helps as well. For smaller systems and initial tests, a useful check on the accuracy of the final result is to perform a full O(N\(^3\)) diagonalisation at the end of the calculation, if it is computationally feasible to do so. To activate this, turn on a properties calculation with do_properties: T, and then ask for an eigenvalue calculation of the first 100 eigenvalues either side of the Fermi energy, for the kernel and Hamiltonian matrices, by setting num_eigenvalues: 100. If all is well, then the occupation eigenvalues should all be close to 0.00000 or 1.00000 (empty or full) and the Hamiltonian eigenvalues should all be within a sensible range.
One final note if you’re not getting the result you expect – check the units on your atomic positions! ONETEP expects positions in Bohr if the units are not specified, so if your positions are in Angstroms, you will need to add ‘ang’ as the first line of the positions_abs block.
This completes tutorial 1.
Files for this tutorial: