Band structure with DFTB (SCC-DFTB, GFN1-xTB)
*********************************************

DFTB Materials Science Band structure

Calculate and plot an electronic band structure for a periodic solid
with DFTB, including SCC-DFTB and GFN1-xTB variants.

**Requires:** AMS2026 or later

-[ Related examples ]-

* Automated Transition-State Workflow for a Diels-Alder Addition

* Band structure with BAND (HSE06, DFT+U)

* Band structure with Quantum ESPRESSO (PBE)

-[ Related tutorials ]-

* Bands, DOS, and Fermi surface tutorial

* Restart and refine DOS/band structure tutorial

-[ Related documentation ]-

* DFTB engine

* DFTB tasks and properties

[image]


Metal band structure with SCC-DFTB
==================================

Build the primitive Cu unit cell:

   from scm.plams import view
   from scm.base import ChemicalSystem
   from ase.build import bulk

   Cu = ChemicalSystem.from_ase_atoms(bulk("Cu", "fcc", a=3.6))  # primitive cell
   view(Cu, width=150, height=150, show_atom_labels=True)

[image]

Single-point calculation with SCC-DFTB and parameters
"DFTB.org/matsci-0-3":

   from scm.plams import Settings, AMSJob

   s = Settings()
   s.input.ams.Task = "SinglePoint"
   s.input.DFTB.Periodic.BandStructure.Enabled = "Yes"
   s.input.DFTB.Model = "SCC-DFTB"
   s.input.DFTB.ResourcesDir = "DFTB.org/matsci-0-3"
   s.runscript.nproc = 1
   job = AMSJob(settings=s, name="Cu", molecule=Cu)
   job.run();

   [09.02|14:20:41] JOB Cu STARTED
   [09.02|14:20:41] Renaming job Cu to Cu.004
   [09.02|14:20:41] Job Cu.004 previously run as Cu, using old results
   [09.02|14:20:41] JOB Cu.004 COPIED

   from scm.plams.tools.plot import plot_band_structure
   import matplotlib.pyplot as plt

   x, y_spin_up, y_spin_down, labels, fermi_energy = job.results.get_band_structure(
       unit="eV"
   )
   ax = plot_band_structure(x, y_spin_up, None, labels, fermi_energy, zero="fermi")
   ax.set_ylim(-10, 10)
   ax.set_ylabel("$E - E_{Fermi}$ (eV)")
   ax.set_xlabel("Path")
   ax.set_title("Cu with DFTB.org/matsci-0-3")
   ax;

[image]


Semiconductor band structure with GFN-1xTB
==========================================

For a semiconductor like ZnO you can also choose to put the zero at
the VBM (‘vbm’) or CBM (‘cbm’)

   from scm.plams import view
   from scm.base import ChemicalSystem
   from ase.build import bulk

   ZnO = ChemicalSystem.from_ase_atoms(bulk("ZnO", "wurtzite", a=3.2, c=5.3, u=0.375))
   ZnO.guess_bonds()  # doesn't affect DFTB, just helps visualization
   view(ZnO, direction="corner_z", width=300, height=300, show_atom_labels=True)

[image]

   from scm.plams import Settings, AMSJob

   s = Settings()
   s.input.ams.Task = "SinglePoint"
   s.input.DFTB.Periodic.BandStructure.Enabled = "Yes"
   s.input.DFTB.Model = "GFN1-xTB"
   s.runscript.nproc = 1
   job = AMSJob(settings=s, molecule=ZnO, name="ZnO")
   job.run();

   [09.02|14:21:02] JOB ZnO STARTED
   [09.02|14:21:02] JOB ZnO RUNNING
   [09.02|14:21:06] JOB ZnO FINISHED
   [09.02|14:21:06] JOB ZnO SUCCESSFUL

