4.3 Charge-density differences on matched grids
These educational templates have not been executed and contain no fabricated numerical results. Inputs and filenames follow ABACUS 3.9.0 documentation; recheck every interface when changing version.
4.3.1 Question and declared model
Where does the electronic density redistribute when a neutral water molecule is assembled from neutral fragments? Reuse the accepted PW vacuum cell from isolated water, keeping the geometry frozen. Compare the molecule with an oxygen fragment and a two-hydrogen fragment placed at exactly the corresponding molecular positions. This is a specified density reference, not a unique measure of chemical charge transfer.
4.3.2 Physical interpretation
The difference is pointwise meaningful only when all three density fields represent the same spatial coordinates and compatible electron-density definitions. Neutral fragments retain the molecule's total valence-electron count. Open-shell atomic oxygen requires a documented spin-polarized fragment calculation; setting every fragment to the closed-shell molecular spin would define a different and usually unsuitable reference.
For nspin 2, sum the up and down densities before subtracting total charge density; their difference instead describes spin density. Positive charge-density difference means electronic accumulation relative to the chosen fragments, not positive ionic charge. An arbitrary isosurface threshold changes visible lobes, and neither lobe volume nor its color is an oxidation-state measurement.
Original course illustration; conceptual geometry and curves, not calculated results.
4.3.3 Worked input and file changes
# Molecule and every fragment: add/replace identical output controls.
calculation scf
out_chg 1 10
symmetry 0
scf_thr 1e-9
# O fragment: separate INPUT, retain O at its molecular position.
suffix oxygen_fragment
ntype 1
nspin 2
nbands 6
init_chg atomic
mixing_beta 0.2
mixing_beta_mag 0.2
mixing_gg0 0
mixing_gg0_mag 0
# O STRU ATOMIC_POSITIONS species header, same Cartesian location:
# O
# 2.0
# 1
# 8.0000 8.0000 8.0000 m 0 0 0
# H2 fragment: ntype 1, nspin 1, nbands 4; keep BOTH molecular H sites.
# Molecular geometry, full cell vectors, cutoff and KPT stay identical.
This is a controlled delta to isolated water. Create molecule, O and H2 directories. Remove absent species from STRU, including its ATOMIC_SPECIES entry, and update ntype; do not merely leave atoms with zero coordinates. Retain the exact original O and H PP files. The O species header seeds a collinear moment of 2 Bohr magnetons per O atom; this is initialization rather than a constrained final spin. Test physically relevant spin references and document the chosen converged fragment state. Keep a common PW basis, cutoff and cell so the FFT mesh should be comparable, but verify cube dimensions, origin and step vectors rather than assuming equality. If any grid differs, use a documented, electron-conserving resampling procedure or rerun on explicitly matched supported grid dimensions.
For the isolated O atom, the version 3.9 atomic-system guidance requires mixing_beta_mag to equal mixing_beta, and mixing_gg0_mag to equal mixing_gg0. The defaults do not enforce those equalities. The explicit 0.2/0.2 coefficients and disabled charge/spin Kerker scaling above are proposed trials, not a convergence guarantee. Inspect charge and magnetic residuals and the final fragment moment; if reducing the mixing coefficient, change both coefficients together. This atomic-fragment requirement must not be generalized into a universal bulk-metal prescription.
4.3.4 Run and inspect the evidence
Read each running_scf.log and confirm final SCF, electron count and oxygen magnetic state. Version 3.9 outputs SPIN1_CHG.cube for nspin 1, and SPIN1_CHG.cube plus SPIN2_CHG.cube for nspin 2. Parse the cube header first: atom count, origin, three grid sizes and grid step vectors. Match the spatial grid, not the atom lists, because fragment files intentionally contain fewer atoms. Obtain the cell volume element from the determinant of the grid-step matrix in the cube's coordinate units. ABACUS documents density in Bohr^-3. Sum O spin channels, subtract both fragment total densities from the molecular density, and retain a signed field. Plot equal-magnitude positive and negative isosurfaces together with atom positions. Archive the raw cubes and subtraction metadata.
4.3.5 Observable-specific convergence
Integrate every total density and compare with its PP valence count. Then integrate the difference; a proposed teaching target is an absolute residual below 0.001 electron, tightened if the accumulation of interest is comparable. This is not a claimed measured integral. Check output precision and cube parsing before attributing a failure to chemistry. Repeat at higher accepted cutoff and larger vacuum, comparing integrated positive and negative weights and chosen spatial sections. A molecule-versus-fragment subtraction should have equal total accumulation and depletion for neutral references; a substantial imbalance indicates mismatched charge, missing spin channels, grid units or incomplete data. Show several isovalues to distinguish robust spatial patterns from threshold-dependent ornament.
4.3.6 Acceptance worksheet and provenance
The cube worksheet must store grid dimensions, origin, all three step vectors, density units and spin-channel list for every component. Let the step-vector matrix be G; the integration volume per voxel is the absolute determinant of G, in Bohr cubed when the cube coordinates are in Bohr. Multiply each density sample in Bohr^-3 by this volume before summing. Do not multiply by the total cell volume once for every sample. The grid size times the voxel volume should reconstruct the represented periodic cell volume within formatting precision.
Record the three component electron integrals before forming the difference. Then integrate both the signed difference and its positive and negative parts separately. Neutral conservation requires the signed result to vanish and accumulation to equal depletion, but the common magnitude depends on the chosen fragment reference and is not automatically a unique transferred charge. Check cube ordering when converting to arrays: the stable keyword reference specifies x outermost and z fastest. A transposed array can retain its integral while placing lobes at wrong positions.
| Field / spin channels | Grid origin and dimensions matched? | Integral (electrons) | Expected PP valence total |
|---|---|---|---|
| H2O total | — | — | — |
| O up + down, H2 total | — | — | — |
| Signed difference / positive / negative | — | — | — |
Save the unmodified cubes and the subtraction-grid metadata. The worksheet is deliberately blank because no calculation has been executed.
4.3.7 Pitfalls and limits
Subtracting arrays with equal length but different origins is invalid. Cube scalar units are not automatically Angstrom^-3 because atom coordinates look molecular. An O fragment run that converges to an unintended spin state changes the reference. Relaxing fragments destroys the fixed-geometry assembly comparison. A density difference is not Bader charge analysis and does not by itself provide a unique number of transferred electrons. Do not renormalize a failed integral to zero before diagnosing its origin.
4.3.8 Exercises with answer guidance
- O has two spin cubes and the molecule one. Which fields enter the charge subtraction? Guidance: sum both O channels; use molecular total and H2 total. The O channel difference belongs to spin analysis.
- The difference integrates to two extra electrons. Is that bonding charge? Guidance: check valence counts, spin-channel omission and unit conversion first; neutral matched fragments must conserve total electrons.
4.3.9 Versioned references
- ABACUS 3.9.0: charge
- ABACUS 3.9.0: input-main
- ABACUS 3.9.0: stru
- ABACUS 3.9.0: atomic charge/spin mixing
- ABACUS PKU-authored teaching guide
The university-authored guide provides teaching context; older pages can predate 3.9. Use the linked official version for exact syntax. This is original instructional synthesis, and reference outputs are not presented as results of this course.