import patch from joe jordan to find the lammps DSO automatically

This commit is contained in:
Axel Kohlmeyer
2012-04-27 10:37:04 -04:00
parent 209fb57577
commit 959946a023

View File

@ -15,6 +15,7 @@
import types import types
from ctypes import * from ctypes import *
import os.path
LMPINT = 0 LMPINT = 0
LMPDOUBLE = 1 LMPDOUBLE = 1
@ -22,6 +23,8 @@ LMPIPTR = 2
LMPDPTR = 3 LMPDPTR = 3
LMPDPTRPTR = 4 LMPDPTRPTR = 4
LOCATION = os.path.dirname(__file__)
class lammps: class lammps:
def __init__(self,args=None): def __init__(self,args=None):
@ -29,10 +32,10 @@ class lammps:
# could provide caller a flag to choose which library to load # could provide caller a flag to choose which library to load
try: try:
self.lib = CDLL("_lammps.so") self.lib = CDLL(os.path.join(LOCATION, "_lammps.so"))
except: except:
try: try:
self.lib = CDLL("_lammps_serial.so") self.lib = CDLL(os.path.join(LOCATION, "_lammps_serial.so"))
except: except:
raise OSError,"Could not load LAMMPS dynamic library" raise OSError,"Could not load LAMMPS dynamic library"