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

Test matgl with LAMMPS #203

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Test matgl with LAMMPS #203

wants to merge 6 commits into from

Conversation

jan-janssen
Copy link
Member

@jan-janssen jan-janssen commented Jan 30, 2024

The latest release of the LAMMPS conda package contains an interface to call matgl via ASE from LAMMPS. The advantage of this interface is that it is possible to use the internal functionality inside LAMMPS, like thermostats and fixes in combination with the modern machine learned interatomic potentials which are currently only supported by ASE.

Still currently it seems this functionality requires writing input files and parsing output files. It is not possible to use this functionality when using LAMMPS with python bindings. An example how to use matgl inside LAMMPS is available in:
https://github.com/matbinder/lammps-matgl

@jan-janssen
Copy link
Member Author

[fv-az1536-984:04043] mca_base_component_repository_open: unable to open mca_btl_openib: librdmacm.so.1: cannot open shared object file: No such file or directory (ignored)
/usr/share/miniconda3/envs/my-env/lib/python3.11/site-packages/pylammpsmpi/wrapper/ase.py:165: UserWarning: Warning: setting upper trangular matrix might slow down the calculation
  warnings.warn(
[fv-az1536-984:04043] *** Process received signal ***
[fv-az1536-984:04043] Signal: Segmentation fault (11)
[fv-az1536-984:04043] Signal code: Address not mapped (1)
[fv-az1536-984:04043] Failing at address: 0x10
[fv-az1536-984:04043] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f0783042520]
[fv-az1536-984:04043] [ 1] python(PyImport_Import+0x31)[0x5575a91c55a1]
[fv-az1536-984:04043] [ 2] python(PyImport_ImportModule+0x18)[0x5575a9242558]
[fv-az1536-984:04043] [ 3] /usr/share/miniconda3/envs/my-env/lib/python3.11/lib-dynload/../../liblammps.so(_ZN9LAMMPS_NS10PairM3GNet16initializePythonEPKci+0x79)[0x7f0743a5a0b9]
[fv-az1536-984:04043] [ 4] /usr/share/miniconda3/envs/my-env/lib/python3.11/lib-dynload/../../liblammps.so(_ZN9LAMMPS_NS10PairM3GNet5coeffEiPPc+0x1b7)[0x7f0743a5b237]
[fv-az1536-984:04043] [ 5] /usr/share/miniconda3/envs/my-env/lib/python3.11/lib-dynload/../../liblammps.so(_ZN9LAMMPS_NS5Input10pair_coeffEv+0x365)[0x7f07431cfdb5]
[fv-az1536-984:04043] [ 6] /usr/share/miniconda3/envs/my-env/lib/python3.11/lib-dynload/../../liblammps.so(_ZN9LAMMPS_NS5Input15execute_commandEv+0xcc4)[0x7f07431d5254]
[fv-az1536-984:04043] [ 7] /usr/share/miniconda3/envs/my-env/lib/python3.11/lib-dynload/../../liblammps.so(_ZN9LAMMPS_NS5Input3oneERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x97)[0x7f07431d5dc7]
[fv-az1536-984:04043] [ 8] /usr/share/miniconda3/envs/my-env/lib/python3.11/lib-dynload/../../liblammps.so(lammps_command+0x90)[0x7f0743223390]
[fv-az1536-984:04043] [ 9] /usr/share/miniconda3/envs/my-env/lib/python3.11/lib-dynload/../../libffi.so.8(+0x6a4a)[0x7f0782fb6a4a]
[fv-az1536-984:04043] [10] /usr/share/miniconda3/envs/my-env/lib/python3.11/lib-dynload/../../libffi.so.8(+0x5fea)[0x7f0782fb5fea]
[fv-az1536-984:04043] [11] /usr/share/miniconda3/envs/my-env/lib/python3.11/lib-dynload/_ctypes.cpython-311-x86_64-linux-gnu.so(+0x12555)[0x7f0764bb9555]
[fv-az1536-984:04043] [12] /usr/share/miniconda3/envs/my-env/lib/python3.11/lib-dynload/_ctypes.cpython-311-x86_64-linux-gnu.so(+0x8802)[0x7f0764baf802]
[fv-az1536-984:04043] [13] python(_PyObject_MakeTpCall+0x253)[0x5575a9161f53]
[fv-az1536-984:04043] [14] python(_PyEval_EvalFrameDefault+0x716)[0x5575a916fa36]
[fv-az1536-984:04043] [15] python(_PyFunction_Vectorcall+0x181)[0x5575a9193031]
[fv-az1536-984:04043] [16] python(PyObject_Call+0x130)[0x5575a919cd30]
[fv-az1536-984:04043] [17] python(_PyEval_EvalFrameDefault+0x47fc)[0x5575a9173b1c]
[fv-az1536-984:04043] [18] python(_PyFunction_Vectorcall+0x181)[0x5575a9193031]
[fv-az1536-984:04043] [19] python(PyObject_Call+0x130)[0x5575a919cd30]
[fv-az1536-984:04043] [20] python(_PyEval_EvalFrameDefault+0x47fc)[0x5575a9173b1c]
[fv-az1536-984:04043] [21] python(_PyFunction_Vectorcall+0x181)[0x5575a9193031]
[fv-az1536-984:04043] [22] python(PyObject_Call+0x130)[0x5575a919cd30]
[fv-az1536-984:04043] [23] python(_PyEval_EvalFrameDefault+0x47fc)[0x5575a9173b1c]
[fv-az1536-984:04043] [24] python(+0x22f6d2)[0x5575a91b16d2]
[fv-az1536-984:04043] [25] python(_PyEval_EvalFrameDefault+0x47fc)[0x5575a9173b1c]
[fv-az1536-984:04043] [26] python(_PyFunction_Vectorcall+0x181)[0x5575a9193031]
[fv-az1536-984:04043] [27] python(_PyObject_FastCallDictTstate+0x63)[0x5575a9166a33]
[fv-az1536-984:04043] [28] python(_PyObject_Call_Prepend+0x69)[0x5575a919aa49]
[fv-az1536-984:04043] [29] python(+0x2e9658)[0x5575a926b658]
[fv-az1536-984:04043] *** End of error message ***
/home/runner/work/_temp/345e8e96-17d6-4984-9654-753476e5b880.sh: line 7:  4043 Segmentation fault      (core dumped) python -m unittest tests/test_evcurve_lammps_matgl.py

