.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples_generated/05-external-calculators/external_calculators_gpaw.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_generated_05-external-calculators_external_calculators_gpaw.py: .. _ext_calc_gpaw: External calculators - GPAW --------------------------- Many external calculators can be used with ASE, including GPAW_, Abinit_, Vasp_, Siesta_, `Quantum ESPRESSO`_, Asap_, LAMMPS_ , FhiAIMS_, MACE_, and many more, see :ref:`supported calculators` for the full list. .. _Asap: http://wiki.fysik.dtu.dk/asap .. _GPAW: http://gpaw.readthedocs.io .. _Siesta: http://www.icmab.es/siesta .. _Abinit: https://www.abinit.org .. _Vasp: https://www.vasp.at .. _Quantum ESPRESSO: http://www.quantum-espresso.org/ .. _LAMMPS: http://lammps.sandia.gov/ .. _FhiAIMS: https://fhi-aims.org/ .. _MACE: https://github.com/ACEsuit/mace .. _PET-MAD: https://github.com/lab-cosmo/pet-mad .. _CP2K: https://www.cp2k.org .. GENERATED FROM PYTHON SOURCE LINES 25-51 Setting up an external calculator with ASE ========================================== This tutorial will cover how to set up a basic calculation in ASE, using several external calculator, GPAW_, CP2K_ and ASAP_ and their tutorials :ref:`ext_calc_cp2k` and :ref:`ext_calc_asap` All these are various external calculators, performing DFT GPAW and CP2K or using classical potentials, via ASAP. We will start by looking at GPAW_, GPAW ==== - GPAW is an electronic structure code implemented as a Python library with C backend. - GPAW includes a few command line tools, but is generally always used with ASE. - Due to this close relationship many GPAW developers are also ASE developers. - GPAW implements the projector-augmented wave (PAW) method which requires atomic “setups” with pseudopotentials. To begin with, we run a single-point energy calculation using Kohn-Sham density-functional theory (DFT). First, we import GPAW and create the atoms object .. GENERATED FROM PYTHON SOURCE LINES 51-58 .. code-block:: Python from gpaw import GPAW, PW from ase.build import bulk atoms = bulk('Cu') .. GENERATED FROM PYTHON SOURCE LINES 59-68 Second, we attach GPAW as a calculator - We specify a number of parameters: - xc sets the exchange-correlation functional - kpts sets the Brillouin-zone sampling - mode sets the basis set; in this case a 400 eV cutoff plane-wave basis is used. - For more information about valid parameters, see the GPAW docs. .. GENERATED FROM PYTHON SOURCE LINES 68-72 .. code-block:: Python atoms.calc = GPAW(xc='PBE', kpts=(3, 3, 3), mode=PW(400)) energy = atoms.get_potential_energy() print(energy) .. rst-class:: sphx-glr-script-out .. code-block:: none ___ ___ ___ _ _ _ | | |_ | | | | | | | | | . | | | | |__ | _|___|_____| 25.7.0 |___|_| User: ???@runner-b6xc3srb6-project-71875181-concurrent-3 Date: Thu Jun 4 20:10:07 2026 Arch: x86_64 Pid: 1274 CWD: /builds/ase/ase-deploy/examples/05-external-calculators Python: 3.13.7 gpaw: /home/ase/.local/lib/python3.13/site-packages/gpaw _gpaw: /home/ase/.local/lib/python3.13/site-packages/ _gpaw.cpython-313-x86_64-linux-gnu.so ase: /home/ase/.local/lib/python3.13/site-packages/ase (version 3.29.0b1) numpy: /home/ase/.local/lib/python3.13/site-packages/numpy (version 2.3.3) scipy: /home/ase/.local/lib/python3.13/site-packages/scipy (version 1.15.3) libxc: 5.2.3 units: Angstrom and eV cores: 1 OpenMP: False OMP_NUM_THREADS: 1 Input parameters: kpts: [3 3 3] mode: {ecut: 400.0, name: pw} xc: PBE System changes: positions, numbers, cell, pbc, initial_charges, initial_magmoms Initialize ... species: Cu: name: Copper id: f1c4d45d90492f1bbfdcb091e8418fdf Z: 29.0 valence: 11 core: 18 charge: 0.0 file: /home/ase/.local/lib/python3.13/site-packages/gpaw_data/setups/Cu.PBE.gz compensation charges: {type: gauss, rc: 0.33, lmax: 2} cutoffs: {filter: 2.06, core: 2.43} projectors: # energy rcut - 4s(1.00) -4.609 1.164 - 4p(0.00) -0.698 1.164 - 3d(10.00) -5.039 1.058 - s 22.603 1.164 - p 26.513 1.164 - d 22.172 1.058 # Using partial waves for Cu as LCAO basis Reference energy: -45021.451841 # eV Spin-paired calculation Convergence criteria: Maximum [total energy] change in last 3 cyles: 0.0005 eV / valence electron Maximum integral of absolute [dens]ity change: 0.0001 electrons / valence electron Maximum integral of absolute [eigenst]ate change: 4e-08 eV^2 / valence electron Maximum number of scf [iter]ations: 333 (Square brackets indicate name in SCF output, whereas a 'c' in the SCF output indicates the quantity has converged.) Symmetries present (total): 48 ( 1 0 0) ( 1 0 0) ( 1 0 0) ( 1 0 0) ( 1 0 -1) ( 1 0 -1) ( 1 0 -1) ( 1 -1 0) ( 0 1 0) ( 0 0 1) ( 1 0 0) ( 1 -1 0) ( 1 -1 0) ( 1 0 -1) ( 0 0 1) ( 0 1 0) ( 1 -1 0) ( 1 0 0) ( 1 0 -1) ( 1 0 -1) ( 1 -1 0) ( 1 -1 0) ( 1 -1 0) ( 1 -1 0) ( 0 1 -1) ( 0 0 -1) ( 1 0 0) ( 1 0 -1) ( 0 -1 1) ( 0 -1 0) ( 0 0 -1) ( 0 1 -1) ( 1 0 -1) ( 1 0 0) ( 0 -1 0) ( 0 -1 1) ( 0 1 0) ( 0 1 0) ( 0 1 0) ( 0 1 0) ( 0 1 -1) ( 0 1 -1) ( 1 0 0) ( 0 1 -1) ( 0 0 1) (-1 1 0) ( 1 0 -1) ( 0 1 0) ( 0 0 1) (-1 1 0) ( 1 0 0) ( 0 1 -1) ( 0 0 -1) (-1 1 0) ( 0 1 -1) ( 0 1 -1) ( 0 0 1) ( 0 0 1) ( 0 0 1) ( 0 0 1) ( 0 0 -1) (-1 1 0) ( 1 0 0) ( 0 1 0) ( 0 -1 1) (-1 0 1) ( 1 0 -1) ( 0 1 0) ( 0 1 0) ( 1 0 0) (-1 0 1) ( 0 -1 1) ( 0 0 -1) ( 0 0 -1) ( 0 0 -1) ( 0 0 -1) ( 0 -1 1) ( 0 -1 1) ( 1 0 -1) ( 0 1 -1) ( 0 -1 0) (-1 0 0) ( 1 -1 0) ( 0 0 1) ( 0 1 -1) ( 1 0 -1) (-1 0 0) ( 0 -1 0) ( 0 -1 0) (-1 0 1) ( 0 -1 1) ( 0 -1 1) ( 0 -1 0) ( 0 -1 0) ( 0 -1 0) ( 0 -1 0) ( 0 -1 0) (-1 0 1) ( 1 -1 0) ( 0 0 -1) ( 0 -1 1) (-1 0 0) ( 1 -1 0) ( 0 0 1) ( 0 -1 1) (-1 0 0) ( 1 -1 0) ( 0 0 -1) (-1 1 0) (-1 1 0) (-1 1 0) (-1 1 0) (-1 0 1) (-1 0 1) ( 0 1 0) ( 0 1 -1) (-1 0 1) (-1 0 0) ( 0 0 1) ( 0 -1 1) ( 0 1 -1) ( 0 1 0) (-1 0 0) (-1 0 1) ( 0 -1 1) ( 0 0 1) (-1 0 1) (-1 0 1) (-1 0 0) (-1 0 0) (-1 0 0) (-1 0 0) (-1 1 0) (-1 0 0) ( 0 0 -1) ( 0 -1 0) (-1 1 0) (-1 0 1) (-1 0 0) (-1 1 0) ( 0 -1 0) ( 0 0 -1) (-1 0 1) (-1 1 0) 27 k-points: 3 x 3 x 3 Monkhorst-Pack grid 4 k-points in the irreducible part of the Brillouin zone k-points in crystal coordinates weights 0: 0.00000000 0.00000000 0.00000000 1/27 1: 0.33333333 0.33333333 -0.33333333 12/27 2: 0.33333333 0.33333333 0.00000000 6/27 3: 0.33333333 0.33333333 0.33333333 8/27 Wave functions: Plane wave expansion Cutoff energy: 400.000 eV Number of coefficients (min, max): 181, 220 Pulay-stress correction: 0.000000 eV/Ang^3 (de/decut=0.000000) Using Numpy's FFT ScaLapack parameters: grid=1x1, blocksize=None Wavefunction extrapolation: Improved wavefunction reuse through dual PAW basis Occupation numbers: Fermi-Dirac: width: 0.1000 # eV Eigensolver Davidson(niter=2) Densities: Coarse grid: 12*12*12 grid Fine grid: 24*24*24 grid Total Charge: 0.000000 Density mixing: Method: separate Backend: pulay Linear mixing parameter: 0.05 old densities: 5 Damping of long wavelength oscillations: 50 Hamiltonian: XC and Coulomb potentials evaluated on a 24*24*24 grid Using the PBE Exchange-Correlation functional External potential: NoExternalPotential XC parameters: PBE with 2 nearest neighbor stencil Memory estimate: Process memory now: 1333.46 MiB Calculator: 1.30 MiB Density: 0.70 MiB Arrays: 0.34 MiB Localized functions: 0.23 MiB Mixer: 0.13 MiB Hamiltonian: 0.23 MiB Arrays: 0.22 MiB XC: 0.00 MiB Poisson: 0.00 MiB vbar: 0.00 MiB Wavefunctions: 0.36 MiB Arrays psit_nG: 0.12 MiB Eigensolver: 0.06 MiB Projections: 0.01 MiB Projectors: 0.09 MiB PW-descriptor: 0.08 MiB Total number of cores used: 1 Number of atoms: 1 Number of atomic orbitals: 9 Number of bands in calculation: 9 Number of valence electrons: 11 Bands to converge: occupied ... initialized Initializing position-dependent things. Density initialized from atomic densities Creating initial wave functions: 9 bands from LCAO basis set Cu Atomic positions and initial magnetic moments Positions: 0 Cu 0.000000 0.000000 0.000000 ( 0.0000, 0.0000, 0.0000) Unit cell: periodic x y z points spacing 1. axis: yes 0.000000 1.805000 1.805000 12 0.1737 2. axis: yes 1.805000 0.000000 1.805000 12 0.1737 3. axis: yes 1.805000 1.805000 0.000000 12 0.1737 Lengths: 2.552655 2.552655 2.552655 Angles: 60.000000 60.000000 60.000000 Effective grid spacing dv^(1/3) = 0.1895 iter time total log10-change: energy eigst dens iter: 1 20:10:08 -4.839672 iter: 2 20:10:08 -4.507699 -1.93 -1.20 iter: 3 20:10:08 -3.927233 -1.14 -1.27 iter: 4 20:10:08 -3.912161 -3.42 -1.89 iter: 5 20:10:08 -3.896647 -2.80 -1.87 iter: 6 20:10:08 -3.892566 -3.37 -2.42 iter: 7 20:10:08 -3.893413c -3.92 -3.13 iter: 8 20:10:08 -3.892769c -4.67 -2.77 iter: 9 20:10:08 -3.892528c -4.69 -3.09 iter: 10 20:10:08 -3.892528c -6.72 -4.30c iter: 11 20:10:08 -3.892530c -7.48c -4.34c Converged after 11 iterations. Dipole moment: (-0.000000, -0.000000, 0.000000) |e|*Ang Energy contributions relative to reference atoms: (reference = -45021.451841) Kinetic: -14.510158 Potential: +11.179109 External: +0.000000 XC: -0.795423 Entropy (-ST): -0.048202 Local: +0.258042 SIC: +0.000000 -------------------------- Free energy: -3.916631 Extrapolated: -3.892530 Showing only first 2 kpts Kpt Band Eigenvalues Occupancy 0 3 5.01847 2.00000 0 4 5.83606 1.99744 0 5 5.83606 1.99744 0 6 33.56442 0.00000 1 3 5.75212 1.99890 1 4 6.19678 1.90992 1 5 11.33421 0.00000 1 6 14.02875 0.00000 Fermi level: 6.50219 No gap No difference between direct/indirect transitions -3.8925302349176425 .. _sphx_glr_download_examples_generated_05-external-calculators_external_calculators_gpaw.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: external_calculators_gpaw.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: external_calculators_gpaw.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: external_calculators_gpaw.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_