Hi all,

I'd like to compute the overlap between Bloch states. For a given computed wavefunction \psi_k I have tried getting its overlap with itself as a first test as:

`wfc = nlread('file.hdf5', BlochState)[-1] `

wfc_array = wfc.toArray()

wfc_s0 = wfc_array[:,:,:,0]

psi_2 = numpy.conj(wfc_s0) * wfc_s0

delta_x = wfc.gridCoordinate(1,1,1).inUnitsOf(Bohr)[0]

integrated_x = numpy.trapz(psi_2, axis=0, dx=delta_x)

integrated_y = numpy.trapz(integrated_x, axis=0, dx=delta_x)

overlap = numpy.trapz(integrated_y, axis=0, dx=delta_x)

(Note: cell is simple cubic so dx=dy=dz)

And that final 'overlap' would be the final result. Does this seem correct? The overlap doesn't integrate to 1 , or to a number of electrons as far as I can see. Although that's to be expected perhaps? Any feedback would be greatly appreciated.

Thanks for your help,

A