This example requires a platinum pseudopotential, perhaps obtain one from the Opium website and save it as Pt.fhi in the same directory as input file Pt3-vac.in (3 layers of platinum in vacuum):
#---------------- Platinum surface in vacuum ------------------ include Pt3-common.in # Share common commands between runs dump-name Pt3-vac.$var
and save the following as Pt3-common.in:
#--------- 3-layer Platinum surface (shared setup) ------------ # 1x1 fcc unit cells in first two directions # (length Angstrom/sqrt(2) at 60 degrees) # 10 times 111 plane spacing in third direction # (perpendicular to other two with length 20*Angstrom/sqrt(3)) lattice \ 1.1572162 1.1572162 0.0000000 \ -0.6681191 0.6681191 0.0000000 \ 0.0000000 0.0000000 10.9103391 #Cubic lattice constant of Platinum latt-scale 3.94 3.94 3.94 #Pseudopotential and atom positions: ion-species Pt.fhi coords-type lattice #The following coordinates are in terms of lattice vectors ion Pt -0.333333333333 -0.333333333333 -0.1 1 ion Pt 0.000000000000 0.000000000000 0.0 0 #Hold the central layer fixed ion Pt 0.333333333333 0.333333333333 0.1 1 #Brillouin zone sampling kpoint-folding 4 4 1 # 4x4x1 uniform k-mesh kpoint 0 0 0 1 # gamma-centered k-point mesh elec-ex-corr gga-pbe dump End State Ecomponents #Fermi fillings - this is a metal! elec-n-bands 22 # Need extra partially occupied bands elec-fermi-fillings 0 0.01 # Fillings are a fermi function with T = 10 mEh
For simplicity, I've omitted the electronic-minimize and ionic-minimize commands, so that each of these calculations would run for 100 iterations at fixed ionic positions. Also note that a realistic calculation would require more vaccum space (~ 20 layers in third direction suffices), more layers of Pt (5 works) and a finer k-point mesh.
Then again, running the above input file with jdftx -i Pt3-vac.in -o Pt3-vac.out should complete in a few minutes on your netbook without swapping. Notice that this time around, the State output includes Pt3-vac.wfns (wavefunctions), Pt3-vac.fillings (fillings per band, per k-point) and Pt3-vac.Haux (auxilliary Hamiltonian for the fillings algorithm). With fillings, this system does not converge to round-off error in 100 iterations, but definitely gets within uH of the final result. Also note that the energy reported during minimization is not Etot, but F because the variational quantity is the Helmholtz free energy that includes the electron entropy.
Next we'll use the results of the previous calculation to initialize a solvated version of the above system using an implicit fluid model: a continuum dielectric with ionic screening. The implicit fluid model sets up the dielectric constant and ionic concentration at each point in space according to the electron density - it is therefore important to provide a good starting point for the solvated run (if you forget this, the code will perform a vacuum run automatically, but with an inflated ego). Save the following to Pt3-neutral.in:
#-------------- Neutral solvated Platinum surface ---------------- include Pt3-common.in initial-state Pt3-vac.$var # Start from the vacuum results dump-name Pt3-neutral.$var fluid LinearPCM #Selects the implicit model dielectric (with optional ionic screening) fluid-solvent H2O fluid-cation Na+ 1. #1M of a unit-positive cation fluid-anion Cl- 1. #1M of a unit-negative anion #Augment the electron density used to determine dielectric #with a gaussian to prevent fluid from entering the atomic cores #(This is not required for pseudopotentials with partial cores) chargeball Pt 1 0.4
and run jdftx -i Pt3-neutral.in -o Pt3-neutral.out. Note that with ionic-screening present, the absolute values of mu reported in the lines starting with FillingsAux are now meaningful, and in this case correspond to the potential of zero charge of Platinum (See K. Letchworth-Weaver and T.A. Arias, Phys. Rev. B 86, 075140 (2012)).
Finally, we can run a calculation at constant electron chemical potential: a unique capability of this program. Save the following to Pt3-charged.in:
#-------------- Charged solvated Platinum surface ---------------- include Pt3-common.in initial-state Pt3-neutral.$var # Start from the neutral solvated results dump-name Pt3-charged.$var fluid LinearPCM fluid-solvent H2O fluid-cation Na+ 1. fluid-anion Cl- 1. chargeball Pt 1 0.4 target-mu -0.16 #Note that this is ~ 1V away from the neutral mu: -0.197
and run jdftx -i Pt3-charged.in -o Pt3-charged.out. The "target-mu" that sets the electron chemical potential is given, and reported, in Hartrees. Note that the reported energy now changes from F to G, because the variational quantity is the grand potential for the electrons which includes Lagrange multiplier term mu N for the corresponding Legendre transform.
This tutorial introduces the basics of electrochemistry calculations using JDFTx. As before, several options are available for each of the commands introduced here and these can be figured out from the output of jdftx -t.