QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: simCity on July 31, 2013, 10:41

Title: Compute total charge
Post by: simCity on July 31, 2013, 10:41
Hi all,

How can I compute the total charge inside the scattering region when I do a 2-probe device simulation? The electron density is exported as a cube file which I don't know. Can it be done inside ATK in Python language?

Thanks a lot.
Jim
Title: Re: Compute total charge
Post by: Anders Blom on July 31, 2013, 12:19
This should do it

Code: python
[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]