Author Topic: How to obtain the electron matrix elements of the Hamiltonian and overlap?  (Read 8319 times)

0 Members and 1 Guest are viewing this topic.

Offline hejun8035

  • Heavy QuantumATK user
  • ***
  • Posts: 47
  • Reputation: 0
    • View Profile
Dear Prof.
I am a user of ATK. I just want to obtain the electronic matrix elements of the Hamiltonian and overlap which can calculate in the "Siesta". Can it obtain from the ATK and how to operate? thanks!

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Technically yes, but not in a format that is documented or possible to easily use. It would probably be more fruitful if you describe what you wish to do with these quantities, and formulate it as a feature request if it's something that is currently not available in ATK.

Offline kstokbro

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 392
  • Reputation: 13
    • View Profile
    • QuantumWise
The format we use is a sparse format, in the example below is illustrated how you can print it out.
For it to be useful, we should provide some documentation and converter functions to compact formats,
this might be available later on.

However, here is how to print out the current format, not sure if it is useful.


from NanoLanguage import *
configuration = nlread("benzene.nc", object_id = "gID000")[0]
calculator = configuration.calculator()

dm_calculator = calculator._densityMatrixCalculator()

sparse_overlap = dm_calculator.overlap()
sparse_hamiltonian = dm_calculator.hamiltonian()
sparse_dm = dm_calculator.densityMatrix()

#print spin components (NLEngine.UPUP, NLEngine.DOWNDOWN)
sparse_overlap._print(NLEngine.UPUP)
# convert to a python object, an printout the sparse python object
numpy_overlap = NLEngine.sparseSpinMatrixToNumpy(sparse_overlap)
print numpy_overlap

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
The sparse matrices can be a little bit hard to use. Here is a script which gives the dense matrices.

Offline kstokbro

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 392
  • Reputation: 13
    • View Profile
    • QuantumWise
Attached is a script which prints out the sparse matrix entries, sometimes it is handy with the real space hamiltonian and overlap

Offline waynebeibei

  • New QuantumATK user
  • *
  • Posts: 3
  • Country: sg
  • Reputation: 0
    • View Profile
When I run HS.py, I always meet the error:

    K = NLEngine.Cartesian3D(ka,kb,kc)
AttributeError: 'module' object has no attribute 'Cartesian3D'


Anyone know the reason? My version is 13.8.1

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
The original HS.py code is written for 12.8. In 13.8 use the attached version instead.

Note, however, that both of these versions are unsupported, and just provided as-is. If they work for your purpose, great. If not, sorry. In ATK 2014, however, there will be officially supported ways to extract a lot of quantities, like the self-energies, Hamiltonian, etc.

Offline waynebeibei

  • New QuantumATK user
  • *
  • Posts: 3
  • Country: sg
  • Reputation: 0
    • View Profile
Thanks for your help! Now I got the Hamiltonian matrix as you suggested :
[[-0.01471202+0.j  0.00000000+0.j -0.00675525+0.j ...,  0.00000000+0.j
   0.00000000+0.j  0.00000000+0.j]
 [ 0.00000000+0.j -0.01471202+0.j  0.00000000+0.j ...,  0.00000000+0.j
   0.00000000+0.j  0.00000000+0.j]
 [ 0.00000000+0.j  0.00000000+0.j -0.01471202+0.j ...,  0.00000000+0.j
   0.00000000+0.j  0.00000000+0.j]
 ...,
 [ 0.00000000+0.j  0.00000000+0.j  0.00000000+0.j ..., -0.01471202+0.j
  -0.11215793+0.j  0.00000000+0.j]
 [ 0.00000000+0.j  0.00000000+0.j  0.00000000+0.j ...,  0.00000000+0.j
  -0.01471202+0.j  0.00000000+0.j]
 [ 0.00000000+0.j  0.00000000+0.j  0.00000000+0.j ...,  0.00000000+0.j
   0.00000000+0.j -0.01471202+0.j]]
[[ 1.+0.j  0.+0.j  0.+0.j ...,  0.+0.j  0.+0.j  0.+0.j]
 [ 0.+0.j  1.+0.j  0.+0.j ...,  0.+0.j  0.+0.j  0.+0.j]
 [ 0.+0.j  0.+0.j  1.+0.j ...,  0.+0.j  0.+0.j  0.+0.j]
 ...,
 [ 0.+0.j  0.+0.j  0.+0.j ...,  1.+0.j  0.+0.j  0.+0.j]
 [ 0.+0.j  0.+0.j  0.+0.j ...,  0.+0.j  1.+0.j  0.+0.j]
 [ 0.+0.j  0.+0.j  0.+0.j ...,  0.+0.j  0.+0.j  1.+0.j]]
Matrix size:  (32L, 32L)

It has been truncated and how to show its full text?

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Please use Google and you shall find
Search: "numpy print array"
http://stackoverflow.com/questions/2891790/pretty-printing-of-numpy-array

Offline PR

  • Heavy QuantumATK user
  • ***
  • Posts: 28
  • Country: in
  • Reputation: 0
    • View Profile
Hello,
I am using ATK 2014 version.
Can you please tell me how can I extract these matrix elements, Hamiltonian and overlapping, from GUI.
If not directly from GUI then can you please provide some script for the same.



Thanks
PR.

Offline Umberto Martinez

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 479
  • Country: dk
  • Reputation: 26
    • View Profile