The redistribution of charge (spin) density induced by the interaction between
two systems A and B can be analyzed by the following procedure:

**(i) calculate the composite system consisting of A and B**

Then, you will have a cube file for charge (spin) density. Let it be 'AB.cube'.
Also, you will find 'Grid_Origin' in the standard output which gives x-, y-,
and z-components of the origin of the regular grid as:

Grid_Origin xxx yyy zzzThe values will be used in the following calculations (ii) and (iii).

This calculation must be performed by the same calculation condition with the same unit cell as in the composite system consisting of A and B. Also, the coordinates of the system A must be the same as in the calculation (i). To use the same origin as in the calculation (i) rather than the use of an automatically determined origin, you have to include the following keyword in your input file:

scf.fixed.grid xxx yyy zzzwhere 'xxx yyy zzz' is the coordinate of the origin you got in the calculation (i). Then, you will have a cube file for charge (spin) density. Let it be 'A.cube'.

As well as the calculation (ii), this calculation must be performed by the same calculation condition with the same unit cell as in the composite system consisting of A and B. Also, the coordinates of the system B must be the same as in the calculation (i). To use the same origin as in the calculation (i) rather than the use of an automatically determined origin, you have to include the following keyword in your input file:

scf.fixed.grid xxx yyy zzzwhere 'xxx yyy zzz' is the coordinate of the origin you got in the calculation (i). Then, you will have a cube file for charge (spin) density. Let it be 'B.cube'.

compile two codes as follows:

% gcc diff_gcube.c -lm -o diff_gcube % gcc add_gcube.c -lm -o add_gcube

First, generate a cube file for the superposition of two charge (spin) densities of the systems A and B by

% ./add_gcube A.cube B.cube A_B.cubeThe file 'A_B.cube' is the cube file for the superposition of charge (spin) density of two isolated systems. Then, you can generate a cube file for the difference charge (spin) density induced by the interaction as follows:

% ./diff_gcube AB.cube A_B.cube dAB.cubeThe file 'dAB.cube' is the cube file for the difference charge (spin) density induced by the interaction, where the difference means (AB - A_B).