Author Topic: evaluate() is really slow for Effective Potential  (Read 2482 times)

0 Members and 1 Guest are viewing this topic.

Offline Hassan

  • Regular QuantumATK user
  • **
  • Posts: 21
  • Country: ca
  • Reputation: 0
    • View Profile
evaluate() is really slow for Effective Potential
« on: August 20, 2015, 06:18 »
Hi, I found this weird issue with using evaluate() on an Effective Potential grid object using ATK 14.2.         
Code
voltage = effective_potential_obj.evaluate (x_coord, y_coord, z_coord, Spin.Sum)
This line takes around 100 milliseconds on an object that has  242x223x363 grid points. I have a script that outputs these grid objects to an XYZ format, and it would take days to do this. For some reason this is only happening with Veff objects and not, say, Electron Density. The work around I've found is using the toArray() function, which takes around ~5 seconds to convert to an array and then takes only 50 µs for an access. However, this is annoying because I have to map physical coordinates to array indices, and annoyingly there is no function that does that (gridCoordinate() does the opposite). I thought you might look into why this is happening.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: evaluate() is really slow for Effective Potential
« Reply #1 on: August 20, 2015, 11:22 »
If your grid is orthogonal it's quite easy to write a Python function to map physical coordinates to array indices since all grids start at x=y=z=0 and you know
a) the size of the cell, and
b) the number of grid points
So basically the grid index "before" a point x is int(x*NA/A) and similar for y and z, where NA is the number of points along A and A is the length of the cell A vector.

Alternatively you can export the grid to Cube file format in VNL easily.

We will check why it's slower for EffPot, shouldn't be, but also there have been some upgrades to this in 2015 - plus do note that you should upgrade to 2014.3, since several bugs were fixed.