Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hirshfeld charge analysis #494

Merged
merged 47 commits into from
Sep 29, 2024

Conversation

moritzgubler
Copy link
Contributor

I implemented Hirshfeld charge partitioning. A method to compute partial charges of atoms in molecules which is implemented in many electronic structure code. The Hirshfeld charge of atom $i$ is defined as:
$$q_i=Z_i-\int\frac{\rho^0_i(\mathbf{r})}{\sum_j\rho^0_j(\mathbf{r})}\rho(r)d\mathbf{r}$$
where $Z_i$ is the atomic number of element $i$, $\rho$ is the molecular density and $\rho_i^0$ is density of $i$ as an isolated atom.
The spherically symmetric reference charge densities were obtained with an LDA calculation and are tabulated in share/hirshfeld/lda/{element_name}.density

To improve the numerical stability, the logarithm of the density is interpolated internally and the logsumexp trick was used to get rid of 0/0 issues in regions far away from all nuclei in the function in the integral above.

Copy link
Contributor

@stigrj stigrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! I think we can put this radial interpolator to more use, e.g. for Susi's Superposition of Atomic Potentials (SAP) initial guess. And these LDA atomic densities are probably better than the 3-21G densities used in the current SAD initial guess, so I guess we can replace those 🙂

@moritzgubler
Copy link
Contributor Author

Are the SAD input densities also spherically symmetric? If you think the radial interpolator is useful for other people too, we should probably put it in a different directory do you have some suggestions?

@stigrj
Copy link
Contributor

stigrj commented Sep 26, 2024

Currently the SAD densities are not symmetric, because they are precomputed using unrestricted LDA in a tiny 3-21G basis, but I think it would be better if they were symmetric. Perhaps move it to a folder under utils?

@moritzgubler
Copy link
Contributor Author

Yes, in that case I think it is better when they are symmetric. I can polish the interpolator a bit, implement some more interpolation modes and move it to utils.

@moritzgubler
Copy link
Contributor Author

I moved specific parts of my implementation into more accessible locations:

  • readAtomicDensity -> qmfunctions/density_utils
  • logsumexp -> utils/mathutils
  • polyInterpolator -> utils/PolyInterpolator

I also added another extrapolation mode in the poynomial interpolator that is useful for interpolating densities directly: No extrapolation to the left and returning 0 if x > xmax.

The building blocks to replace the SAD densities by our new densities should now be in place and it should be quite easy to implement it in the future

@stigrj stigrj merged commit aa3868b into MRChemSoft:master Sep 29, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants