Author Topic: Capacitance calculation as in tutorial  (Read 3019 times)

0 Members and 1 Guest are viewing this topic.

Offline PR

  • Heavy QuantumATK user
  • ***
  • Posts: 28
  • Country: in
  • Reputation: 0
    • View Profile
Capacitance calculation as in tutorial
« on: March 31, 2014, 13:11 »
Dear sir,
I was trying to plot capacitance versus voltage curve as given in your mini tutorial at link : http://quantumwise.com/publications/tutorials/mini-tutorials/203
While doing so, I got an error during the execution of file mulliken-analysis.py. This file is given on the mentioned link.
The error I got is :
Traceback (most recent call last):
  File "/tmp/3700607190692751.py", line 54, in <module>
    axarr[1].plot(numpy.arange(len(c)),numpy.cumsum(c-net_charges[0]))
  File "./build/atkpython/lib/python2.7/site-packages/matplotlib/axes.py", line 3848, in plot
  File "./build/atkpython/lib/python2.7/site-packages/matplotlib/axes.py", line 323, in _grab_next_args
  File "./build/atkpython/lib/python2.7/site-packages/matplotlib/axes.py", line 300, in _plot_args
  File "./build/atkpython/lib/python2.7/site-packages/matplotlib/axes.py", line 240, in _xy_from_xy
ValueError: x and y must have same first dimension.

Please tell me how to proceed with this.

Thanks
Priyank

Offline Umberto Martinez

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 479
  • Country: dk
  • Reputation: 26
    • View Profile
Re: Capacitance calculation as in tutorial
« Reply #1 on: April 1, 2014, 13:35 »
The error occurs when trying to plot the data. a workaround is to modify the lines 49 and 50 of the mulliken-analysis.py script with:
Code
    axarr[0].plot(numpy.arange(len(c[0])),c[0]-net_charges[0][0])
    axarr[1].plot(numpy.arange(len(c[0])),numpy.cumsum(c[0]-net_charges[0][0]))
or download the updated script (you may need to clean your browser's cache).

Offline Umberto Martinez

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 479
  • Country: dk
  • Reputation: 26
    • View Profile
Re: Capacitance calculation as in tutorial
« Reply #2 on: April 3, 2014, 08:44 »
let me add some more details regarding this problem. Starting from ATK 13.8.0 we changed some default parameters for spin. In particular when you the atoms method in MullikenPopulation you need to specify the spin components you want, even if the calculation is non-polarized. You can do that by using the spin keyword, cf. http://www.quantumwise.com/documents/manuals/latest/ReferenceManual/index.html/ref.mullikenpopulation.html, and change the original script from:
Code
mulliken_charges = [mulliken.atoms()-initial_population for mulliken in mulliken_list]
to:
Code
mulliken_charges = [mulliken.atoms(spin=Spin.Sum)-initial_population for mulliken in mulliken_list]