[nobbc]# Read the configuration and compute the electron density
conf = nlread("file.nc", DeviceConfiguration)[-1]
e = ElectronDensity(conf)
# Evaluate the normalization, i.e. the volume of each cell in the grid
c = e.volumeElement()
v = numpy.dot(numpy.cross(c[0],c[1]),c[2])
# Compute and print total number of electrons in central region
print numpy.sum(e.toArray())*v
[/nobbc]