Skip to content

DFTB+

A fast and efficient versatile quantum mechanical simulation software package.


DFTB+ requires an environment module

In order to use DFTB+, you must first load the appropriate environment module:

module load intel openmpi

Preparing Input Files and Running DFTB+#

DFTB+ requires an input file named dftb_in.hsd. This file specifies the system being simulated, the calculation settings, and other parameters.

1. Create a Working Directory#

Create a directory for your simulation and navigate into it:

mkdir dftb_simulation
cd dftb_simulation

2. Download the DFTB+ Recipes Archive#

The DFTB+ Recipes archive contains input files and examples used throughout the DFTB+ tutorials. Downloading the archive is necessary for the first calculation example described below.

Download the archive:

wget https://dftbplus-recipes.readthedocs.io/en/latest/_downloads/5919f4094cd60c5c70c13b47928442f5/recipes.tar.bz2

Extract the archive:

tar -xjf recipes.tar.bz2

This creates a directory named recipes inside your working directory.

3. Download the Slater-Koster Parameter Files#

Slater-Koster files contain the parameter data required for DFTB+ calculations. The first calculation example requires these files to perform the simulation.

Navigate into the extracted Recipes directory:

cd recipes

Run the supplied script to download and unpack the Slater-Koster parameter sets:

./scripts/get_slakos

Once the downloads finish, return to your main simulation directory:

cd ..

4. Create the DFTB+ Input File#

DFTB+ expects an input file named dftb_in.hsd in the working directory from which the calculation is submitted.

Create the file using the terminal text editor:

nano dftb_in.hsd

For this example, we will be using the Geometry example from the DFTB+ First Calculation tutorial.

Paste the following script:

Geometry = GenFormat {
  3 C
    O H

    1 1  0.00000000000E+00 -0.10000000000E+01  0.00000000000E+00
    2 2  0.00000000000E+00  0.00000000000E+00  0.78306400000E+00
    3 2  0.00000000000E+00  0.00000000000E+00 -0.78306400000E+00
}

Driver = GeometryOptimization {
  Optimizer = Rational {}
  MovedAtoms = 1:-1
  MaxSteps = 100
  OutputPrefix = "geom.out"
  Convergence {GradElem = 1E-4}
}

Hamiltonian = DFTB {
  Scc = Yes
  SlaterKosterFiles {
    O-O = "recipes/slakos/mio-ext/O-O.skf"
    O-H = "recipes/slakos/mio-ext/O-H.skf"
    H-O = "recipes/slakos/mio-ext/H-O.skf"
    H-H = "recipes/slakos/mio-ext/H-H.skf"
  }
  MaxAngularMomentum {
    O = "p"
    H = "s"
  }
}

Options {}

Analysis {
  CalculateForces = Yes
}

ParserOptions {
  ParserVersion = 12
}

Saving the input file: In nano, press Ctrl + O to save, press Enter to confirm the filename, and then press Ctrl + X to exit. This keyboard shortcut is the same on Mac and Windows/Linux terminals. Do not use Command + S on a Mac.

5. Create a SLURM Submission Script#

DFTB+ calculations on the HPC cluster should be submitted through SLURM.

Make sure you are in the same working directory as dftb_in.hsd, then create the submission script:

nano submit_dftb.sh

Paste the following script:

#!/bin/bash
#SBATCH --job-name="dftb_firstcalc"
#SBATCH -n 1
#SBATCH -A genacc_q
#SBATCH --mail-type="ALL"
#SBATCH -t 00:15:00

module load intel openmpi

srun dftb+

Save the file using Ctrl + O, press Enter, and exit with Ctrl + X.

6. Submit the Calculation#

From your dftb_simulation directory, submit the job:

sbatch submit_dftb.sh

This will return a job ID confirming that the job was submitted.

Check the status of your job:

squeue --me

When the job finishes, an output file will generate named slurm-JOBID.out, where JOBID is the numeric job ID assigned during submission.

7. View the Calculation Output#

List the files in your working directory:

ls -lt

Locate the output file corresponding to your job ID and open it:

nano slurm-JOBID.out

Replace JOBID with your actual job ID.

You can also inspect the output files generated by DFTB+, including:

  • nano detailed.out: Detailed calculation results.
  • nano geom.out.gen: Optimized molecular geometry in GEN format.
  • nano geom.out.xyz: Optimized molecular geometry in XYZ format.
  • nano charges.bin: Saved charge information.

For a geometry optimization, a message such as Geometry converged indicates that the geometry optimization has successfully reached its convergence criteria.

For further information about how to use DFTB+, please refer to DFTB+ documentation.