The PAW calculator object

class gpaw.calculator.GPAW(restart=None, ignore_bad_restart_file=False, label=None, atoms=None, timer=None, communicator=None, txt='-', parallel=None, **kwargs)[source]

This is the ASE-calculator frontend for doing a PAW calculation.

add_wannier_correction(Z_nn, G_c, u, u1, nbands=None)

Calculate the correction to the wannier integrals Z, given by (Eq. 27 ref1):

              -i G.r
Z   = <psi | e      |psi >
 nm       n             m

               __                __
       ~      \              a  \     a*   a    a
Z    = Z    +  ) exp[-i G . R ]  )   P   dO    P
 nmx    nmx   /__            x  /__   ni   ii'  mi'

               a                 ii'

Note that this correction is an approximation that assumes the exponential varies slowly over the extent of the augmentation sphere.

ref1: Thygesen et al, Phys. Rev. B 72, 125119 (2005)

attach(function, n=1, *args, **kwargs)

Register observer function.

Call function using args and kwargs as arguments.

If n is positive, then function will be called every n iterations + the final iteration if it would not be otherwise

If n is negative, then function will only be called on iteration abs(n).

If n is 0, then function will only be called on convergence

band_structure()

Create band-structure object for plotting.

calculate(atoms=None, properties=['energy'], system_changes=['cell'])[source]

Calculate things.

calculate_numerical_forces(atoms, d=0.001)

Calculate numerical forces using finite difference.

All atoms will be displaced by +d and -d in all directions.

calculate_numerical_stress(atoms, d=1e-06, voigt=True)

Calculate numerical stress using finite difference.

call_observers(iter, final=False)

Call all registered callback functions.

check_state(atoms, tol=1e-15)[source]

Check for system changes since last calculation.

converge_wave_functions()

Converge the wave-functions if not present.

embed(q_p, rc=0.2, rc2=inf, width=1.0)

Embed QM region in point-charges.

estimate_memory(mem)

Estimate memory use of this object.

get_all_electron_density(spin=None, gridrefinement=2, pad=True, broadcast=True, collect=True, skip_core=False)

Return reconstructed all-electron density array.

get_all_electron_ldos(mol, spin=0, npts=201, width=None, wf_k=None, P_aui=None, lc=None, raw=False)

The Projected Density of States, using all-electron wavefunctions.

Projects onto a pseudo_wavefunctions (wf_k) corresponding to some band n and uses P_aui ([paw.nuclei[a].P_uni[:,n,:] for a in atoms]) to obtain the all-electron overlaps. Instead of projecting onto a wavefunction, a molecular orbital can be specified by a linear combination of weights (lc)

get_bz_k_points()

Return the k-points.

get_bz_to_ibz_map()

Return indices from BZ to IBZ.

get_dos(spin=0, npts=201, width=None)

The total DOS.

Fold eigenvalues with Gaussians, and put on an energy grid.

returns an (energies, dos) tuple, where energies are relative to the vacuum level for non-periodic systems, and the average potential for periodic systems.

get_effective_potential(spin=0, pad=True, broadcast=True)

Return pseudo effective-potential.

get_eigenvalues(kpt=0, spin=0, broadcast=True)

Return eigenvalue array.

get_electrostatic_corrections()

Calculate PAW correction to average electrostatic potential.

get_electrostatic_potential()

Return the electrostatic potential.

This is the potential from the pseudo electron density and the PAW-compensation charges. So, the electrostatic potential will only be correct outside the PAW augmentation spheres.

get_fermi_level()

Return the Fermi-level(s).

get_fermi_levels()

Return the Fermi-levels in case of fixed-magmom.

get_fermi_levels_mean()

Return the mean of th Fermi-levels in case of fixed-magmom.

get_fermi_splitting()

Return the Fermi-level-splitting in case of fixed-magmom.

get_homo_lumo(spin=None)

Return HOMO and LUMO eigenvalues.

get_ibz_k_points()

Return k-points in the irreducible part of the Brillouin zone.

get_k_point_weights()

Weights of the k-points.

The sum of all weights is one.

get_lcao_dos(atom_indices=None, basis_indices=None, npts=201, width=None)

Get density of states projected onto orbitals in LCAO mode.

basis_indices is a list of indices of basis functions on which to project. To specify all basis functions on a set of atoms, you can supply atom_indices instead. Both cannot be given simultaneously.

get_magnetic_moments(atoms=None)

Calculate magnetic moments projected onto atoms.

get_number_of_bands()

Return the number of bands.

get_occupation_numbers(kpt=0, spin=0, broadcast=True)

Return occupation array.

get_orbital_ldos(a, spin=0, angular='spdf', npts=201, width=None, nbands=None, spinorbit=False)

The Local Density of States, using atomic orbital basis functions.

Project wave functions onto an atom orbital at atom a, and use this as weight when summing the eigenvalues.

The atomic orbital has angular momentum angular, which can be ‘s’, ‘p’, ‘d’, ‘f’, or any combination (e.g. ‘sdf’).

An integer value for angular can also be used to specify a specific projector function to project onto.

Setting nbands limits the number of bands included. This speeds up the calculation if one has many bands in the calculator but is only interested in the DOS at low energies.

get_projections(locfun, spin=0)

Project wave functions onto localized functions

Determine the projections of the Kohn-Sham eigenstates onto specified localized functions of the format:

locfun = [[spos_c, l, sigma], [...]]

spos_c can be an atom index, or a scaled position vector. l is the angular momentum, and sigma is the (half-) width of the radial gaussian.

Return format is:

f_kni = <psi_kn | f_i>

where psi_kn are the wave functions, and f_i are the specified localized functions.

As a special case, locfun can be the string ‘projectors’, in which case the bound state projectors are used as localized functions.

get_pseudo_density(spin=None, gridrefinement=1, pad=True, broadcast=True)

Return pseudo-density array.

If spin is not given, then the total density is returned. Otherwise, the spin up or down density is returned (spin=0 or 1).

get_pseudo_density_corrections()

Integrated density corrections.

Returns the integrated value of the difference between the pseudo- and the all-electron densities at each atom. These are the numbers you should add to the result of doing e.g. Bader analysis on the pseudo density.

get_pseudo_valence_density(spin=None, gridrefinement=1, pad=True, broadcast=True)

Return pseudo-density array.

If spin is not given, then the total density is returned. Otherwise, the spin up or down density is returned (spin=0 or 1).

get_pseudo_wave_function(band=0, kpt=0, spin=0, broadcast=True, pad=True, periodic=False)

Return pseudo-wave-function array.

Units: 1/Angstrom^(3/2)

get_spin_polarized()

Is it a spin-polarized calculation?

get_wannier_integrals(s, k, k1, G_c, nbands=None)

Calculate integrals for maximally localized Wannier functions.

get_wannier_localization_matrix(nbands, dirG, kpoint, nextkpoint, G_I, spin)

Calculate integrals for maximally localized Wannier functions.

get_wigner_seitz_densities(spin)

Get the weight of the spin-density in Wigner-Seitz cells around each atom.

The density assigned to each atom is relative to the neutral atom, i.e. the density sums to zero.

get_wigner_seitz_ldos(a, spin=0, npts=201, width=None)

The Local Density of States, using a Wigner-Seitz basis function.

Project wave functions onto a Wigner-Seitz box at atom a, and use this as weight when summing the eigenvalues.

get_xc_functional()

Return the XC-functional identifier.

‘LDA’, ‘PBE’, …

initial_wannier(initialwannier, kpointgrid, fixedstates, edf, spin, nbands)

Initial guess for the shape of wannier functions.

Use initial guess for wannier orbitals to determine rotation matrices U and C.

initialize(atoms=None, reading=False)[source]

Inexpensive initialization.

initialize_positions(atoms=None)[source]

Update the positions of the atoms.

linearize_to_xc(newxc)

Linearize Hamiltonian to difference XC functional.

Used in real time TDDFT to perform calculations with various kernels.

print_memory_estimate(log=None, maxdepth=-1)

Print estimated memory usage for PAW object and components.

maxdepth is the maximum nesting level of displayed components.

The PAW object must be initialize()’d, but needs not have large arrays allocated.

read(filename)[source]

Read atoms, parameters and calculated properties from output file.

Read result from self.label file. Raise ReadError if the file is not there. If the file is corrupted or contains an error message from the calculation, a ReadError should also be raised. In case of succes, these attributes must set:

atoms: Atoms object
The state of the atoms from last calculation.
parameters: Parameters object
The parameter dictionary.
results: dict
Calculated properties like energy and forces.

The FileIOCalculator.read() method will typically read atoms and parameters and get the results dict by calling the read_results() method.

reset()

Clear all information from old calculation.

set(**kwargs)[source]

Change parameters for calculator.

Examples:

calc.set(xc='PBE')
calc.set(nbands=20, kpts=(4, 1, 1))
set_label(label)

Set label and convert label to directory and prefix.

Examples:

  • label=’abc’: (directory=’.’, prefix=’abc’)
  • label=’dir1/abc’: (directory=’dir1’, prefix=’abc’)

Calculators that must write results to files with fixed names can overwrite this method so that the directory is set to all of label.

set_positions(atoms=None)[source]

Update the positions of the atoms and initialize wave functions.

class gpaw.paw.PAW[source]

ASE-calculator interface.

The following parameters can be used: nbands, xc, kpts, kpt_refine, spinpol, gpts, h, charge, symmetry, width, mixer, hund, lmax, fixdensity, convergence, txt, parallel, communicator, dtype, softgauss and stencils.

If you don’t specify any parameters, you will get:

Defaults: neutrally charged, LDA, gamma-point calculation, a reasonable grid-spacing, zero Kelvin electronic temperature, and the number of bands will be equal to the number of atomic orbitals present in the setups. Only occupied bands are used in the convergence decision. The calculation will be spin-polarized if and only if one or more of the atoms have non-zero magnetic moments. Text output will be written to standard output.

For a non-gamma point calculation, the electronic temperature will be 0.1 eV (energies are extrapolated to zero Kelvin) and all symmetries will be used to reduce the number of k-points.

add_wannier_correction(Z_nn, G_c, u, u1, nbands=None)[source]

Calculate the correction to the wannier integrals Z, given by (Eq. 27 ref1):

              -i G.r
Z   = <psi | e      |psi >
 nm       n             m

               __                __
       ~      \              a  \     a*   a    a
Z    = Z    +  ) exp[-i G . R ]  )   P   dO    P
 nmx    nmx   /__            x  /__   ni   ii'  mi'

               a                 ii'

Note that this correction is an approximation that assumes the exponential varies slowly over the extent of the augmentation sphere.

ref1: Thygesen et al, Phys. Rev. B 72, 125119 (2005)

attach(function, n=1, *args, **kwargs)[source]

Register observer function.

Call function using args and kwargs as arguments.

If n is positive, then function will be called every n iterations + the final iteration if it would not be otherwise

If n is negative, then function will only be called on iteration abs(n).

If n is 0, then function will only be called on convergence

call_observers(iter, final=False)[source]

Call all registered callback functions.

converge_wave_functions()[source]

Converge the wave-functions if not present.

embed(q_p, rc=0.2, rc2=inf, width=1.0)[source]

Embed QM region in point-charges.

estimate_memory(mem)[source]

Estimate memory use of this object.

get_all_electron_density(spin=None, gridrefinement=2, pad=True, broadcast=True, collect=True, skip_core=False)[source]

Return reconstructed all-electron density array.

get_all_electron_ldos(mol, spin=0, npts=201, width=None, wf_k=None, P_aui=None, lc=None, raw=False)[source]

The Projected Density of States, using all-electron wavefunctions.

Projects onto a pseudo_wavefunctions (wf_k) corresponding to some band n and uses P_aui ([paw.nuclei[a].P_uni[:,n,:] for a in atoms]) to obtain the all-electron overlaps. Instead of projecting onto a wavefunction, a molecular orbital can be specified by a linear combination of weights (lc)

get_bz_k_points()[source]

Return the k-points.

get_bz_to_ibz_map()[source]

Return indices from BZ to IBZ.

get_dos(spin=0, npts=201, width=None)[source]

The total DOS.

Fold eigenvalues with Gaussians, and put on an energy grid.

returns an (energies, dos) tuple, where energies are relative to the vacuum level for non-periodic systems, and the average potential for periodic systems.

get_effective_potential(spin=0, pad=True, broadcast=True)[source]

Return pseudo effective-potential.

get_eigenvalues(kpt=0, spin=0, broadcast=True)[source]

Return eigenvalue array.

get_electrostatic_corrections()[source]

Calculate PAW correction to average electrostatic potential.

get_electrostatic_potential()[source]

Return the electrostatic potential.

This is the potential from the pseudo electron density and the PAW-compensation charges. So, the electrostatic potential will only be correct outside the PAW augmentation spheres.

get_fermi_level()[source]

Return the Fermi-level(s).

get_fermi_levels()[source]

Return the Fermi-levels in case of fixed-magmom.

get_fermi_levels_mean()[source]

Return the mean of th Fermi-levels in case of fixed-magmom.

