QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: 395235863 on April 1, 2016, 12:53

Title: How to plot bond Mulliken populations?
Post by: 395235863 on April 1, 2016, 12:53
Dear QuantumWise Staff,

How to plot the pic? Thank you very much
Title: Re: How to plot bond Mulliken populations?
Post by: Anders Blom on April 1, 2016, 13:13
Unfortunately, you have to evaluate the numbers by hand and put them in the right places with an image editing program. Which is probably what the authors of the paper did...
Of course some clever Python magic could make it possible, but it would be quite complex.
Title: Re: How to plot bond Mulliken populations?
Post by: 395235863 on April 1, 2016, 16:26
How to get the value from the MullikenPopulation.txt calculated by ATK
Title: Re: How to plot bond Mulliken populations?
Post by: Anders Blom on April 1, 2016, 17:05
You don't. Those are the atomic Mulliken populations,  you need the bond pair populations. See the reference manual: http://www.quantumwise.com/documents/manuals/latest/ReferenceManual/index.html/ref.mullikenpopulation.html (use the "bond" method)
Title: Re: How to plot bond Mulliken populations?
Post by: 395235863 on April 2, 2016, 10:15
In my MullikenPopulation.txt  ,there are 53 atoms.

this is my code:
# -------------------------------------------------------------
# Analysis from File
# -------------------------------------------------------------
mulliken_population = nlread('In-MoS2.nc', object_id='gID011')[0]

nlprint(mulliken_population)

#print partial occupations
print 'In ',mulliken_population.atoms()[30],
print ' | ',mulliken_population.orbitals()[30]
print

print 'S ',mulliken_population.atoms()[36],
print ' | ',mulliken_population.orbitals()[36]
print

#print mulliken population of bond
print 'In-S bond ',mulliken_population.bond(30,36)

# -------------------------------------------------------------
# Error file
# -------------------------------------------------------------
The error file is:
Traceback (most recent call last):
  File "bond.py", line 10, in <module>
    print 'In ',mulliken_population.atoms()[30],
IndexError: list index out of range
Title: Re: How to plot bond Mulliken populations?
Post by: Anders Blom on April 2, 2016, 23:26
Ah, there is a slight oversight in the manual - it doesn't tell you what the default spin is. Starting with 2015, the default is actually Spin.All, so you always get 4 lists back. If you calculation is not spin-polarized or using spin-orbit etc, just change to

atoms(spin=Spin.Up)[30]

etc

Now, if you didn't know this, you could always try first to just do
print 'In ',mulliken_population.atoms()
and
print len(mulliken_population.atoms())
That will give you more about what is returned - and you will see it's 4 lists (might be hard to know why, but at least it should be clear that you can't access element 30 if there are only 4 - but you could access [ 0 ][30].

Note that you can also run ATK interactively, by starting "atkpython" without further arguments. Then you give each command in your script line by line (or type "run %i bond.py", without the "") but now you are "inside" the code, so you can test things, like the print statement above just to see what the length of the returned list actually is, etc.
Title: Re: How to plot bond Mulliken populations?
Post by: 395235863 on April 3, 2016, 04:08
Thank you very much!