Skip to content

Commit

Permalink
Better error message if we can not compute GTO radial integral
Browse files Browse the repository at this point in the history
  • Loading branch information
Luthaf committed May 23, 2023
1 parent 9a658e6 commit 562252e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions rascaline/src/calculators/lode/radial_integral/gto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ impl LodeRadialIntegral for LodeRadialIntegralGto {
);

for l in 0..(self.parameters.max_angular + 1) {
assert!(values[[l, n]].is_finite());
values[[l, n]] *= factor;
if let Some(ref mut gradients) = gradients {
gradients[[l, n]] *= k_norm_sigma_n_2 * factor;
Expand Down
7 changes: 7 additions & 0 deletions rascaline/src/calculators/soap/radial_integral/gto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ impl SoapRadialIntegral for SoapRadialIntegralGto {
let n_l_3_over_2 = 0.5 * (n + l) as f64 + 1.5;
let c_dn = (c + gto_constant).powf(-n_l_3_over_2);

if !values[[l, n]].is_finite() {
panic!(
"Failed to compute radial integral with GTO basis. \
Try increasing decreasing the `cutoff`, or increasing `atomic_gaussian_width`."
);
}

values[[l, n]] *= c_dn * factor;
if let Some(ref mut gradients) = gradients {
gradients[[l, n]] *= c_dn * factor * 2.0 * z / distance;
Expand Down

0 comments on commit 562252e

Please sign in to comment.