infinite loop for cutoff=0.0 from python interface
Closed this issue · 1 comments
PicoCentauri commented
This piece of code leads to an infinite loop
import ase
from rascaline import SphericalExpansion
atoms = ase.Atoms("OO", positions=((0,0,0),(1,0,0)), pbc=True, cell=[2,2,2])
HYPER_PARAMETERS = {
"cutoff": 0.0,
"max_radial": 9,
"max_angular": 6,
"atomic_gaussian_width": 0.3,
"center_atom_weight": 1.0,
"radial_basis": {"Gto": {"spline_accuracy": 1e-6}},
"cutoff_function": {"ShiftedCosine": {"width": 0.5}},
"radial_scaling": {"Willatt2018": {"scale": 2.0, "rate": 1.0, "exponent": 4}},
}
calculator = SphericalExpansion(**HYPER_PARAMETERS)
descriptor0 = calculator.compute(atoms)
However a rust test
#[test]
fn cutoff_zero() {
let soap_parameters = r#"{
"cutoff": 0.0,
"max_radial": 9,
"max_angular": 6,
"atomic_gaussian_width": 0.3,
"center_atom_weight": 1.0,
"radial_basis": {"Gto": {"spline_accuracy": 1e-6}},
"cutoff_function": {"ShiftedCosine": {"width": 0.5}},
"radial_scaling": {"Willatt2018": {"scale": 2.0, "rate": 1.0, "exponent": 4}}
}"#;
let mut calculator = Calculator::new(
"spherical_expansion",
soap_parameters.into(),
).unwrap();
let mut systems = test_systems(&["water", "methane"]);
calculator.compute(&mut systems, Default::default()).unwrap();
}
leads to
thread 'calculators::soap::spherical_expansion::tests::cutoff_zero' panicked at 'assertion failed: `(left == right)`
left: `NaN`,
right: `NaN`: matrix is not symmetric', rascaline/src/math/eigen.rs:254:17
Luthaf commented
I guess these two checks should use <=
:
rascaline/rascaline/src/calculators/soap/radial_integral/gto.rs
Lines 33 to 39 in a4e46d5
What happens with cutoff=1e-16
?