Fast computation of electrostatic potential on grid

Hi everyone, I have a question concerning the computation of the electrostatic potential of an arbitrary density on numerical grid.
At the moment I am accomplishing the task using the following code (through the psi4 python API):
Dreal = Dtest.real
Vvals_dt = wfn_scf.oeprop.Vvals()
the grid (grid.dat ) and the wfn_scf object has been previously generated by
(ene,wfn = psi4.prop(‘blyp’, properties=[‘GRID_ESP’], return_wfn=True)).
I have noticed that when oeprop.compute() is invoked the grid_esp.dat file is created. But the electrostatic potential is available through wfn_scf.oeprop.Vvals() and I don’t need to write it down in a file. So I was guessing if there is some trick to avoid the creation of grid_esp.dat and save some time.
Thanks in advance for you suggestions.

1 Like

Hi there,

I split this code into the old “oeprop compute” way and an in-memory calculation without the esp.dat file, which I use for Resp charges.

import psi4.core as p4c
myepc = p4c.ESPPropCalc(wfn)
psi4_matrix = p4c.Matrix.from_array(points)
esps_psi4 = np.array(myepc.compute_esp_over_grid_in_memory(psi4_matrix))

Let me know, if you need code, which is more verbose.


1 Like

Timo, thank you so much. I can not figure out how I missed this manpage.