# Reading a complete output :::{admonition} Video :class: tip [Watch the narrated video of this tutorial on YouTube](https://www.youtube.com/watch?v=WzEOuDvM_x8). ::: :::{admonition} In this tutorial :class: tip You read one complete DFTSW27 output from the first line to the last: water, PBE0/def2-TZVP, optimized, analyzed for vibrations and thermochemistry, with a population analysis. Every block is shown with its lines and explained: what the numbers are, which ones to check, and what a problem looks like. The same text is the narration of the video, which scrolls through the output. **Time:** 6.7 s on 16 cores. **Files:** {download}`h2o_full.yaml `, {download}`h2o_full.out ` (the output read here), {download}`run.sh `. ::: ## The input ```yaml system: charge: 0 unpaired_electrons: 0 units: angstrom functional: backend: libxc exchange: HYB_GGA_XC_PBEH correlation: none basis: name: def2-TZVP file: basis/def2-TZVP.nw scf: conv_tol: 1.0e-9 job: task: opt_freq analysis: population: both atoms: - element: O position: [0.000000, 0.000000, 0.130000] - element: H position: [0.000000, 0.780000, -0.480000] - element: H position: [0.000000, -0.780000, -0.480000] ``` The starting geometry is deliberately a little off the minimum. `task: opt_freq` optimizes and then computes frequencies, `analysis: population: both` adds the Mulliken and Löwdin analysis. Run it with ``` OMP_NUM_THREADS=16 ./run_dft tutorials/21_output/files/h2o_full.yaml > h2o_full.out ``` ## The output, block by block The output has 549 lines. Each block below is quoted from it, in order; the SCF iterations 2–9 and the later geometry steps repeat the pattern of the first and are skipped. ### Banner ```text ================================================================ DFTSW27 (Density Functional Theory in SouthWest 2027) Developers: Rajendra Zope, Yoh Yamamoto, Tunna Baruah Contributors to earlier versions: Carlos Diaz, Luis Basurto, Zachary Buschmann, Po-Hao Chang, Selim Romero ================================================================ git version : 24f48cc-dirty run by : rzope on diaz at 2026-10-23 08:34:52 OpenMP threads : 16 ``` The banner names the code and its developers. `git version` is the output of `git describe --dirty` at build time: the commit of the source the executable was built from, with `-dirty` if the working tree had uncommitted changes. Quote it when you report a problem. `run by` gives the user, the host and the start time, and `OpenMP threads` the value of `OMP_NUM_THREADS`. ### Geometry summary ```text run_dft: reading ../files/h2o_full.yaml ================================================================ --- geometry summary --- natoms = 3 total nuclear Z = 10.0000 charge = 0.0000 total electrons = 10.0000 unpaired electrons = 0.0000 ``` `run_dft: reading` names the input file. The geometry summary gives the number of atoms, the total nuclear charge, the charge you asked for, the number of electrons and the number of unpaired electrons ($N_\alpha-N_\beta$). Check these first: a wrong charge or multiplicity is the most common input mistake. ### Atoms ```text atom 1 O pos(Bohr)= 0.00000 0.00000 0.24566 moment= 0.00 core=ALL atom 2 H pos(Bohr)= 0.00000 1.47399 -0.90707 moment= 0.00 core=ALL atom 3 H pos(Bohr)= 0.00000 -1.47399 -0.90707 moment= 0.00 core=ALL ``` One line per atom: element, position in **bohr** (whatever `system: units` said), the initial local spin moment, and `core=ALL`, an all-electron atom (an ECP atom would show its core here). The molecule was given in angstrom, so $z_{\rm O}=0.130$ Å appears as 0.24566 bohr. ### Checks and Coulomb ```text analyze_geometry: OK coulomb: method = eri (default; poisson is not the default for task=opt_freq (analytic gradients)) ``` `analyze_geometry: OK` means the geometry passed the sanity checks (for example, no overlapping atoms and an electron count consistent with the charge and the unpaired electrons). The `coulomb:` line says how the Hartree potential is built and why: for tasks with analytic gradients, like this `opt_freq`, the default is exact two-electron integrals (`eri`); a single DFT energy would default to the numerical Poisson solver. ### Setup ```text n_alpha = 5, n_beta = 5 n_basis = 48 moment_mode = fixed grid points = 44568 (angular pruning: auto) initial guess = atomic_potential_fit method: DFT, backend=libxc, exchange=HYB_GGA_XC_PBEH, correlation=none Coulomb: ERI-based mixing: diis ``` `n_alpha`, `n_beta`: the number of occupied orbitals per spin. `n_basis = 48`: the Cartesian def2-TZVP functions of water. `moment_mode = fixed`: the spin state is kept. `grid points = 44568`: the size of the XC grid, with angular pruning. `initial guess`: the atomic-potential fit, the default. The method line names the functional (here the libxc PBE0 hybrid, one combined functional), `Coulomb: ERI-based` the Hartree and exchange builds, and `mixing: diis` the SCF accelerator. ### Task header ```text Running SCF ================================================================ ================================================================ Geometry optimization (delocalized internal coordinates, RFO/BFGS, lindh Hessian, trust 0.300) ================================================================ internal coordinates: 3 primitives (2 bonds, 1 angles, 0 dihedrals, 0 linear bends, 0 Cartesian) ``` `Running SCF` opens the calculation; because the task is `opt_freq`, the first thing printed is the optimizer: delocalized internal coordinates, RFO steps with a BFGS-updated Hessian that starts from a Lindh model Hessian, and a trust radius of 0.3. Water has 3 internal primitives: 2 bonds and 1 angle. ### SCF: first iteration ```text iter e_total dE max|dD| mix err time(s) TIME FOR xc + build_hammat 0.014 --- orbital energies, iter 1: n_alpha = 5, n_beta = 5, n_electrons_total = 10 alpha eigenvalues around HOMO-LUMO: # 3 HOMO-2 = -0.3932054778 occ=1.0000 # 4 HOMO-1 = -0.2185278633 occ=1.0000 # 5 HOMO = -0.1316095663 occ=1.0000 # 6 LUMO = 0.0591677564 occ=0.0000 # 7 LUMO+1 = 0.1379373294 occ=0.0000 # 8 LUMO+2 = 0.4081410546 occ=0.0000 alpha HOMO = -0.1316095663 LUMO = 0.0591677564 gap = 0.1907773227 beta eigenvalues around HOMO-LUMO: # 3 HOMO-2 = -0.3932054778 occ=1.0000 # 4 HOMO-1 = -0.2185278633 occ=1.0000 # 5 HOMO = -0.1316095663 occ=1.0000 # 6 LUMO = 0.0591677564 occ=0.0000 # 7 LUMO+1 = 0.1379373294 occ=0.0000 # 8 LUMO+2 = 0.4081410546 occ=0.0000 beta HOMO = -0.1316095663 LUMO = 0.0591677564 gap = 0.1907773227 iter 1 -76.2588164428 -7.625882E+01 1.726401E-01 1.735525E-01 0.024 ``` The first SCF is printed in full. Each `iter` line has the total energy, its change `dE` (the energy itself in iteration 1), the largest change of a density-matrix element `max|dD|`, the DIIS error `mix err` and the time of the iteration. Before it, the orbital energies of the iteration: three occupied and three virtual levels per spin around the gap, with occupations, then the HOMO and LUMO and the gap in Hartree. `TIME FOR ...` lines report the time of a step when it exceeds 0.01 s. ### SCF: converged ```text iter 10 -76.3761909265 1.989520E-13 2.954383E-10 2.091818E-10 0.024 ``` Iterations 2–9 repeat the pattern. The SCF stops at iteration 10, where both `max|dD|` ($2.95\times10^{-10}$) and `mix err` ($2.09\times10^{-10}$) are below `conv_tol: 1.0e-9`. The energy of the starting geometry is $-76.3761909265$ Ha. ### Gradient timings ```text TIME FOR gradient: two-electron 0.179 TIME FOR gradient: xc per-block loop 0.021 TIME FOR gradient: xc 0.022 ``` After the SCF the analytic gradient is built; the `TIME FOR gradient` lines give the time of the two-electron and exchange-correlation parts. ### Energy contributions ```text ---------------- geometry step 0 ---------------- Energy contributions (Ha) ------------------------- nuclear repulsion = 8.8898310975 kinetic = 75.9642706904 electron-nuclear (+ECP) = -198.5095802970 Coulomb (Hartree) = 46.5054413630 exchange = -9.2261537824 correlation = 0.0000000000 exchange + correlation = -9.2261537824 TOTAL ENERGY = -76.3761909265 ``` Every geometry step prints the energy by component: the nuclear repulsion, the kinetic energy, the electron–nuclear attraction, the Coulomb (Hartree) energy, exchange and correlation, and their sum, the total energy. For this combined libxc hybrid the whole exchange–correlation energy is booked on the `exchange` line and `correlation` is 0. The total at the starting geometry is $-76.3761909265$ Ha. ### Frontier orbitals ```text Frontier orbital energies ------------------------- Ha eV alpha HOMO -0.32473402 -8.836463 alpha LUMO 0.02428078 0.660714 alpha gap 0.34901480 9.497177 beta HOMO -0.32473402 -8.836463 beta LUMO 0.02428078 0.660714 beta gap 0.34901480 9.497177 HOMO (overall) -0.32473402 -8.836463 LUMO (overall) 0.02428078 0.660714 HOMO-LUMO gap 0.34901480 9.497177 ``` The frontier orbital energies for each spin and overall, in Hartree and eV. Water is a closed shell, so alpha and beta are identical. The gap here is 9.50 eV at the starting geometry. ### Forces and the optimizer table ```text Cartesian forces: max |F| = 3.4471E-02 (atom 1 O ), RMS F = 1.7606E-02 Ha/bohr opt energy (Ha) max|F| rms F max step rms step trust opt 0 -76.3761909265 3.447E-02 1.761E-02 3.532E-02 1.808E-02 3.000E-01 (max F, rms F, max step, rms step below threshold:) F F F F ``` The largest and the RMS Cartesian force, the oxygen having the largest. Then the optimizer's table: step number, energy, the largest and RMS force, the largest and RMS step, and the trust radius. The line below gives four flags (max force, RMS force, max step, RMS step below their thresholds): `T` means converged, `F` not yet. The optimization stops when all four are `T`. ### The next geometry ```text SCF converged in 9 iterations, E = -76.3777810284 ``` From the second geometry on, an SCF at a new geometry prints one summary line (inner SCFs are quiet; `scf: inner_output: full` prints them in full): the number of iterations and the energy. Each starts from the previous orbitals, so it needs 8–9 iterations. ### Converged ```text opt 4 -76.3779243635 2.671E-06 1.574E-06 1.629E-05 9.517E-06 3.000E-01 converged (max F, rms F, max step, rms step below threshold:) T T T T ``` At step 4 the largest force is $2.7\times10^{-6}$ Ha/bohr and all four flags are `T`: the optimization has converged. The energy fell from $-76.3761909265$ to $-76.3779243635$ Ha over the 5 gradient evaluations. ### Optimized geometry ```text Geometry optimization converged in 5 gradient evaluations Optimized geometry atom x y z (bohr) x y z (Angstrom) 1 O 0.00000000 -0.00000000 0.21185723 0.00000000 -0.00000000 0.11211002 ``` The converged geometry, in bohr and in Å, with the oxygen on the axis and the hydrogens in the $yz$ plane. The O–H distance follows from the coordinates, $\sqrt{0.76111^2+0.58317^2}=0.9588$ Å, and the H–O–H angle is $105.1^\circ$. The geometry is also written to `geom_final.xyz`. ### Final gradient ```text Nuclear gradient at the optimized geometry atom dE/dx dE/dy dE/dz (Hartree/bohr) 1 O 0.0000000000 -0.0000000000 0.0000026711 2 H -0.0000000000 -0.0000024085 -0.0000013355 3 H -0.0000000000 0.0000024085 -0.0000013355 max |g| = 2.6711E-06 rms = 1.5742E-06 |sum_A g_A| = 2.0848E-14 ``` The nuclear gradient at the optimized geometry: all components are below $3\times10^{-6}$ Ha/bohr. The last line gives the largest and RMS gradient and $|\sum_A g_A|$, the norm of the sum over atoms. It is $2\times10^{-14}$: the net force on the molecule vanishes (translational invariance), a check of the gradient. ### Optimization summary ```text optimization converged = T, gradient evaluations = 5, time = 2.549 s trajectory with forces (extended XYZ; Angstrom, Ha/bohr): opt_traj_forces.xyz final geometry (XYZ, Angstrom): geom_final.xyz ``` A one-line summary of the optimization (converged, number of gradient evaluations, time) and the files it wrote: the trajectory with forces (`opt_traj_forces.xyz`, extended XYZ) and the final geometry (`geom_final.xyz`). ### Results block ```text Results ================================================================ converged = T iterations = 8 e_total (Ha) = -76.3779243635 n_alpha_final = 5, n_beta_final = 5 moment (final) = 0 ``` The `Results` block of the SCF at the optimized geometry: converged, the iteration count, the total energy $-76.3779243635$ Ha, the final numbers of alpha and beta electrons, and the spin moment. ### Analytic Hessian ```text frequencies: analytic Hessian and dipole derivatives (CPHF, mod_hessian.F90) hessian: skeleton (second-derivative integrals) 1.39 s hessian: first-order Fock matrices 0.62 s hessian: exchange-correlation terms 0.34 s cphf iteration 1: max residual 2.77E-01 (9 perturbations active) cphf iteration 2: max residual 2.97E-02 (9 perturbations active) cphf iteration 3: max residual 6.35E-03 (9 perturbations active) cphf iteration 4: max residual 6.21E-04 (9 perturbations active) cphf iteration 5: max residual 1.24E-04 (9 perturbations active) cphf iteration 6: max residual 1.24E-05 (9 perturbations active) cphf iteration 7: max residual 1.05E-06 (9 perturbations active) cphf iteration 8: max residual 9.93E-08 (5 perturbations active) cphf iteration 9: max residual 7.79E-09 (5 perturbations active) cphf iteration 10: max residual 7.71E-10 (0 perturbations active) hessian: coupled-perturbed equations 1.71 s hessian: response terms 0.01 s ``` `task: opt_freq` continues with the harmonic analysis at the optimized geometry. The Hessian is analytic: first the second-derivative integrals, the first-order Fock matrices and the exchange–correlation terms (each with its time), then the coupled-perturbed equations, which are solved for all $3N=9$ nuclear displacements together. Each `cphf iteration` line shows the largest residual and how many perturbations are still active. The solver stops when all are below $10^{-9}$ (iteration 10). The asymmetry of the Hessian before it is symmetrized ($10^{-11}$ Ha/bohr$^2$) is a check of the numerics. ### Frequencies ```text Harmonic vibrational analysis ================================================================ mode frequency reduced mass force const IR intensity (cm^-1) (amu) (mdyn/A) (km/mol) 1 1623.08 1.0834 1.6816 81.7382 2 3851.32 1.0445 9.1278 6.6086 3 3961.93 1.0824 10.0107 50.6939 ``` One line per vibrational mode: the harmonic frequency (cm$^{-1}$; an imaginary mode would be marked `i`), the reduced mass (amu), the force constant (mdyn/Å) and the IR intensity (km/mol). Water has 3: the bend at 1623 cm$^{-1}$ and two stretches at 3851 and 3962 cm$^{-1}$ (PBE0/def2-TZVP, harmonic). ### Normal modes ```text Normal modes (Cartesian displacements, normalized) mode 1 2 3 cm^-1 1623.08 3851.32 3961.93 atom x y z x y z x y z 1 O 0.0000 0.0000 0.0710 -0.0000 -0.0000 -0.0494 0.0000 -0.0706 0.0000 2 H -0.0000 -0.4241 -0.5636 -0.0000 -0.5872 0.3924 0.0000 0.5599 -0.4290 3 H 0.0000 0.4241 -0.5636 -0.0000 0.5872 0.3924 0.0000 0.5599 0.4290 ``` The normal modes as Cartesian displacements of each atom (normalized), the three columns of each block being $x$, $y$, $z$. In mode 1 the hydrogens move mainly along $z$ and the oxygen opposite to them: the bend; in mode 3 the hydrogens move in opposite directions along $y$: the antisymmetric stretch. The file `freq: molden_file` writes them for animation. ### Thermochemistry I ```text Thermochemistry (ideal gas, rigid rotor, harmonic oscillator), T = 298.15 K, P = 101325.00 Pa rotational constants (cm^-1) = 27.69133 14.43727 9.48969 zero-point energy = 0.02149752 Ha ( 13.4899 kcal/mol) thermal correction to E = 0.02433301 Ha thermal correction to H = 0.02527720 Ha thermal correction to G = 0.00321012 Ha ``` The thermochemistry is the ideal-gas, rigid-rotor, harmonic-oscillator one at 298.15 K and 101325 Pa (`frequencies: temperature`, `pressure`). The rotational constants (cm$^{-1}$), the zero-point energy (0.0215 Ha = 13.49 kcal/mol) and the thermal corrections to $E$, $H$ and $G$ (Ha), added to the electronic energy. ### Thermochemistry II ```text E(el) + ZPE = -76.35642684 Ha E(el) + thermal E = -76.35359135 Ha H = E(el) + thermal H = -76.35264717 Ha G = E(el) + thermal G = -76.37471425 Ha S (trans, rot, vib, elec) = 34.6083 11.8288 0.0070 0.0000 cal/(mol K) S total = 46.4441 cal/(mol K) ``` The corrected energies: $E_{\rm el}+$ZPE, $E_{\rm el}$ + thermal $E$, the enthalpy $H$ and the free energy $G$ (Ha), then the entropy by contribution (translation, rotation, vibration, electronic; cal/(mol K)) and its total 46.44 cal/(mol K). A `symmetry_number` of 2 for water should be set in the input; it is not detected, and it changes $S_{\rm rot}$ and $G$. ### Frequency time, grid check ```text frequency time = 4.069 s (reference energy change after the displacements 0.00E+00 Ha) grid quadrature: integrated density = 10.00000874 Tr(DS) = 10.00000000 error = 8.74E-06 ``` `frequency time` and the check that the reference energy changed by $0.00$ Ha, because the SCF is redone at the reference geometry after any displacements. `grid quadrature` is the sanity check of {doc}`../01_scf/index`: the density integrated on the grid, 10.00000874, differs from 10 by $8.7\times10^{-6}$. ### Population analysis ```text Population analysis ================================================================ atom 1 (O ): Mulliken N = 8.63231 q = -0.63231 atom 1 (O ): Löwdin N = 8.59859 q = -0.59859 atom 2 (H ): Mulliken N = 0.68384 q = 0.31616 atom 2 (H ): Löwdin N = 0.70070 q = 0.29930 atom 3 (H ): Mulliken N = 0.68384 q = 0.31616 atom 3 (H ): Löwdin N = 0.70070 q = 0.29930 (written to POPULATION_ANALYSIS.dat) ``` `analysis: population: both` prints Mulliken and Löwdin charges. $N$ is the electron population of the atom and $q$ its charge: oxygen $-0.63$ (Mulliken) or $-0.60$ (Löwdin), each hydrogen $+0.32$ or $+0.30$. The numbers are also written to `POPULATION_ANALYSIS.dat`. Mulliken charges depend strongly on the basis set; compare them only between runs with the same basis. ### Spin populations ```text Spin populations (alpha - beta) per atom: atom 1 (O ): Mulliken = 0.00000 Löwdin = 0.00000 atom 2 (H ): Mulliken = 0.00000 Löwdin = 0.00000 atom 3 (H ): Mulliken = 0.00000 Löwdin = 0.00000 Spin contamination: N_alpha = 5.000000 N_beta = 5.000000 (computed) = 0.000000 (exact, S=Sz) = 0.000000 contamination = 0.000000 ``` The spin populations (alpha minus beta) per atom and the spin contamination: $\langle S^2\rangle$ computed from the orbitals against the exact value for the given $S_z$. All zero for this closed shell. For an open shell, `contamination` is the difference, a measure of how far the determinant is from a spin eigenstate. ### SUMMARY: energies ```text SUMMARY ================================================================ atoms = 3 basis functions = 48 charge = 0.00 SCF converged = T iterations = 8 Energy contributions (Ha) ------------------------- nuclear repulsion = 9.1779363896 kinetic = 76.0696878218 electron-nuclear (+ECP) = -199.1302304666 Coulomb (Hartree) = 46.7611395745 exchange = -9.2564576812 correlation = 0.0000000000 exchange + correlation = -9.2564576812 TOTAL ENERGY = -76.3779243635 ``` The `SUMMARY` block collects the final results again, so you need not search the log. First the system size and `SCF converged`, then the energy contributions of the last geometry, whose total is $-76.3779243635$ Ha. ### Dipole moment ```text Dipole moment (origin at coordinate origin) ------------------------------------------- nuclear (x,y,z) = 0.000000 -0.000000 -0.085472 a.u. electronic(x,y,z) = 0.000000 0.000000 -0.727682 a.u. total (x,y,z) = 0.000000 0.000000 -0.813154 a.u. |mu| = 0.813154 a.u. = 2.066831 Debye ``` The dipole moment about the coordinate origin: the nuclear part, the electronic part and their sum, in atomic units, and $|\mu|$ in a.u. and Debye. Here $|\mu|=0.8132$ a.u. = 2.07 D, along $-z$ (from the oxygen at $+z$ to the hydrogens). It is origin independent for a neutral molecule. ### Moment and frontier orbitals ```text Spin / magnetic moment ----------------------- N_alpha = 5.000000 N_beta = 5.000000 total magnetic moment (N_a - N_b) = 0.000000 mu_B Sz = 0.000000 = 0.000000 (exact 0.000000) Frontier orbital energies ------------------------- Ha eV alpha HOMO -0.32711444 -8.901237 alpha LUMO 0.03011288 0.819413 alpha gap 0.35722733 9.720651 beta HOMO -0.32711444 -8.901237 beta LUMO 0.03011288 0.819413 beta gap 0.35722733 9.720651 HOMO (overall) -0.32711444 -8.901237 LUMO (overall) 0.03011288 0.819413 HOMO-LUMO gap 0.35722733 9.720651 ``` The spin and magnetic moment summary ($N_\alpha-N_\beta$, $S_z$, $\langle S^2\rangle$ and the exact value) and the frontier orbital energies of the final SCF: the HOMO is at $-8.90$ eV and the gap 9.72 eV. ### Total time ```text Total time taken = 6.661 s ================================================================ ``` The last line is the wall-clock time of the whole run, 6.66 s here (optimization 2.5 s, frequencies 4.1 s). ## Files written next to the output | File | Contents | |---|---| | `geom_final.xyz` | The optimized geometry in Å. | | `opt_traj_forces.xyz` | Every geometry step with its forces (extended XYZ, Å and Ha/bohr). | | `evalues.log` | All $\alpha$ and $\beta$ eigenvalues and occupations at every SCF iteration (10 empty levels per spin). | | `POPULATION_ANALYSIS.dat` | The Mulliken and Löwdin populations. | ## What a problem looks like - **The SCF does not converge.** The `iter` lines keep changing `dE` by more than `conv_tol`. Look at the orbital energies of the last iterations: a gap that oscillates or closes points to a near-degenerate frontier, which usually needs a different spin state (`unpaired_electrons`), a level shift, or a different `initial_guess`. - **The optimization does not converge.** The flags under the optimizer table stay `F` for many steps and the trust radius shrinks. Check the forces: noisy forces mean the SCF or the grid is too loose. - **The grid check fails.** `grid quadrature ... error` far above $10^{-5}$ means the grid is too coarse for the basis; see `mesh:` in the input reference. - **An imaginary frequency.** A mode printed with an `i` after its frequency means the geometry is a saddle point, not a minimum; reoptimize from a displaced geometry. - **A warning about a non-stationary geometry before the frequencies.** The gradient at the input geometry is not zero: use `opt_freq` and not `frequencies`. ## Things to try 1. Add `scf: inner_output: full` and rerun: every SCF of the optimization is now printed in full, as the first one is. 2. Add `frequencies: symmetry_number: 2`: only the rotational entropy and the free energy in the thermochemistry change. 3. Change `task` to `energy`: the output stops after the SCF, and the `SUMMARY` block is the same. 4. Replace the functional by the in-house `exchange: pbe`, `correlation: pbe`, and compare the `Energy contributions`: now exchange and correlation are separate lines.