Merge branch 'lammps:develop' into mliappy_unified
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
# Pizza.py toolkit, www.cs.sandia.gov/~sjplimp/pizza.html
|
||||
# Pizza.py toolkit, https://lammps.github.io/pizza
|
||||
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
|
||||
#
|
||||
# Copyright (2005) Sandia Corporation. Under the terms of Contract
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Pizza.py toolkit, www.cs.sandia.gov/~sjplimp/pizza.html
|
||||
# Pizza.py toolkit, https://lammps.github.io/pizza
|
||||
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
|
||||
#
|
||||
# Copyright (2005) Sandia Corporation. Under the terms of Contract
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Pizza.py toolkit, www.cs.sandia.gov/~sjplimp/pizza.html
|
||||
# Pizza.py toolkit, https://lammps.github.io/pizza
|
||||
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
|
||||
#
|
||||
# Copyright (2005) Sandia Corporation. Under the terms of Contract
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Pizza.py toolkit, www.cs.sandia.gov/~sjplimp/pizza.html
|
||||
# Pizza.py toolkit, https://lammps.github.io/pizza
|
||||
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
|
||||
#
|
||||
# Copyright (2005) Sandia Corporation. Under the terms of Contract
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Pizza.py toolkit, www.cs.sandia.gov/~sjplimp/pizza.html
|
||||
# Pizza.py toolkit, https://lammps.github.io/pizza
|
||||
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
|
||||
#
|
||||
# Copyright (2005) Sandia Corporation. Under the terms of Contract
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Pizza.py toolkit, www.cs.sandia.gov/~sjplimp/pizza.html
|
||||
# Pizza.py toolkit, https://lammps.github.io/pizza
|
||||
# Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
|
||||
#
|
||||
# Copyright (2005) Sandia Corporation. Under the terms of Contract
|
||||
|
||||
@ -4,17 +4,29 @@
|
||||
# try to improperly start up a new interpreter.
|
||||
import sysconfig
|
||||
import ctypes
|
||||
library = sysconfig.get_config_vars('INSTSONAME')[0]
|
||||
import platform
|
||||
|
||||
py_ver = sysconfig.get_config_vars('VERSION')[0]
|
||||
OS_name = platform.system()
|
||||
|
||||
if OS_name == "Linux":
|
||||
SHLIB_SUFFIX = '.so'
|
||||
library = 'libpython' + py_ver + SHLIB_SUFFIX
|
||||
elif OS_name == "Darwin":
|
||||
SHLIB_SUFFIX = '.dylib'
|
||||
library = 'libpython' + py_ver + SHLIB_SUFFIX
|
||||
elif OS_name == "Windows":
|
||||
SHLIB_SUFFIX = '.dll'
|
||||
library = 'python' + py_ver + SHLIB_SUFFIX
|
||||
|
||||
try:
|
||||
pylib = ctypes.CDLL(library)
|
||||
except OSError as e:
|
||||
if pylib.endswith(".a"):
|
||||
pylib.strip(".a") + ".so"
|
||||
pylib = ctypes.CDLL(library)
|
||||
else:
|
||||
raise e
|
||||
except Exception as e:
|
||||
raise OSError("Unable to locate python shared library") from e
|
||||
|
||||
if not pylib.Py_IsInitialized():
|
||||
raise RuntimeError("This interpreter is not compatible with python-based mliap for LAMMPS.")
|
||||
|
||||
del sysconfig, ctypes, library, pylib
|
||||
|
||||
from .loader import load_model, activate_mliappy
|
||||
|
||||
Reference in New Issue
Block a user