Skip to content

3.2 Relax atomic coordinates

These educational templates have not been executed and contain no fabricated numerical results. Inputs and filenames follow ABACUS 3.9.0 documentation; recheck every interface when changing version.

3.2.1 Question and declared model

How do you turn an energy-and-force calculation into a defensible equilibrium geometry? Relax the water coordinates from the preceding case at its accepted vacuum and cutoff. Keep the cell fixed. This isolates ionic optimization from cell optimization, and makes a useful small example of movable coordinates, residual forces and independent final validation.

3.2.2 Physical interpretation

Geometry optimization searches for a stationary point of the Born-Oppenheimer energy surface. BFGS updates an approximate inverse Hessian to choose a displacement; it does not make an unconverged electronic force accurate. Near a minimum the energy surface can be represented locally as a quadratic form. A force threshold is a stopping rule, not a certificate that every mode has positive curvature.

\[E(\mathbf R+\delta\mathbf R)\approx E(\mathbf R)-\mathbf F^T\delta\mathbf R+\tfrac12\delta\mathbf R^T H\delta\mathbf R.\]

Water has translation and rotation freedoms in vacuum. Choose a consistent representation when comparing structures: unwrap positions, align the molecule, then compare internal bond lengths and angle. A raw maximum Cartesian difference can be dominated by a rigid translation. The same lesson applies to a bulk crystal with fixed lattice, but its Brillouin-zone mesh and constraints must be adapted explicitly.

Scientific schematic: Energy surface E(q); Negative gradient; Free coordinates; Fresh SCF validation. No measured data.

Open figure at full size

Original course illustration; conceptual geometry and curves, not calculated results.

3.2.3 Worked input and file changes

# Replace/add these keys in the accepted isolated-water INPUT.
calculation relax
relax_method bfgs
relax_nmax 100
force_thr_ev 0.01
scf_thr 1e-9
cal_force 1
out_stru 1
suffix water_relax

# Every water atom retains its Cartesian_angstrom position,
# followed by the movement mask m 1 1 1 in STRU.
# KPT and the accepted fixed lattice are unchanged.

This is a precise delta to Water in a periodic vacuum box, not a complete standalone deck. Replace calculation scf with relax rather than retaining duplicate keys. Retain the accepted PP files, neutral spin setting, band count, PW basis and Gamma mesh. Use force_thr_ev in eV/Angstrom; the similarly named force_thr uses Ry/Bohr. Set only one of those equivalent controls to prevent conflicting intent. In the 3.9 schema relax_method is a single string. The newer beta's two-token algorithm selection is not used here. The movement mask m 1 1 1 lets every Cartesian component move; m 0 0 0 freezes an atom.

3.2.4 Run and inspect the evidence

Save each relaxation attempt in its own directory with the starting STRU. Inspect OUT.water_relax/running_relax.log at every ionic step: electronic convergence must precede use of the force. With out_stru enabled, the 3.9 documentation names step structures STRU_ION${istep}_D in OUT.water_relax. Identify the structure associated with the final evaluated energy using the log and step number; do not choose a file merely because its timestamp is newest. Copy the accepted structure into a fresh single-point directory, change calculation back to scf and request cal_force 1. Use tighter SCF and, as a separate comparison, a higher accepted cutoff to verify that the optimizer did not exploit numerical noise. Measure the two O-H lengths and H-O-H angle from the final geometry.

3.2.5 Observable-specific convergence

The example optimizer threshold is 0.01 eV/Angstrom. Verify the code's reported force criterion and inspect components; if your analysis uses the Euclidean norm, calculate that separately and state it. A stricter follow-up target might be less than 0.005 eV/Angstrom after a fresh SCF. Add a finite-difference sanity check for one H coordinate: displace it by plus and minus 0.005 Angstrom at fixed other coordinates and compare the central energy derivative with the reported force. Repeat with a smaller displacement if SCF noise allows. For a minimum claim, a vibrational check is a separate task; near-zero translations and rotations should not be confused with a chemically unstable stretching mode.

3.2.6 Acceptance worksheet and provenance

Use a geometry worksheet with the two O-H distances, H-O-H angle, maximum free-coordinate force component and the exact structure step associated with that force. To compute an angle, form both O-to-H vectors after unwrapping the molecule and evaluate arccos of their normalized dot product. Report degrees, while keeping any numerical library's radian conversion explicit. Do not use wrapped atom positions that place one hydrogen across the cell boundary.

For the derivative check, let h be the displacement in Angstrom and use F_x approximately equal to minus [E(x+h)-E(x-h)]/(2h). Both energies are in eV, giving eV/Angstrom. Select h large enough that the energy difference exceeds SCF noise but small enough for the central-difference approximation. A second smaller h tests that balance. Keep the plus and minus structures and their logs; otherwise the sign check cannot be reconstructed.

Geometry / derivative check Free-coordinate force (eV/Angstrom) O-H lengths (Angstrom), angle (degrees) Matched evaluated structure?
Initial geometry — — —
Final optimizer step — — —
Fresh tighter SCF / central difference — — —

Record constraints next to the table. Frozen coordinates are excluded only from a declared constrained optimization, never silently from a claim about an unconstrained minimum.

3.2.7 Pitfalls and limits

Reaching relax_nmax is not force convergence. A visually plausible molecule can remain far from the chosen tolerance. A frozen coordinate may carry a large force by design; distinguish unconstrained and constrained subspaces. A small energy difference between steps can indicate stagnation rather than success. Do not interpret 0.01 in force_thr as 0.01 eV/Angstrom. Finally, a final force evaluated with different PP files is not an independent check of the same energy surface; it is a different model requiring a new comparison.

3.2.8 Exercises with answer guidance

  1. Freeze oxygen and relax both hydrogens. Is the residual force on oxygen part of the stopping test you intend? Guidance: report constraints and judge the free-coordinate forces; an unconstrained minimum requires removing the constraint and retesting.
  2. The analytic H force and a finite-difference derivative have opposite signs. What convention should be checked first? Guidance: force equals minus the energy derivative. Keep displacement order, units and geometry labels explicit before blaming the optimizer.

3.2.9 Versioned references

The university-authored guide provides teaching context; older pages can predate 3.9. Use the linked official version for exact syntax. This is original instructional synthesis, and reference outputs are not presented as results of this course.