# c2x Analysis

Apart from symmetry analysis, which is available if c2x is compiled with spglib, c2x is able to perform some basic analysis of bands and densities.

## Integration

c2x will integrate any density. The example below uses the null output format to avoid writing any density file:

```\$ c2x -cv --null ethene.check
Castep version 18.100
Cell volume 447.999999
natoms      6
Total ionic charge 12.000000
kpoint MP grid 1 1 1
offset 0.000000 0.000000 0.000000
Requested cut-off energy 462.594 eV
First FFT grid     50 50 45
spins=1   spinors=1
Found 3D data for Density
min=-0.00393329  max=2.326  sum=3013.39  int=12
```

Ethene has 12 valence electrons (four each per carbon, one each per hydrogen), so the int(egral) of the charge density should indeed be 12.

## Max/min values

c2x can report the maximum and minimum values from any density. This may be most useful for spin densities:

```\$ c2x -sv --null FeO.check
Castep version 18.100
Cell volume 40.647641
natoms      4
Total ionic charge 28.000000
kpoint MP grid 1 3 3
offset 0.250000 0.000000 0.000000
Requested cut-off energy 612.256 eV
First FFT grid     45 24 24
spins=2   spinors=1
Found 3D data for Spin
min=-8.21886  max=8.45177  sum=-0.827139  int=-0.00129712
```

Near zero net spin, and minimum and maximum values of similar magnitude, strongly suggests a paramagnetic system. The extreme values are as discretised on the real-space grid. If one first interpolates onto a finer grid, they are significantly closer in magnitude:

```\$ c2x -sv -i=100,50,50 --null FeO.check
Castep version 18.100
Cell volume 40.647641
natoms      4
Total ionic charge 28.000000
kpoint MP grid 1 3 3
offset 0.250000 0.000000 0.000000
Requested cut-off energy 612.256 eV
First FFT grid     45 24 24
spins=2   spinors=1
Found 3D data for Spin
min=-8.21886  max=8.45177  sum=-0.827139  int=-0.00129712
Moving from 45x24x24 to 100x50x50 recip grid
After interpolation:
min=-8.45237  max=8.45177  sum=-7.97781  int=-0.00129712
```

## Dipole moments

c2x can report the dipole moment of a system - it considers both the atomic charges and the valence charge density. It is necessary to specify the origin about which one wishes the dipole moment to be calculated when dealing with a periodic system.

```\$ c2x -c -D=0.225,0.125,0 --null ethene.check
Ed: 0.000007 0.000004 0.000000
Total charge: -0.000000
Total dipole (eA): (0.000057,0.000033,0.000000)  magnitude 0.000066
```

The first line gives the electronic contribution to the dipole, then the total charge is reported, and finally the total dipole, as a vector and separately its modulus. In this case the expected answer is zero.

The calculation of the electronic dipole moment is performed directly in reciprocal space.

The contribution of an ion which lies half a lattice vector from the origin of the dipole is ill-defined. From c2x version 2.20 such contributions are set to zero (separately for each axis).

## Band inversion symmetry

c2x can determine whether an individual band, at either gamma point or a k-point whose co-ordinates are all either zero or ±0.5, has inversion symmetry, and, if so, with what parity.

```\$ c2x -I=- --null ethene.check
Band parity called for k=(0.000000,0.000000,0.000000)
Band   1: inversion with even parity about (0.225001,0.125000,-0.000000)
Band   2: inversion with odd parity about (0.225005,0.125001,-0.000000)
Band   3: inversion with odd parity about (0.225005,0.125004,-0.000000)
Band   4: inversion with even parity about (0.225003,0.124998,0.000000)
Band   5: inversion with even parity about (0.225014,0.125003,-0.000000)
Band   6: inversion with odd parity about (0.225000,0.125000,-0.000000)
Band   7: inversion with even parity about (0.225002,0.125000,-0.000000)
Band   8: inversion with even parity about (0.225619,0.125221,-0.000003)
Band  10: inversion with even parity about (0.224848,0.124673,-0.000015)
```

This can be compared with the figure at the bottom of the bands page, which shows the first five bands. The sixth band is the π bond. If sufficient verbosity flags are added, c2x will also report a confidence, or residual. High residuals mean a low confidence.

```Band   1: inversion with even parity about (0.225001,0.125000,-0.000000)
(residual 0.000020)
[...]
Band   8: inversion with even parity about (0.225619,0.125221,-0.000003)
(residual 0.005402)
No parity: one of x, y or z failed
```

Unoccupied bands may be poorly converged and thus fail to have the expected symmetry.

This analysis was introduced in c2x 2.16 for Castep output only, as it needs to be able to read the complex data for individual bands. Version 2.30 extended this to Abinit, QE and VASP.