Author Topic: why real number array returned but not complex number array ?  (Read 5761 times)

0 Members and 1 Guest are viewing this topic.

Offline jhwang

  • Regular QuantumATK user
  • **
  • Posts: 5
  • Reputation: 0
    • View Profile
Dear all:
When I use calculateProjectedHamiltonianEigenstates() to perform the MPSH calculation, I found the array returned by toArray() is not a complex but a float number array, which is contradictory to the manual "Array toArray(): Returns the real-space representation of the cell-function (i.e. the periodic part of the eigenstate) as complex numbers in a NumPy array with dimensions (n1, n2, n3)."
(http://www.quantumwise.com/documents/manuals/ATK-2008.10/ref.calculateprojectedhamiltonianeigenstates.html)
Can anyone help me for this ? Thanks very much.

Offline jhwang

  • Regular QuantumATK user
  • **
  • Posts: 5
  • Reputation: 0
    • View Profile
Here is the NanoLanguage script I used

import numpy

projected_hamiltonian_eigenstates = calculateProjectedHamiltonianEigenstates(
    self_consistent_calculation = scf,
    projection_atoms = (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103),
    quantum_numbers = (176)
)
for projected_hamiltonian_eigenstates_index,state in enumerate(projected_hamiltonian_eigenstates):
    label = 'Projected Hamiltonian Eigenstates'+' '+str(projected_hamiltonian_eigenstates_index)
    if processIsMaster(): file.addToSample(state, 'twoprobe_configuration', label)
    print projected_hamiltonian_eigenstates_index
    array1 = state.toArray()
    unit1  = state.toUnit()
    print unit1
    print array1.shape
    print array1[0][0][0]
    print state.quantumNumber()
    print state.eigenvalue()

Offline zh

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 1141
  • Reputation: 24
    • View Profile
Quote
I found the array returned by toArray() is not a complex but a float number array,
A simple question for you: Do you how to define a variable with the "complex numbers" type in Python?

Could you paste the returned values for the object with the "complex number" type in your case?

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
There is no reason to expect these eigenstates to be complex; they are eigenstates of a finite Hamiltonian, and as such they can always be chosen real.

Thus, I'm afraid this is just a mistake in the manual! The only complex output I can think of in ATK are Bloch states (and transmission eigenstates), so probably this is copy/paste error... :)

Sorry for the confusion!

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
In case someone is curious about complex numbers in Python, here's how you declare a simple complex number:
Code
a = 3+2j
print a.real
Output:
Quote
3

Offline jhwang

  • Regular QuantumATK user
  • **
  • Posts: 5
  • Reputation: 0
    • View Profile
Thank you for your clarification!
I have plot the wavefunction by the array returned back, and it is identical to the reported results.