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
wfn_scf.oeprop.set_Da_ao(psi4.core.Matrix.from_array(Dreal))
wfn_scf.oeprop.compute()
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.
Matteo
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.
http://www.psicode.org/psi4manual/master/api/psi4.core.ESPPropCalc.html
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.
Best,
Timo
Timo, thank you so much. I can not figure out how I missed this manpage.
Hi @tstrunk
I am really interested in extracting the electric field over a grid. Can I assume compute_field_over_grid_in_memory
is what I am looking for?
And I a newbie in Psi4, so if you happen to have an example of such calculation, that would be great. Thank you!
Hi @mdpoleto,
yes, most probably you are looking for that. You can find an example inside the tests:
Best,
Timo
That is great, thank you very @tstrunk . Do you happen to know the unit in which the electric fields are output by compute_field_over_grid_in_memory
?
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.