From c63d258cc0b5cb7c9f92f1445096c35a7e8149bd Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 17 Mar 2015 16:06:12 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13239 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- lib/README | 2 ++ lib/python/Makefile.lammps | 6 ++++ lib/python/Makefile.lammps.python2.7 | 6 ++++ lib/python/Makefile.lammps.python3.4 | 6 ++++ lib/python/README | 54 ++++++++++++++++++++++++++++ 5 files changed, 74 insertions(+) create mode 100644 lib/python/Makefile.lammps create mode 100644 lib/python/Makefile.lammps.python2.7 create mode 100644 lib/python/Makefile.lammps.python3.4 create mode 100644 lib/python/README diff --git a/lib/README b/lib/README index 291929b115..6a720cb3da 100644 --- a/lib/README +++ b/lib/README @@ -37,6 +37,8 @@ meam modified embedded atom method (MEAM) potential, MEAM package from Greg Wagner (Sandia) molfile hooks to VMD molfile plugins, used by the USER-MOLFILE package from Axel Kohlmeyer (Temple U) and the VMD development team +python hooks to the system Python library, used by the PYTHON package + from the LAMMPS development team qmmm quantum mechanics/molecular mechanics coupling interface from Axel Kohlmeyer (Temple U) quip interface to QUIP/libAtoms framework, USER-QUIP package diff --git a/lib/python/Makefile.lammps b/lib/python/Makefile.lammps new file mode 100644 index 0000000000..897e631a5d --- /dev/null +++ b/lib/python/Makefile.lammps @@ -0,0 +1,6 @@ +# Settings that the LAMMPS build will import when this package library is used +# See the README file for more explanation + +python_SYSINC = -I/usr/local/include/python2.7 +python_SYSLIB = -lpython2.7 -lnsl -ldl -lreadline -ltermcap -lpthread -lutil -lm +python_SYSPATH = diff --git a/lib/python/Makefile.lammps.python2.7 b/lib/python/Makefile.lammps.python2.7 new file mode 100644 index 0000000000..897e631a5d --- /dev/null +++ b/lib/python/Makefile.lammps.python2.7 @@ -0,0 +1,6 @@ +# Settings that the LAMMPS build will import when this package library is used +# See the README file for more explanation + +python_SYSINC = -I/usr/local/include/python2.7 +python_SYSLIB = -lpython2.7 -lnsl -ldl -lreadline -ltermcap -lpthread -lutil -lm +python_SYSPATH = diff --git a/lib/python/Makefile.lammps.python3.4 b/lib/python/Makefile.lammps.python3.4 new file mode 100644 index 0000000000..897e631a5d --- /dev/null +++ b/lib/python/Makefile.lammps.python3.4 @@ -0,0 +1,6 @@ +# Settings that the LAMMPS build will import when this package library is used +# See the README file for more explanation + +python_SYSINC = -I/usr/local/include/python2.7 +python_SYSLIB = -lpython2.7 -lnsl -ldl -lreadline -ltermcap -lpthread -lutil -lm +python_SYSPATH = diff --git a/lib/python/README b/lib/python/README new file mode 100644 index 0000000000..077c2547d2 --- /dev/null +++ b/lib/python/README @@ -0,0 +1,54 @@ +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. +You should choose a Makefile.lammps.* file compatible with your system +and your version of Python, and copy it to Makefile.lammps before +building LAMMPS itself. You may need to edit one of the provided +files to match your system. + +If you create a new Makefile.lammps file suitable for some version of +Python on some system, that is not a match to one of the provided +Makefile.lammps.* files, you can send it to the developers, and we can +include it in the distribution for others to use. + +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_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. + +------------------------- + +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.