class AtomicCompensationCharge(atomic_shifts=None)

Represents a change in the ion charge of individual atoms, resulting in a different ion electrostatic potential.

Parameters:atomic_shifts (array of tuples) – The charge shifts that should be applied to any given atom and/or element. Each charge shift entry should be a tuple with tags and corresponding charge shifts, or a tuple with element and charge shift value. Mixing tuple types is allowed.
Default: no charge shift for any atom

Usage Examples

Simulate a p-doped silicon crystal and add a compensation charge to the silicon atoms:

# Set up configuration.
bulk_configuration = BulkConfiguration(
    elements=[Silicon, Silicon],
    fractional_coordinates=[[ 0.  ,  0.  ,  0.  ],
                            [ 0.25,  0.25,  0.25]]

# Set a negative compensation charge on each atom to compensate for p-doping.
compensation_charge = AtomicCompensationCharge([[Silicon, -0.0005]])

# Calculator
numerical_accuracy_parameters = NumericalAccuracyParameters(
    k_point_sampling=(5, 5, 5),

calculator = LCAOCalculator(


bandstructure = Bandstructure(
    route=['G', 'X', 'W', 'L', 'G', 'K', 'X', 'U', 'W', 'K', 'L'],

nlsave('', bandstructure)


The atomic compensation charge controls the charge of the neutral atomic densities used to construct the initial guess for the total density. It is typically used to apply a doping to the system. The total charge of the system is set in the calculator, see for instance the keyword charge of the LCAOCalculator.

For SurfaceConfiguration and DeviceConfiguration, the atomic compensation charge of the central region atoms equivalent to the electrode atoms should be similar to the compensation charge of the electrode atoms. For the rest of the atoms, there are no requirements. The atomic compensation charge could for instance be used to model a certain doping distribution of the device.

An atomic compensation charge can be applied to a MoleculeConfiguration, BulkConfiguration, SurfaceConfiguration, and DeviceConfiguration via the setExternalPotential method.