Author Topic: Compute total charge  (Read 2835 times)

0 Members and 1 Guest are viewing this topic.

Offline simCity

  • Regular QuantumATK user
  • **
  • Posts: 22
  • Country: ca
  • Reputation: 0
    • View Profile
Compute total charge
« 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

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: Compute total charge
« Reply #1 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]