Periodic Boundary Conditions

xtb supports three-dimensional (3D) periodic boundary conditions (PBC) at the Γ-point for tight-binding and force-field calculations, including single-point evaluations and periodic geometry optimizations. For a more complete periodic integration (such as Brillouin-zone k-point sampling), DFTB+ (see the tblite DFTB+ documentation) or CP2K (see the CP2K xTB documentation) should be used.

Supported Methods

The following methods can be used for 3D periodic systems in xtb:

  • GFN2-xTB and GFN1-xTB (via tblite): Periodic GFN2-xTB and GFN1-xTB calculations are carried out through the tblite backend and require passing the --tblite flag on the command line:

    > xtb coord --tblite            # periodic GFN2-xTB (default GFN level)
    > xtb coord --gfn 2 --tblite    # periodic GFN2-xTB
    > xtb coord --gfn 1 --tblite    # periodic GFN1-xTB
    

    Both methods provide total energies, analytical nuclear gradients, and analytical lattice stress/strain derivatives. Spin-polarized periodic GFN1-xTB and GFN2-xTB calculations are also available by combining --spinpol with --tblite.

    Important

    The legacy native periodic implementations of GFN1-xTB and GFN2-xTB in xtb are deprecated and unsupported. Running a periodic GFN1-xTB or GFN2-xTB calculation without --tblite will terminate with an error.

  • GFN-FF and mcGFN-FF: The general force field GFN-FF (--gfnff / --gff) and its reparameterization for molecular crystals mcGFN-FF (--mcgfnff) natively support 3D periodic boundary conditions. See GFN-Force-Field (GFN-FF) for details and examples.

  • GFN0-xTB: The legacy native GFN0-xTB implementation (--gfn 0) remains available for 3D periodic systems. Known limitations in its PBC treatment remain, including loss of translational invariance for some structures near periodic boundaries.

Periodic Geometry Input

xtb reads 3D periodic structures from several file formats (see Geometry Input for full specifications):

  • Turbomole coord files (coord, *.coord, *.tmol) containing $periodic 3 together with $lattice [bohr|angs] or $cell [bohr|angs] and either Cartesian ($coord [bohr|angs]) or fractional ($coord frac) atomic coordinates:

    mgo.coord
    $coord frac
        0.00      0.00      0.00      mg
        0.50      0.50      0.50      o
    $periodic 3
    $lattice bohr
        0.0000000000      4.1000443765      4.1000443765
        4.1000443765      0.0000000000      4.1000443765
        4.1000443765      4.1000443765      0.0000000000
    $end
    
  • VASP POSCAR / CONTCAR files (POSCAR, CONTCAR, *.vasp, *.poscar, *.contcar).

  • DFTB+ genFormat files (*.gen) with periodic S (supercell/Cartesian) or F (fractional) coordinates and lattice vectors.

Note

Molecular formats such as .xyz, .pdb, .mol, and .sdf do not store periodic boundary conditions in xtb.

Periodic Geometry Optimization

Geometry optimizations of periodic structures are requested with --opt [LEVEL]:

> xtb POSCAR --gfn 2 --tblite --opt
> xtb mgo.coord --gfn 1 --tblite --opt tight
> xtb benzene.coord --mcgfnff --opt

For periodic systems, --opt automatically selects the periodic L-BFGS optimizer (pbc_lbfgs) instead of ANCopt, while the optimization engine can also be set in the Detailed Input file (e.g., engine=pbc_lbfgs or engine=inertial, see Geometry Optimization). For pbc_lbfgs, the optimizer convergence thresholds currently retain the historical fixed PBC settings and are not changed by LEVEL; the selected level still controls the default electronic-structure accuracy where applicable. By default, both atomic coordinates and unit-cell lattice vectors are relaxed simultaneously.

To optimize only the atomic coordinates while keeping the unit-cell lattice vectors fixed, pass the --nocellopt flag:

> xtb POSCAR --tblite --opt --nocellopt

Performing a fixed-cell pre-optimization with --nocellopt can also be helpful on rough potential energy surfaces before relaxing the unit cell.

The final optimized structure (atomic coordinates and updated lattice vectors) is written to xtbopt.<ext> in the input format (e.g., xtbopt.coord, xtbopt.poscar, xtbopt.gen), and the optimization trajectory is written to xtboptlog.cif in CIF format with the step energy included in a comment header for each frame. If the final structure does not have the lowest energy encountered along the trajectory, the lowest-energy structure is additionally saved to xtbopt_emin.coord.