ddsolvation / ddX

Fast continuum solvation based on domain decomposition
https://ddsolvation.github.io/ddX/
GNU Lesser General Public License v3.0
21 stars 4 forks source link

build_psi function in ddx_multipolar_solutes.f90 #141

Open kleinZhf opened 1 year ago

kleinZhf commented 1 year ago

Is this function used to build the electron density matrix \psi? In the paper doi: 10.1063/5.0104536 \psi is described as \psi = \sqrt{4\pi} q_i in equation(5), but this function generate \psi by the factor of 4\pi, is this an error?

mnottoli commented 1 year ago

This is exactly the function used to assemble the spherical harmonics representation of the solute's density (\psi).

The equation reported in the paper provides a way to compute \psi for a set of point charges (q).

In ddx_multipolar_solutes we generalized the construction for a set of multipoles of arbitrary order (M), however, for internal consistence the multipoles are given in real spherical harmonics. The conversion factor from charges (q) to monopoles (M_0^0) in spherical harmonics is exactly the term missing there.

We have

M_0^0 = q / \sqrt{4\pi}

and as a consequence

\psi = 4 \pi M_0^0 = \sqrt{4\pi} q

The rules for converting from cartesian multipoles to spherical harmonics multipoles are given here: https://en.wikipedia.org/wiki/Table_of_spherical_harmonics#Real_spherical_harmonics

If the density is beyond point multipoles (e.g. QM density), then a numerical integration scheme must be used, and since this is strongly dependent on the host code, we don't provide the tools for this in the ddX library. The integral to be evaluated is given in 10.1021/acs.jctc.9b00640 eq. 16.

I hope this helps.

mnottoli commented 1 year ago

We will improve the documentation of the module ddx_multipolar_solutes before closing this issue.

kleinZhf commented 1 year ago

Thanks a lot for your patiently explaination. I am trying to understand this dd series methods of solvation and the ddX code, did you mean that the ddX library now can only deal with the density of point multipoles? what if I need to generate the density from a quantum chemistry package? should I integrate the density to generate point multipoles that can be passed to ddX?

mnottoli commented 1 year ago

In an energy computation, ddX requires two main quantities as an input: the electric potential at the cavity points and \psi which is a sort of representation of the solute's density preintegrated with some constants (if the method is ddLPB then the electric field is also needed).

If the density of the solute is given as a distribution of multipoles of any order, like in molecular mechanics, then all the functions defined in ddx_multipolar_solutes can be used. All of them are also accelerated with FMM such that there are no N^2 bottlenecks.

If the density is QM there are two strategies:

If analytical derivatives are needed, everything is a little bit more complicated. In Psi4 we are computing the Fock matrix as well, but we don't support forces computations yet.

kleinZhf commented 1 year ago

Actually I am trying to implement ddX into pyscf, which has integrated the ddCOSMO previously. Your work in Psi4 may help a lot. But I am considering that the analytical derivatives for multipolar representation has already been integrated in ddX, does this mean that if I generate the multipolar representation and pass it to ddX, I can already get the derivateives?

I would like to read your ddX code and the Psi4 implementations carefully these days. And if I want to understand the analytical derivatives more detailly, do you have any recommended references I should refer to besides 10.1021/acs.jctc.9b00640 and 10.1063/5.0104536 ?

kleinZhf commented 1 year ago

By the way, does your work in Gaussian already in a realease? I couldn't find the description of the dd methods in the manual of g16. Am I missing the keywords or it is in an upcoming realease of gaussian?

mnottoli commented 1 year ago

Sorry for the late reply.

But I am considering that the analytical derivatives for multipolar representation has already been integrated in ddX, does this mean that if I generate the multipolar representation and pass it to ddX, I can already get the derivateives?

Yes, this is correct, including the forces. However, you will need to implement the analytical derivatives of your rules for integrating the QM density to multipoles.

I would suggest these: 10.1021/acs.jctc.9b00640, 10.1002/qua.25669, 10.1063/1.4901304 You may also find some additional information in chapter 4.4 of my PhD thesis: https://etd.adm.unipi.it/theses/available/etd-02082022-163212/unrestricted/copia_digitale.pdf

This 10.1063/5.0104536 is about classical solutes, so that is not strictly needed for a QM solute.

By the way, does your work in Gaussian already in a realease? I couldn't find the description of the dd methods in the manual of g16. Am I missing the keywords or it is in an upcoming realease of gaussian?

Unfortunately, this was done in an internal development version, and it is not yet released.