JDFTx  1.0.0
A first calculation
water-200.png

A lot of effort in the research behind JDFTx has involved water: its dielectric response, equation of state, free energy functional etc. Therefore, a water molecule is a fitting first calculation: save the following to water.in:

# The input file is a list of commands, one per line
# The commands may appear in any order; group them to your liking
# Everything on a line after a # is treated as a comment and ignored
# Whitespace separates words; extra whitespace is ignored
# --------------- Water molecule example ----------------

# Set up the unit cell - each column is a bravais lattice vector in bohrs
# Hence this is a cubic box of side 10 bohr (Note that \ continues lines)
lattice \
    10 0  0 \
    0  10 0 \
    0  0  10

# Specify the pseudopotentials (this defines species O and H):
ion-species <path-to-build-directory>/pseudopotentials/GBRV/h_pbe_v1.uspp
ion-species <path-to-build-directory>/pseudopotentials/GBRV/o_pbe_v1.2.uspp

# Specify coordinate system and atom positions:
coords-type cartesian  #the other option is lattice (suitable for solids)
ion O   0.00 0.00  0.00  0  # The last 0 holds this atom fixed
ion H   0.00 1.13 +1.45  1  # while the 1 allows this one to move
ion H   0.00 1.13 -1.45  1  # during ionic minimization

dump-name water.$VAR  #Filename pattern for outputs
dump End Ecomponents  #Output energy components at the end

and modify the pseudopotential path. JDFTx comes with a set of ultrasoft pseudopotentials (*.uspp files) generated by USPP that we will use in these tutorials. Thet are located in the build directory. You can use other pseudopotentials, either ultrasofts (*.uspp) or norm-conserving pseudopotentials in the Abinit FHI format (*.fhi). Click here for more ideas about where to acquire pseudopotentials.

Additionally, if you are using a specific group of pseudopotentials, you can specify that group instead of listing the individual species. For instance, to utilize pbe pseudopotentials from the GBRV set that comes with JDFTx, you can use the two commands:

ion-species  GBRV/$ID_pbe_v2.uspp
ion-species  GBRV/$ID_pbe_v1.uspp

For the example given, these commands will search for O_pbe_v2.uspp and H_pbe_v2.uspp, and if those files aren't found, then O_pbe_v1.uspp and/or H_pbe_v1.uspp. Similarly, to use the SG15 norm-conserving set that is also distributed with JDFTx, use the two commands:

ion-species SG15/$ID_ONCV_PBE-1.1.upf
ion-species SG15/$ID_ONCV_PBE-1.0.upf


Now, that basic input file can be run with

jdftx -i water.in -o water.out

That should complete in a few seconds and create files water.out and water.Ecomponents. Have a look at water.out. It lists the commands that were issued in the input file along with several more which have sensible defaults (along with the output of jdftx -t, this should tell you all you need to go further). For instance, the exchange functional defaults to GGA (elec-ex-corr gga-PBE), and the plane wave cutoff defaults to 20 (elec-cutoff 20). To change from the default plane wave cutoff, just add the command with a different value (elec-cutoff 30, for instance) to the input file, and run jdftx again. Note- the default behavior of jdftx is to concatenate output files. If you wish to overwrite your previous water.out file, then run jdftx with the option of -d.

The commands section is followed by initialization of the plane-wave grid, symmetries, pseudopotentials etc., and then the electronic minimization which logs the progress of the conjugate gradients minimizer. The default is to minimize for 100 iterations or the round-off error limit, whichever comes first. This example converges to double precision (16 digits) in around 40 iterations. Note that the ions have not been moved and the end of the output file lists the forces at the initial position. The output water.Ecomponents lists the break-up of the final minimized energy.

When the calculation has completed, files are written based on the options provided by the dump command. Here, we have requested a dump at the end of the run, with the energy components printed out, and with the files named according to dump-name.