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

BeckeWeights.generate_weights should raise an exception when it tries to use Nan radii #100

Closed
tovrstra opened this issue Jul 29, 2020 · 2 comments
Assignees
Milestone

Comments

@tovrstra
Copy link
Member

The following example will cause the becke partitioning to use Nan radii. The resulting grid gives large integration errors but not Nans:

import numpy as np
from grid.becke import BeckeWeights
from grid.molgrid import MolGrid
from grid.onedgrid import GaussChebyshev
from grid.rtransform import BeckeTF
becke = BeckeWeights(order=3)
oned = GaussChebyshev(150)
rgrid = BeckeTF(1e-4, 1.5).transform_1d_grid(oned)
grid = MolGrid.horton_molgrid(np.array([[0, 0, -1], [0, 0, 1]]), np.array([2, 2]), rgrid, 74, becke)
print(grid.weights.min())
print(grid.weights.max())

Output:

/home/toon/miniconda3/envs/horton3/lib/python3.7/site-packages/grid/becke.py:82: RuntimeWarning: invalid value encountered in greater
  alpha[alpha > cutoff] = cutoff
/home/toon/miniconda3/envs/horton3/lib/python3.7/site-packages/grid/becke.py:83: RuntimeWarning: invalid value encountered in less
  alpha[alpha < -cutoff] = -cutoff
-121784734604746.08
109395391879381.38

The resulting grid is not usable, so it would be safer to raise an exception when trying to construct becke weights with atoms for which the radii ar not defined.

@FarnazH FarnazH added this to the release milestone May 14, 2021
@PaulWAyers
Copy link
Member

PaulWAyers commented May 20, 2021

Psi4's radii can be found at:
https://github.com/psi4/psi4/blob/b4a272f74b73df8cf0edc4096081a250c495d55e/psi4/src/psi4/libfock/cubature.cc#L111

They just use H's radius for He. The use 3.3 a.u. whenever it isn't available.

tczorro added a commit to tczorro/grid that referenced this issue May 21, 2021
1. For most atoms, if nan given, automatically select
atomic radius with 1 less.
`warning`: No.86 RN will still be broken.
tczorro added a commit that referenced this issue Jun 10, 2021
1. For most atoms, if nan given, automatically select
atomic radius with 1 less.
`warning`: No.86 RN will still be broken.
@tczorro
Copy link
Collaborator

tczorro commented Jun 17, 2021

add an error message to nan after the rollback if exists

@tczorro tczorro self-assigned this Jul 16, 2021
tczorro added a commit to tczorro/grid that referenced this issue Jul 19, 2021
tczorro added a commit to tczorro/grid that referenced this issue Jul 19, 2021
Ali-Tehrani pushed a commit to Ali-Tehrani/grid that referenced this issue Aug 16, 2021
@tczorro tczorro closed this as completed May 17, 2022
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

No branches or pull requests

4 participants