class BaderCharges(configuration, electron_density, electron_density_reference=None)

Class for performing a Bader charge analysis.

  • configuration (AtomicConfiguration) – The configuration to perform the charge analysis on.
  • electron_density (AllElectronDensity) – The electron density of the configuration.
  • electron_density_reference (ElectronDensity) – If electron_density is actually a valance electron density, then the all electron density can optionally be provided.
class BaderChargesMaximum

Create new instance of BaderChargesMaximum(coordinates, charge, atom, distance)


Alias for field number 2


Alias for field number 1


Alias for field number 0


Return number of occurrences of value.


Alias for field number 3


Return first index of value.

Raises ValueError if the value is not present.


Return the calculated atomic charges.

Returns:The number of valance electrons for each atom.
Return type:numpy.array

Return the calculated bader charge maxima.

Returns:An list of tuples that each contain the coordinates of a charge density maximum as a PhysicalQuantity of type length, the charge contained in the Bader volume as a float, the index of atom that the maxima was mapped to, and the distance to that atom as PhysicalQuantity of type length.
Return type:list of type tuple

Return the coordinates of the calculated bader charge maxima.

Returns:The coordinates of each maxima in an array of shape (n, 3) where n is the number of maxima.
Return type:PhysicalQuantity of type length
Returns:The metatext of the object or None if no metatext is present.
Return type:str | unicode | None

Print a string containing an ASCII table useful for plotting the AnalysisSpin object.

Parameters:stream (python stream) – The stream the table should be written to.
Default: NLPrintLogger()

Set a given metatext string on the object.

Parameters:metatext (str | unicode | None) – The metatext string that should be set. A value of “None” can be given to remove the current metatext.

Usage Examples

This module requies an all-electron density, which can be obtain from the PlaneWave PAW all-electron density object AllElectronDensity

# -*- coding: utf-8 -*-
# -------------------------------------------------------------
# Bulk Configuration
# -------------------------------------------------------------

# Set up lattice
lattice = FaceCenteredCubic(4.348*Angstrom)

# Define elements
elements = [Silicon, Carbon]

# Define coordinates
fractional_coordinates = [[ 0.  ,  0.  ,  0.  ],
                          [ 0.25,  0.25,  0.25]]

# Set up configuration
bulk_configuration = BulkConfiguration(

# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
# PAW Data Set
basis_set = [

k_point_sampling = KpointDensity(
numerical_accuracy_parameters = NumericalAccuracyParameters(

iteration_control_parameters = IterationControlParameters(

calculator = PlaneWaveCalculator(

nlsave('SiC_bader.hdf5', bulk_configuration)

# -------------------------------------------------------------
# All Electron Density
# -------------------------------------------------------------
all_electron_density = AllElectronDensity(
nlsave('SiC_bader.hdf5', all_electron_density)

# -------------------------------------------------------------
# Bader Charges
# -------------------------------------------------------------
bader = BaderCharges(
nlsave('SiC_bader.hdf5', bader)

# Print Bader object

In order for the Bader analysis to be accurate, the all-electron density needs to be sampled on a fine grid due to the rapid variations close to the nuclei. Therefor the all-electron density is constructed with a grid_sampling argument. Heavy element wlements with high atomic numbers require, in general, a finer grid sampling than lighter element.

A Bader charge object can also be constructed though the Bader Analysis plugin on the LabFloor. In order to enable the plugin, select a configuration and an all-electron density. Optionally, when used to analyze VASP output files, the electron density files named AECCAR0 and AECCAR2 should also be selected. See the notes below for more information.


This class currently implements the “on-grid” Bader analysis algorithm developed by Henkelman, et al. [HAJonsson06].

Bader charge analysis can only work properly when an all-electron density is available. This is because the analysis assumes that the charge density maxima correspond to the coordinates of the atomic nuclei, however, pseudo-potential methods remove charge near the nuclei. This means that this type of analysis is currently only useful with the PlaneWave PAW All-electron density object and VASP (because it supports writing an all-electron density) calculators in QuantumATK.

If you want to perform a Bader charge analysis using VASP, it is important to be aware that the CHGCAR files only contain the valence electron density. In order to write out the extra information that is needed, you must add LAECHG=.TRUE. to the INCAR file. This will cause the atomic core electron density to be written to the file AECCAR0 and the non-pseudoized valence electron density (i.e. the density that can be added to the core electron density) is written to the file AECCAR2.

Bader calculations should be converged with respect the the electron density grid spacing. This means that, in VASP, you should increase the values of NEGXF, NEGYF, and NEGYZ in order to increase the number of grid points in the CHGCAR and AECCAR files.

[HAJonsson06]G. Henkelman, A. Arnaldsson, and H. Jónsson. A fast and robust algorithm for Bader decomposition of charge density. Comput. Mat. Sci., 36(3):354–360, 2006. doi:10.1016/j.commatsci.2005.04.010.