setting up python interface with cmake

I want to call lammps from python.

I compiled lammps using Cmake this way, from the lammps dir:

mkdir build_serial
cd build_serial
cmake -D PKG_MANYBODY=on -D PKG_OPT=on -D BUILD_LIB=on -D BUILD_SHARED_LIBS=on -D LAMMPS_MACHINE=serial -D BUILD_MPI=off -D BUILD_OMP=off …/cmake
make

Compiled without error.
But I don’t find the liblammps.so file which I expected. Here is the listing of the build directory:

CMakeCache.txt FindLAMMPS.cmake cmake_install.cmake liblammps.0.dylib liblammps.pc lmp_serial
CMakeFiles Makefile etc liblammps.dylib libmpi_stubs.a styles

which has the executable but not the .so file I expected.

Please advise.

…Murray Daw

it has the liblammps.0.dylib file, which is what is the name for (proper) shared libraries on MacOSX (at least on more recent versions).

with the changes to the LAMMPS python module in the latest patch, it should try loading this file instead of an .so file when present.

axel.

FYI, i just logged into a MacOSX machine (almost forgot i had an account on it) and did:

git clone https://github.com/lammps/lammps.git -b unstable lammps
cd lammps/src/
make yes-manybody
make -j4 mode=shlib serial
make install-python

and it works just fine as a python module without messing around with environment variables:

src akohlmey$ cd
~ akohlmey$ python
Python 2.7.10 (default, Aug 17 2018, 17:41:52)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

from lammps import lammps
l=lammps()
LAMMPS (28 Feb 2019)

l.command(“info config”)

Info-Info-Info-Info-Info-Info-Info-Info-Info-Info-Info
Printed on Thu Mar 21 16:48:57 2019

LAMMPS version: 28 Feb 2019 / 20190228

OS information: Darwin 18.2.0 on x86_64

sizeof(smallint): 32-bit
sizeof(imageint): 32-bit
sizeof(tagint): 32-bit
sizeof(bigint): 64-bit

Compiler: Clang C++ 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5) with OpenMP not enabled

Active compile time flags:

-DLAMMPS_GZIP
-DLAMMPS_SMALLBIG

Installed packages:

MANYBODY

Info-Info-Info-Info-Info-Info-Info-Info-Info-Info-Info

^D
Total wall time: 0:00:30