pyiron / pylammpsmpi

Parallel Lammps Python interface - control a mpi4py parallel LAMMPS instance from a serial python process or a Jupyter notebook
https://pylammpsmpi.readthedocs.io
BSD 3-Clause "New" or "Revised" License
30 stars 4 forks source link

[Feature] Communication of lammps errors #28

Open srmnitc opened 4 years ago

srmnitc commented 4 years ago

@jan-janssen If lammps throws an error due to a wrong command or so, it is not communicated back to the main process. Is there a good way to do this?

jan-janssen commented 4 years ago

I guess the easiest way is to write the progress log file - or we could try to read the error out of the popen, but my feeling was that the Lammps library simply crashes, without reporting any details, once the Library crashes it also kills the connected python process, but this might be different with MPI.

srmnitc commented 4 years ago

If logging is enabled, lammps writes the crash reason to the log file, so this is not too difficult to debug. Maybe we should not spend time on this, but rather give a warning somewhere to write to log or use the log file of lammps.

jan-janssen commented 1 year ago

This can be fixed by compiling LAMMPS with https://docs.lammps.org/Build_settings.html#exception-handling-when-using-lammps-as-a-library and then use a try/except statement. At least this works for the C++ interface, so I hope it also works for the Python interface.