Atomic charges and spin
Mulliken charges
Get the Mulliken charge of each atom, which is evaluated automatically after the SCF calculation.
Because AOF-DFT keeps a density matrix for each atom, atomic charges can be analysed, which was difficult with conventional orbital-free DFT. After the SCF calculation the Mulliken charges are evaluated automatically and stored as a NumPy array in atoms.arrays["charge"].
"""
Advance/OF-DFT example: Mulliken charges of each atom.
Copyright (C) 2026 AdvanceSoft Corporation, All rights reserved.
"""
from ase.build import bulk
from aofdft.calculator import AOFDFTCalculator
VPS_DIR = "path/to/DFT_DATA19_AS/VPS" # edit these two paths for your environment
PAO_DIR = "path/to/DFT_DATA19_AS/PAO"
# 2x2x2 repetitions of the primitive cell (16 atoms)
systems = {
"SiC (zincblende)": bulk("SiC", crystalstructure="zincblende", a=4.36).repeat((2, 2, 2)),
# you can add more systems
# "GaAs (zincblende)": bulk("GaAs", crystalstructure="zincblende", a=5.65).repeat((2, 2, 2)),
}
for name, atoms in systems.items():
atoms.calc = AOFDFTCalculator(
console = False,
logging_file = f"{atoms.get_chemical_formula()}.log",
kin_type = "AS26",
kin_model = "Crystal26",
vps_dir = VPS_DIR,
pao_dir = PAO_DIR,
atomic_charge = True, # default: atomic charges are evaluated after the SCF
)
atoms.get_potential_energy()
# Mulliken charges are stored in the Atoms object (positive = lost electrons)
charges = atoms.arrays["charge"]
print(name)
for atom, q in zip(atoms, charges):
print(f" {atom.index:2d} {atom.symbol:2s} {q:+.4f}")
print(f" sum = {charges.sum():+.2e}")
Example output
SiC (zincblende)
0 Si +1.2871
1 C -1.2871
2 Si +1.2871
3 C -1.2871
4 Si +1.2871
5 C -1.2871
6 Si +1.2871
7 C -1.2871
8 Si +1.2871
9 C -1.2871
10 Si +1.2871
11 C -1.2871
12 Si +1.2871
13 C -1.2871
14 Si +1.2871
15 C -1.2871
sum = +5.43e-11
Notes
- A positive charge means that the atom has lost electrons: it is the number of valence electrons minus the electrons assigned to the orbitals of the atom. In SiC the more electronegative C is negatively charged.
- The cell is a 2×2×2 repetition of the primitive cell of SiC (16 atoms). With v1.0.0 the results change when the cell has a short period. All atoms of an element are equivalent, so they have the same charge.
- The charges sum to the net charge of the system (
total_charge, 0 by default). - Mulliken charges depend on the choice of basis functions. They are best used to compare changes between structures or charge states rather than as absolute values (see Charge doping).
- In spin-polarized calculations the spin of each atom is stored in
atoms.arrays["spin"](see Spin-polarized calculation). - A per-orbital breakdown is available with Orbital populations.
- Set
atomic_charge=Falseto skip the evaluation when the charges are not needed.