The below call to "plot_band_structure" plots both the spin up and
spin down. The spin-down bands are plotted as dashed lines. Note that
in this case there is no spin polarization so the spin-down bands
perfectly overlap the spin-up bands.

   # get_band_structure returns an axis in AMS2025+
   ax = plot_band_structure(*job.results.get_band_structure(unit="eV"), zero="vbmax")
   ax.set_ylim(-10, 10)
   ax.set_ylabel("$E - E_{VBM}$ (eV)")
   ax.set_xlabel("Path")
   ax.set_title("ZnO with GFN1-xTB")
   ax;

[image]


See also
========


Related examples
----------------

* Automated Transition-State Workflow for a Diels-Alder Addition

* Band structure with BAND (HSE06, DFT+U)

* Band structure with Quantum ESPRESSO (PBE)


Related tutorials
-----------------

* Bands, DOS, and Fermi surface tutorial

* Restart and refine DOS/band structure tutorial


Related documentation
---------------------

* DFTB engine

* DFTB tasks and properties


Python Script
=============

   #!/usr/bin/env python
   # coding: utf-8

   # ## Metal band structure with SCC-DFTB

   # Build the primitive Cu unit cell:

   from scm.plams import view
   from scm.base import ChemicalSystem
   from ase.build import bulk

   Cu = ChemicalSystem.from_ase_atoms(bulk("Cu", "fcc", a=3.6))  # primitive cell
   view(Cu, width=150, height=150, show_atom_labels=True, picture_path="picture1.png")


   # Single-point calculation with SCC-DFTB and parameters `DFTB.org/matsci-0-3`:

   from scm.plams import Settings, AMSJob

   s = Settings()
   s.input.ams.Task = "SinglePoint"
   s.input.DFTB.Periodic.BandStructure.Enabled = "Yes"
   s.input.DFTB.Model = "SCC-DFTB"
   s.input.DFTB.ResourcesDir = "DFTB.org/matsci-0-3"
   s.runscript.nproc = 1
   job = AMSJob(settings=s, name="Cu", molecule=Cu)
   job.run()
   from scm.plams.tools.plot import plot_band_structure
   import matplotlib.pyplot as plt

   x, y_spin_up, y_spin_down, labels, fermi_energy = job.results.get_band_structure(unit="eV")
   ax = plot_band_structure(x, y_spin_up, None, labels, fermi_energy, zero="fermi")
   ax.set_ylim(-10, 10)
   ax.set_ylabel("$E - E_{Fermi}$ (eV)")
   ax.set_xlabel("Path")
   ax.set_title("Cu with DFTB.org/matsci-0-3")
   ax
   ax.figure.savefig("picture2.png")


   # ## Semiconductor band structure with GFN-1xTB
   #
   # For a semiconductor like ZnO you can also choose to put the zero at the VBM ('vbm') or CBM ('cbm')

   from scm.plams import view
   from scm.base import ChemicalSystem
   from ase.build import bulk

   ZnO = ChemicalSystem.from_ase_atoms(bulk("ZnO", "wurtzite", a=3.2, c=5.3, u=0.375))
   ZnO.guess_bonds()  # doesn't affect DFTB, just helps visualization
   view(ZnO, direction="corner_z", width=300, height=300, show_atom_labels=True, picture_path="picture3.png")


   from scm.plams import Settings, AMSJob

   s = Settings()
   s.input.ams.Task = "SinglePoint"
   s.input.DFTB.Periodic.BandStructure.Enabled = "Yes"
   s.input.DFTB.Model = "GFN1-xTB"
   s.runscript.nproc = 1
   job = AMSJob(settings=s, molecule=ZnO, name="ZnO")
   job.run()
   # The below call to ``plot_band_structure`` plots both the spin up and spin down. The spin-down bands are plotted as dashed lines. Note that in this case there is no spin polarization so the spin-down bands perfectly overlap the spin-up bands.

   # get_band_structure returns an axis in AMS2025+
   ax = plot_band_structure(*job.results.get_band_structure(unit="eV"), zero="vbmax")
   ax.set_ylim(-10, 10)
   ax.set_ylabel("$E - E_{VBM}$ (eV)")
   ax.set_xlabel("Path")
   ax.set_title("ZnO with GFN1-xTB")
   ax
   ax.figure.savefig("picture4.png")
