lammps/lib/python2cf83d9fca6emaster
README
The Makefile.lammps file in this directory is used when building LAMMPS with its PYTHON package installed. The file has several settings needed to compile and link LAMMPS with the Python library.
The default Makefile.lammps will automatically choose the default python interpreter of your system and will infer the flags from the python-config utility, that is usually bundled with the python installation. If needed, you can copy one of the other provided Makefile.lammps.* files to to Makefile.lammps before building LAMMPS itself.
The files Makefile.lammps.python2 and Makefile.lammps.python3 are similar to the default file, but meant for the case that both, python 2 and python 3, are installed simultaneously and you want to prefer one over the other. If neither of these files work, you may have to create a custom Makefile.lammps file suitable for the version of Python on your system. To illustrate, these are example settings from the Makefile.lammps.python2.7 file:
python_SYSINC = -I/usr/local/include/python2.7 python_SYSLIB = -lpython2.7 -lnsl -ldl -lreadline -ltermcap -lpthread -lutil -lm python_SYSPATH = PYTHON=python2.7
python_SYSINC refers to the directory where Python's Python.h file is found. LAMMPS includes this file.
python_SYSLIB refers to the libraries needed to link to from an application (LAMMPS in this case) to "embed" Python in the application. The Python library itself is listed (-lpython2.7) are are several system libraries needed by Python.
python_SYSPATH refers to the path (e.g. -L/usr/local/lib) where the Python library can be found. You may not need this setting if the path is already included in your LD_LIBRARY_PATH environment variable.
PYTHON is the name of the python interpreter. It is used for installing the LAMMPS python module with "make install-python"
Note that the trickiest issue to figure out for inclusion in Makefile.lammps is what system libraries are needed by your Python to run in embedded mode on your machine.
Here is what this Python doc page says about it:
https://docs.python.org/2/extending/embedding.html#compiling-and-linking-under-unix-like-systems
"It is not necessarily trivial to find the right flags to pass to your compiler (and linker) in order to embed the Python interpreter into your application, particularly because Python needs to load library modules implemented as C dynamic extensions (.so files) linked against it.
To find out the required compiler and linker flags, you can execute the pythonX.Y-config script which is generated as part of the installation process (a python-config script may also be available)."
It then gives examples of how to use the pythonX.Y-config script and further instructions for what to do if that doesn't work.