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

UFCalculator error when model has resolution 0 for an interaction #26

Open
henk789 opened this issue Sep 8, 2022 · 0 comments
Open

Comments

@henk789
Copy link
Member

henk789 commented Sep 8, 2022

Problem description

When loading a model that has knot resolution 0 for an interaction, using UFCalculator results in an error message:

Traceback (most recent call last):
  File "/home/***/***/***/.conda/envs/uf3_env/lib/python3.8/concurrent/futures/process.py", line 239, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
  File "/scratch/slurm_tmpdir/job_21050829/ipykernel_1790295/233011300.py", line 22, in eval
    p_f = np.append(p_f, geom.get_forces())
  File "/home/***/***/***/.conda/envs/uf3_env/lib/python3.8/site-packages/ase/atoms.py", line 788, in get_forces
    forces = self._calc.get_forces(self)
  File "/pfs/data5/home/***/***/***/ba/uf3/uf3/forcefield/calculator.py", line 215, in get_forces
    f_3b = self.forces_3b(atoms, supercell)
  File "/pfs/data5/home/***/***/***/ba/uf3/uf3/forcefield/calculator.py", line 288, in forces_3b
    val_l = spline(triangles, nus=np.array([1, 0, 0]))
  File "/home/***/***/***/.conda/envs/uf3_env/lib/python3.8/site-packages/ndsplines/ndsplines.py", line 220, in __call__
    self.compute_basis_coefficient_selector(x, nus)
  File "/home/***/***/***/.conda/envs/uf3_env/lib/python3.8/site-packages/ndsplines/ndsplines.py", line 172, in compute_basis_coefficient_selector
    impl.evaluate_spline(t, k, x[:,i], nu, extrapolate_flag, self.interval_workspace[i], self.basis_workspace[i],)
  File "ndsplines/_bspl.pyx", line 96, in ndsplines._bspl.evaluate_spline
ValueError: Buffer dtype mismatch, expected 'const double' but got 'long'

Solution

The issue arises due to the JSON parsing used when loading models. Since the seven knot positions are all 0, they are loaded as integers. However, the ndspline package requires double. Therefore, the issue can be avoided when converting integer knot positions to doubles.

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

1 participant