get_fermi_splitting()[source]

Return the Fermi-level-splitting in case of fixed-magmom.

get_homo_lumo(spin=None)[source]

Return HOMO and LUMO eigenvalues.

get_ibz_k_points()[source]

Return k-points in the irreducible part of the Brillouin zone.

get_k_point_weights()[source]

Weights of the k-points.

The sum of all weights is one.

get_lcao_dos(atom_indices=None, basis_indices=None, npts=201, width=None)[source]

Get density of states projected onto orbitals in LCAO mode.

basis_indices is a list of indices of basis functions on which to project. To specify all basis functions on a set of atoms, you can supply atom_indices instead. Both cannot be given simultaneously.

get_number_of_bands()[source]

Return the number of bands.

get_occupation_numbers(kpt=0, spin=0, broadcast=True)[source]

Return occupation array.

get_orbital_ldos(a, spin=0, angular='spdf', npts=201, width=None, nbands=None, spinorbit=False)[source]

The Local Density of States, using atomic orbital basis functions.

Project wave functions onto an atom orbital at atom a, and use this as weight when summing the eigenvalues.

The atomic orbital has angular momentum angular, which can be ‘s’, ‘p’, ‘d’, ‘f’, or any combination (e.g. ‘sdf’).

An integer value for angular can also be used to specify a specific projector function to project onto.

Setting nbands limits the number of bands included. This speeds up the calculation if one has many bands in the calculator but is only interested in the DOS at low energies.

get_projections(locfun, spin=0)[source]

Project wave functions onto localized functions

Determine the projections of the Kohn-Sham eigenstates onto specified localized functions of the format:

locfun = [[spos_c, l, sigma], [...]]

spos_c can be an atom index, or a scaled position vector. l is the angular momentum, and sigma is the (half-) width of the radial gaussian.

Return format is:

f_kni = <psi_kn | f_i>

where psi_kn are the wave functions, and f_i are the specified localized functions.

As a special case, locfun can be the string ‘projectors’, in which case the bound state projectors are used as localized functions.

get_pseudo_density(spin=None, gridrefinement=1, pad=True, broadcast=True)[source]

Return pseudo-density array.

If spin is not given, then the total density is returned. Otherwise, the spin up or down density is returned (spin=0 or 1).

get_pseudo_density_corrections()[source]

Integrated density corrections.

Returns the integrated value of the difference between the pseudo- and the all-electron densities at each atom. These are the numbers you should add to the result of doing e.g. Bader analysis on the pseudo density.

get_pseudo_valence_density(spin=None, gridrefinement=1, pad=True, broadcast=True)

Return pseudo-density array.

If spin is not given, then the total density is returned. Otherwise, the spin up or down density is returned (spin=0 or 1).

get_pseudo_wave_function(band=0, kpt=0, spin=0, broadcast=True, pad=True, periodic=False)[source]

Return pseudo-wave-function array.

Units: 1/Angstrom^(3/2)

get_spin_polarized()[source]

Is it a spin-polarized calculation?

get_wannier_integrals(s, k, k1, G_c, nbands=None)[source]

Calculate integrals for maximally localized Wannier functions.

get_wannier_localization_matrix(nbands, dirG, kpoint, nextkpoint, G_I, spin)[source]

Calculate integrals for maximally localized Wannier functions.

get_wigner_seitz_densities(spin)[source]

Get the weight of the spin-density in Wigner-Seitz cells around each atom.

The density assigned to each atom is relative to the neutral atom, i.e. the density sums to zero.

get_wigner_seitz_ldos(a, spin=0, npts=201, width=None)[source]

The Local Density of States, using a Wigner-Seitz basis function.

Project wave functions onto a Wigner-Seitz box at atom a, and use this as weight when summing the eigenvalues.

get_xc_functional()[source]

Return the XC-functional identifier.

‘LDA’, ‘PBE’, …

initial_wannier(initialwannier, kpointgrid, fixedstates, edf, spin, nbands)[source]

Initial guess for the shape of wannier functions.

Use initial guess for wannier orbitals to determine rotation matrices U and C.

linearize_to_xc(newxc)[source]

Linearize Hamiltonian to difference XC functional.

Used in real time TDDFT to perform calculations with various kernels.

print_memory_estimate(log=None, maxdepth=-1)[source]

Print estimated memory usage for PAW object and components.

maxdepth is the maximum nesting level of displayed components.

The PAW object must be initialize()’d, but needs not have large arrays allocated.