Add install.py and update config for kim lib

This commit is contained in:
Ryan S. Elliott 2017-06-22 22:33:09 -05:00
parent 4339379948
commit 16fc2d6fe1
3 changed files with 88 additions and 14 deletions

View File

@ -16,7 +16,12 @@
# Settings that the LAMMPS build will import when this package is installed
KIM_CONFIG_HELPER = kim-api-build-config
ifeq ($(wildcard ../../lib/kim/bin/kim-api-build-config),)
KIM_CONFIG_HELPER = kim-api-build-config
else
KIM_CONFIG_HELPER = ../../lib/kim/bin/kim-api-build-config
endif
ifeq ($(shell $(KIM_CONFIG_HELPER) --version 2> /dev/null),)
$(error $(KIM_CONFIG_HELPER) utility is not available. Something is wrong with your KIM API package setup)
endif

View File

@ -9,13 +9,16 @@ KIM API and he also maintains the code that implements the pair_style
kim command.
To download, build, and install the KIM API on your system, follow
these steps. We are working on scripts that will automate this
process.
these steps. You can use the install.py script to automate these steps.
The KIM API is available for download from "this
site"_https://openkim.org, namely https://openkim.org. The tarball
you download is "kim-api-vX.Y.Z.tgz", which can be unpacked in this
directory or whereever you wish:
**Note** The process described below will compile the kim-api using absolute
paths names. This means that if you move your lammps directory to a new
location after compilation the kim-api library will not be able to find some of
its components. It is best to recompile after moving the lammps directory.
The KIM API is available for download from "this site"_https://openkim.org,
namely https://openkim.org. The tarball you download is "kim-api-vX.Y.Z.tgz",
which can be unpacked in this directory or whereever you wish:
tar xvfz kim*tgz
@ -41,13 +44,7 @@ $ tar zxvf kim-api-vX.Y.Z.tgz
# get OpenKIM models, setup and compile
$ cd kim-api-vX.Y.Z
$ cp Makefile.KIM_Config.example Makefile.KIM_Config
# edit this file as appropriate following the instructions given in
# INSTALL. Here, we'll assume you set the 'prefix' variable as
# follows in order to install the KIM API to your home directory:
# prefix = $(HOME)/local
$ vi Makefile.KIM_Config
$ ./configure --prefix=??????
$ make add-EAM_Dynamo_Angelo_Moody_NiAlH__MO_418978237058_001
$ make

72
lib/kim/install.py Normal file
View File

@ -0,0 +1,72 @@
#!usr/local/python
# install.py tool to setup the kim-api library
# used to automate the steps described in the README file in this dir
import sys,os,re,urllib,commands
help = """
Syntax: install.py -v version
specify one or more options, order does not matter
-v = version of kim-api to download and work with
default = kim-api-v1.8.2 (current as of June 2017)
"""
def error():
print help
sys.exit()
# parse args
args = sys.argv
dir = "."
version = "kim-api-v1.8.2"
iarg = 1
while iarg < len(args):
if args[iarg] == "-v":
if iarg+2 > len(args): error()
version = args[iarg+1]
iarg += 2
else: error()
dir = os.path.abspath(dir)
url = "https://s3.openkim.org/kim-api/%s.tgz" % version
# download and unpack tarball
print "Downloading kim-api tarball ..."
urllib.urlretrieve(url,"%s/%s.tgz" % (dir,version))
print "Unpacking kim-api tarball ..."
cmd = "cd %s; rm -rf %s; tar zxvf %s.tgz" % (dir,version,version)
txt = commands.getstatusoutput(cmd)
if txt[0] != 0: error()
# configure kim-api
print "Configuring kim-api ..."
cmd = "cd %s/%s; ./configure --prefix='%s'" % (dir,version,dir)
txt = commands.getstatusoutput(cmd)
print txt[1]
if txt[0] != 0: error()
# build kim-api
print "Building kim-api ..."
cmd = "cd %s/%s; make" % (dir,version)
txt = commands.getstatusoutput(cmd)
print txt[1]
if txt[0] != 0: error()
# install kim-api
print "Installing kim-api ..."
cmd = "cd %s/%s; make install" % (dir,version)
txt = commands.getstatusoutput(cmd)
print txt[1]
if txt[0] != 0: error()
cmd = "cd %s/%s; make install-set-default-to-v1" %(dir,version)
txt = commands.getstatusoutput(cmd)
print txt[1]
if txt[0] != 0: error()