Closed awvwgk closed 2 years ago
Out of bound indexing is not handled gracefully at the moment. Trying some funny things in the session below, which eventually did crash the library:
❯ python Python 3.10.2 | packaged by conda-forge | (main, Mar 8 2022, 15:53:57) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import libconeangle >>> libconeangle.cone_angle([[0.0, 0.0, -0.52], [0.0, 0.0, 1.76], [0.0, 0.0, 2.86]], [2.1, 1.7, 1.52], 1) (96.4237340645161, array([0., 0., 1.]), [2]) >>> libconeangle.cone_angle([[0.0, 0.0, -0.52], [0.0, 0.0, 1.76], [0.0, 0.0, 2.86]], [2.1, 1.7, 1.52], 0) Atoms within vdW radius of metal atom. Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/awvwgk/projects/src/git/mctc-tools/libconeangle/libconeangle/coneangle.py", line 54, in cone_angle raise ValueError("libconeangle exited with non-zero exit code: {stat}") ValueError: libconeangle exited with non-zero exit code: {stat} >>> libconeangle.cone_angle([[0.0, 0.0, -0.52], [0.0, 0.0, 1.76], [0.0, 0.0, 2.86]], [2.1, 1.7, 1.52], 3) Atoms within vdW radius of metal atom. Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/awvwgk/projects/src/git/mctc-tools/libconeangle/libconeangle/coneangle.py", line 54, in cone_angle raise ValueError("libconeangle exited with non-zero exit code: {stat}") ValueError: libconeangle exited with non-zero exit code: {stat} >>> libconeangle.cone_angle([[0.0, 0.0, -0.52], [0.0, 0.0, 1.76], [0.0, 0.0, 2.86]], [2.1, 1.7, 1.52], -1) Atoms within vdW radius of metal atom. free(): invalid pointer zsh: IOT instruction (core dumped) python
Also, the indexing should preferably be C-compatible, i.e. starting from 0.
Out of bound indexing is not handled gracefully at the moment. Trying some funny things in the session below, which eventually did crash the library:
Also, the indexing should preferably be C-compatible, i.e. starting from 0.