Charge density difference analysis takes the difference between charge densities of the system of interest and a reference one and plots charge redistribution due to chemical bonds.
Δρ=ρAB−ρA−ρB
where ρAB is the total charge (or electron) density of the whole system, ρA,ρB are the density of the corresponding isolated system.
It requires three single-point calculations of system AB, A, and B to print the electron density or total density.
One can use Cubecruncher to manipulate the CUBE files.
cubecruncher.x -i AB.cube -subtract A.cube -o AB_A.cube cubecruncher.x -i AB_A.cube -subtract B.cube -o chg_dif.cube
This type of analysis is also useful in the case of time-dependent calculations. In this case, the difference would be taken over time, with respect to some reference snapshot (e.g. ground state).
Δρ(t−t0)=ρ(t)−ρ(t0),
where ρ(t) is the electron density at time t, and ρ(t0) is the reference electron density.
cubecruncher.x -i elec_dens_t.cube -subtract elec_dens_t0.cube -o diff_t-t0.cube