@jan-janssen
Copy link
Member Author

I did some more local tests and while the matgl interface in LAMMPS seems to work with writing input files and parsing output files, it does not work with interactive LAMMPS calculation. Most likely this is related to the matgl interface calling python from LAMMPS and calling Python from LAMMPS does not seem to work when LAMMPS is already called from Python.

@jan-janssen jan-janssen marked this pull request as draft January 30, 2024 08:32
@samwaseda
Copy link
Member

I did some more local tests and while the matgl interface in LAMMPS seems to work with writing input files and parsing output files, it does not work with interactive LAMMPS calculation. Most likely this is related to the matgl interface calling python from LAMMPS and calling Python from LAMMPS does not seem to work when LAMMPS is already called from Python.

You mean it tries to use the same LAMMPS instance for different calculations? Shouldn't it be detectable from the pyiron side?

@jan-janssen
Copy link
Member Author

You mean it tries to use the same LAMMPS instance for different calculations? Shouldn't it be detectable from the pyiron side?

No, I think it might be an issue how Python is build in conda, which is not compatible to the way how LAMMPS is calling Python. Still that is all just assumptions, what I can show is that it works when I run a LAMMPS input script but when I try to call the same script via the LAMMPS Python bindings then I get a similar error message as I posted it above. So I conclude that the matgl potential in LAMMPS is currently incompatible with calling LAMMPS via the Python bindings.

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

Successfully merging this pull request may close these issues.

2 participants