QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: jjhskang on May 11, 2011, 14:11

Title: Error in Nanolanguage in writing Mulliken charge
Post by: jjhskang on May 11, 2011, 14:11
Hi!

I am trying to calculate Mulliken charge of each atom in bulk configuration. For that, I first made a calculation with "atk_setup.py " attached. It generates a file "mulliken.nc". Next, I tried to print the Mulliken charge of each atom by running the file "mulliken.py".

However, it gives an error message:
---------------------------------------------------
Traceback (most recent call last):
  File "mulliken.py", line 6, in <module>
    mulliken_up = mulliken_pop.atoms(0)
AttributeError: 'list' object has no attribute 'atoms'
Traceback (most recent call last):
  File "mulliken.py", line 6, in <module>
    mulliken_up = mulliken_pop.atoms(0)
AttributeError: 'list' object has no attribute 'atoms'
----------------------------------------------------------------

Can you let me know what the problem is? Why does it say that there exist no attribute 'atoms'? What's wrong with this?
I am pretty new for ATK2011.02.

Title: Re: Error in Nanolanguage in writing Mulliken charge
Post by: zh on May 12, 2011, 13:49
The "mulliken_pop" defined in your script file is just a list, not a object.
Quote
mulliken_pop = nlread(
   'mulliken.nc',
   MullikenPopulation
   )

The following modification will give a object:
Quote
mp = nlread(
   'mulliken.nc',
   MullikenPopulation
   )
mulliken_pop=mp[0]
Please refer to the use of "nlread():
http://quantumwise.com/documents/manuals/latest/ReferenceManual/index.html/ref.nlread.html
Title: Re: Error in Nanolanguage in writing Mulliken charge
Post by: Anders Blom on May 12, 2011, 14:21
Absolutely correct. I just wanted to add that nlread always returns a list, even if there is only one matching object in the NC file. This is done so that the return type of the function nlread is well-defined (always a list), and not dependent on how you call the function or what the contents of the file is.