# Getting started ## Running a calculation DFTSW27 reads one input file and writes its report to standard output: ```console $ OMP_NUM_THREADS=8 ./run_dft input.yaml > output.out ``` Always set `OMP_NUM_THREADS`; the program is OpenMP-parallel. The basis-set files are in the `basis/` directory of the distribution and are referenced from the input as `basis/.nw`. For a first calculation, work through {doc}`Tutorial 1 <../tutorials/01_scf/index>` and the {doc}`tour of the input file <../tutorials/20_inputs/index>` and {doc}`of the output <../tutorials/21_output/index>`. ## Input format The input is a restricted subset of YAML: sections start in column 1, keys are indented below them, `#` starts a comment. An unknown key inside `sic:` stops the run, so check spelling. ```{literalinclude} ../examples/h2o_pbe.yaml :language: yaml ``` | Section | Purpose | |---|---| | `system` | charge, `unpaired_electrons` (n$_\alpha$ − n$_\beta$), `units` (`bohr` default or `angstrom`) | | `functional` | exchange, correlation, hybrids, local hybrids, dispersion ({doc}`dft`, {doc}`localhybrid`) | | `basis` | NWChem-format basis file (`file:`; the `name:` is only a label). Cartesian functions only | | `coulomb` | how the Coulomb matrix is built: `eri`, `poisson`, `density_fitting`, `analytic` | | `scf`, `mixing` | convergence, guess, spin occupation, restart ({doc}`scf`) | | `job`, `optimization`, `frequencies`, `raman` | what to compute ({doc}`vibrations`, {doc}`ir_raman`) | | `sic` | self-interaction correction ({doc}`flosic`) | | `cube` | volumetric output ({doc}`cube`) | | `atoms` | element, `position`, optional `moment`, `core`, per-atom `mesh` | Geometries can also come from an XYZ file: `system: geometry_file: mol.xyz`, with per-atom overrides in `atoms:` selected by `index` or `element`. ## The integration grid and the Coulomb method DFT needs a numerical grid. Each atom has its own mesh (`mesh: {nrpt: ..., lm: ...}` in its `atoms:` entry); by default the program uses a table of meshes that is accurate for energy differences. Atoms with an explicit `lm` get that angular order for everything. For comparisons with integral-based programs use `coulomb: method: eri`. Unless you choose a method, DFTSW27 uses the numerical **Poisson** solver for DFT energy runs and all SIC runs, and exact integrals (`eri`) for Hartree–Fock, gradients, TDDFT and noncollinear runs. The choice is printed at the start of the output. Poisson energies differ from `eri` by about 10⁻⁵ Ha for small molecules. See [Becke and Dickson](#ref-poisson) for the solver and [Becke](#ref-becke88) for the grid scheme. ## Reading the output The output starts with the input echo and the method summary, then lists one line per SCF iteration (`e_total`, energy change, density change, DIIS error), the orbital energies and a `Results` block: ```text Results ================================================================ converged = T iterations = 9 e_total (Ha) = -76.3773251306 ``` The line `grid quadrature: integrated density = ... error = ...` tells you whether the grid is adequate: an error above about 10⁻⁶ means energies are off at the mHa level and a finer mesh is needed. {doc}`Tutorial 21 <../tutorials/21_output/index>` reads a complete output block by block. ## Reference documents The distribution contains the *User Manual* (every input key, concise) and the *complete reference* `z_fullM.pdf` (theory and details). This site follows them but is deliberately shorter.