Skip to content
Snippets Groups Projects
Unverified Commit 1b965d4d authored by Steve Plimpton's avatar Steve Plimpton Committed by GitHub
Browse files

Merge pull request #863 from ellio167/kim-update

KIM API interface update
parents 8e3ba36a dee945c0
No related branches found
No related tags found
No related merge requests found
...@@ -290,7 +290,21 @@ if(ENABLE_USER-VTK) ...@@ -290,7 +290,21 @@ if(ENABLE_USER-VTK)
endif() endif()
if(ENABLE_KIM) if(ENABLE_KIM)
find_package(KIM REQUIRED) find_package(KIM QUIET)
if(NOT KIM_FOUND)
message(STATUS "KIM not found - we will build our own")
include(ExternalProject)
ExternalProject_Add(kim_build
URL https://github.com/openkim/kim-api/archive/v1.9.4.tar.gz
URL_MD5 f4d35a1705eed46d64c7c0ab448ff3e0
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
)
ExternalProject_get_property(kim_build INSTALL_DIR)
set(KIM_INCLUDE_DIRS ${INSTALL_DIR}/include/kim-api-v1)
set(KIM_LIBRARIES ${INSTALL_DIR}/lib/libkim-api-v1.so)
list(APPEND LAMMPS_DEPS kim_build)
endif()
list(APPEND LAMMPS_LINK_LIBS ${KIM_LIBRARIES}) list(APPEND LAMMPS_LINK_LIBS ${KIM_LIBRARIES})
include_directories(${KIM_INCLUDE_DIRS}) include_directories(${KIM_INCLUDE_DIRS})
endif() endif()
......
...@@ -21,7 +21,7 @@ Syntax from lib dir: python Install.py -b -v version -a kim-name ...@@ -21,7 +21,7 @@ Syntax from lib dir: python Install.py -b -v version -a kim-name
specify one or more options, order does not matter specify one or more options, order does not matter
-v = version of KIM API library to use -v = version of KIM API library to use
default = kim-api-v1.9.2 (current as of Oct 2017) default = kim-api-v1.9.4 (current as of Apr 2018)
-b = download and build base KIM API library with example Models -b = download and build base KIM API library with example Models
this will delete any previous installation in the current folder this will delete any previous installation in the current folder
-n = do NOT download and build base KIM API library. -n = do NOT download and build base KIM API library.
...@@ -109,7 +109,7 @@ nargs = len(args) ...@@ -109,7 +109,7 @@ nargs = len(args)
if nargs == 0: error() if nargs == 0: error()
thisdir = os.environ['PWD'] thisdir = os.environ['PWD']
version = "kim-api-v1.9.2" version = "kim-api-v1.9.4"
buildflag = False buildflag = False
everythingflag = False everythingflag = False
...@@ -166,9 +166,6 @@ if pathflag: ...@@ -166,9 +166,6 @@ if pathflag:
mkfile.write("print_dir:\n") mkfile.write("print_dir:\n")
mkfile.write(" @printf $(KIM_INSTALL_DIR)\n") mkfile.write(" @printf $(KIM_INSTALL_DIR)\n")
with open("%s/Makefile.KIM_Config" % thisdir, 'w') as cfgfile:
cfgfile.write("include %s/lib/kim-api/Makefile.KIM_Config" % kimdir)
print("Created %s/Makefile.KIM_DIR\n using %s" % (thisdir,kimdir)) print("Created %s/Makefile.KIM_DIR\n using %s" % (thisdir,kimdir))
else: else:
kimdir = os.path.join(os.path.abspath(thisdir), "installed-" + version) kimdir = os.path.join(os.path.abspath(thisdir), "installed-" + version)
...@@ -191,9 +188,6 @@ if buildflag: ...@@ -191,9 +188,6 @@ if buildflag:
mkfile.write("print_dir:\n") mkfile.write("print_dir:\n")
mkfile.write(" @printf $(KIM_INSTALL_DIR)\n") mkfile.write(" @printf $(KIM_INSTALL_DIR)\n")
with open("%s/Makefile.KIM_Config" % thisdir, 'w') as cfgfile:
cfgfile.write("include %s/lib/kim-api/Makefile.KIM_Config" % kimdir)
print("Created %s/Makefile.KIM_DIR\n using %s" % (thisdir,kimdir)) print("Created %s/Makefile.KIM_DIR\n using %s" % (thisdir,kimdir))
# download entire kim-api tarball # download entire kim-api tarball
...@@ -247,11 +241,16 @@ if buildflag: ...@@ -247,11 +241,16 @@ if buildflag:
# add single OpenKIM model # add single OpenKIM model
if addflag: if addflag:
makefile_path = os.path.join(thisdir, "Makefile.KIM_DIR")
if os.path.isfile(makefile_path):
cmd = 'make --no-print-directory -f %s print_dir' % makefile_path
kimdir = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
if not os.path.isdir(kimdir): if not os.path.isdir(kimdir):
print("\nkim-api is not installed") print("\nkim-api is not installed")
error() error()
# download single model # download single model
cmd = '%s/bin/kim-api-v1-collections-management install system %s' % (kimdir, addmodelname) cmd = '%s/bin/kim-api-v1-collections-management install system %s' % (kimdir.decode("UTF-8"), addmodelname)
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
if verboseflag: print (txt.decode("UTF-8")) if verboseflag: print (txt.decode("UTF-8"))
...@@ -20,47 +20,35 @@ Instructions: ...@@ -20,47 +20,35 @@ Instructions:
1. Configure lammps for use with the kim-api library installed in this directory 1. Configure lammps for use with the kim-api library installed in this directory
$ printf "KIM_INSTALL_DIR=${PWD}\n" > ./Makefile.KIM_DIR # replace X.Y.Z as appropriate here and below
$ printf "include ${PWD}/lib/kim-api/Makefile.KIM_Config\n" > ./Makefile.KIM_Config $ printf "KIM_INSTALL_DIR=${PWD}/installed-kim-api-vX.Y.Z\n" > ./Makefile.KIM_DIR
2. Download and unpack the kim-api 2. Download and unpack the kim-api
# replace X.Y.Z as appropriate here and below $ wget http://s3.openkim.org/kim-api/kim-api-vX.Y.Z.txz
$ wget http://s3.openkim.org/kim-api/kim-api-vX.Y.Z.tgz $ tar zxvf kim-api-vX.Y.Z.txz
$ tar zxvf kim-api-vX.Y.Z.tgz
# configure the kim-api # configure the kim-api
$ cd kim-api-vX.Y.Z $ cd kim-api-vX.Y.Z
$ ./configure --prefix=${PWD}/../ $ ./configure --prefix=${PWD}/../installed-kim-api-vX.Y.Z
# setup the desired kim item
$ make add-Pair_Johnson_Fe__MO_857282754307_002
3. Build and install the kim-api and model 3. Build and install the kim-api and model
$ make $ make
$ make install $ make install
$ cd ..
# replace X with the KIM API major version number
$ make install-set-default-to-vX
$ cd ../
4. Remove source and build files 4. Remove source and build files
$ rm -rf kim-api-vX.Y.Z $ rm -rf kim-api-vX.Y.Z
$ rm -rf kim-api-vX.Y.Z.tgz $ rm -rf kim-api-vX.Y.Z.txz
5. To add additional items do the following (replace the kim item name with your 5. To add items do the following (replace the kim item name with your
desired value) desired value)
$ wget https://openkim.org/download/EAM_Johnson_NearestNeighbor_Cu__MO_887933271505_001.tgz $ source ${PWD}/kim-api-vX.Y.Z/bin/kim-api-v1-activate
$ tar zxvf EAM_Johnson_NearestNeighbor_Cu__MO_887933271505_001.tgz $ kim-api-v1-collections-management install system Pair_Johnson_Fe__MO_857282754307_002
$ cd EAM_Johnson_NearestNeighbor_Cu__MO_887933271505_001
$ make
$ make install
$ cd ..
$ rm -rf EAM_Johnson_NearestNeighbor_Cu__MO_887933271505_001
$ rm -rf EAM_Johnson_NearestNeighbor_Cu__MO_887933271505_001.tgz
----------------- -----------------
...@@ -73,4 +61,4 @@ $ make g++ (or whatever target you wish) ...@@ -73,4 +61,4 @@ $ make g++ (or whatever target you wish)
Note that the Makefile.lammps and Makefile.KIM_DIR files in this directory Note that the Makefile.lammps and Makefile.KIM_DIR files in this directory
are required to allow the LAMMPS build to find the necessary KIM files. are required to allow the LAMMPS build to find the necessary KIM files.
You should not normally need to edit this file. You should not normally need to edit these files.
This package (pair-kim-v1.7.2+1) created from commit
ced1275c5fd5b382cb9bd39e44ed1324c7c85e99
of the pair-kim git repository
By Ryan S. Elliott (relliott@umn.edu) on Mon Feb 22 14:59:53 CST 2016.
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
// includes from LAMMPS // includes from LAMMPS
#include "pair_kim.h" #include "pair_kim.h"
#include "pair_kim_version.h"
#include "atom.h" #include "atom.h"
#include "comm.h" #include "comm.h"
#include "force.h" #include "force.h"
...@@ -1094,18 +1093,6 @@ void PairKIM::write_descriptor(char** test_descriptor_string) ...@@ -1094,18 +1093,6 @@ void PairKIM::write_descriptor(char** test_descriptor_string)
"#\n" "#\n"
"# This file is automatically generated from LAMMPS pair_style " "# This file is automatically generated from LAMMPS pair_style "
"kim command\n"); "kim command\n");
char tmp_version[100];
sprintf(tmp_version,"# This is pair-kim-v%i.%i.%i",
PAIR_KIM_VERSION_MAJOR, PAIR_KIM_VERSION_MINOR,
PAIR_KIM_VERSION_PATCH);
strcat(*test_descriptor_string, tmp_version);
#ifdef PAIR_KIM_VERSION_PRERELEASE
sprintf(tmp_version,"-%s", PAIR_KIM_VERSION_PRERELEASE);
strcat(*test_descriptor_string, tmp_version);
#endif
#ifdef PAIR_KIM_VERSION_BUILD_METADATA
sprintf(tmp_version,"+%s", PAIR_KIM_VERSION_BUILD_METADATA);
#endif
strcat(*test_descriptor_string, strcat(*test_descriptor_string,
"\n" "\n"
"# The call number is (pair_style).(init_style): "); "# The call number is (pair_style).(init_style): ");
......
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing authors: Ryan S. Elliott,
------------------------------------------------------------------------- */
#ifndef LMP_PAIR_KIM_VERSION_H
#define LMP_PAIR_KIM_VERSION_H
//
// Release: This file is part of the pair-kim-v1.7.2+1 package.
//
//
// This file defines the version information for the pair-kim package.
// The values specified here must conform to the Semantic Versioning
// 2.0.0 specification.
//
// Generally the version numbering for the pair-kim package will
// parallel the numbering for the kim-api package. However, if
// additional versioning increments are required for the pair-kim
// package, the build-metatdata field will be used to provide a
// "sub-patch" version number.
//
// The PATCH value should be incremented IMMEDIATELY after an official
// release.
//
// The MINOR value should be incremented AND the PATCH value reset to
// zero as soon as it becomes clear that the next official release
// MUST increment the MINOR version value.
//
// The MAJOR value should be incremented AND the MINOR and PATCH
// vaules reset to zero as soon as it becomes clear that the next
// official release MUST increment the MAJOR version value.
//
// The PRERELEASE value can be set to any value allowed by the
// Semantic Versioning specification. However, it will generally be
// empty. This value should be quoted as a string constant.
//
// The BUILD_METADATA value can be set to any value allowed by the
// Semantic Versioning specification. However, it will generally be
// emtpy; Except for when "sub-patch" versioning of the pair-kim
// package is necessary. This value should be quoted as a string
// constant.
//
#define PAIR_KIM_VERSION_MAJOR 1
#define PAIR_KIM_VERSION_MINOR 7
#define PAIR_KIM_VERSION_PATCH 2
//#define PAIR_KIM_VERSION_PRERELEASE
#define PAIR_KIM_VERSION_BUILD_METADATA "1"
#endif /* PAIR_KIM_VERSION_H */
...@@ -16,6 +16,8 @@ style_region.h ...@@ -16,6 +16,8 @@ style_region.h
style_neigh_bin.h style_neigh_bin.h
style_neigh_pair.h style_neigh_pair.h
style_neigh_stencil.h style_neigh_stencil.h
# deleted on 4 April 2018
pair_kim_version.h
# deleted on 15 December 2017 # deleted on 15 December 2017
fix_python.cpp fix_python.cpp
fix_python.h fix_python.h
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment