aiida-vasp / parsevasp

A general parser for VASP
MIT License
13 stars 13 forks source link

Should emit exception when putting numpy N-d array (N>0) to a scalar element of numpy array. #143

Open atztogo opened 6 months ago

atztogo commented 6 months ago

https://github.com/aiida-vasp/parsevasp/blob/9d78ad4c0bb953e533b7608977bd1bd04b21ea97/parsevasp/vasprun.py#L2742

This line can be in the following situation. Then it should emit an exception, but not warning.

In [5]: a = np.array([1])

In [6]: b = np.zeros(1)

In [7]: b[0] = a
<ipython-input-7-ccfabdddc874>:1: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
  b[0] = a