diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 3a7e5dace641642186364f9ddf01c3295c0d4db2..31f2723c0c085862e3e6b01bbea2f61b288f4a16 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -290,7 +290,21 @@ if(ENABLE_USER-VTK) endif() 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}) include_directories(${KIM_INCLUDE_DIRS}) endif() diff --git a/lib/kim/Install.py b/lib/kim/Install.py index 0e873889546d198398f22d3fc2df37d0bc3fec06..3f1d9fb19141e67be56a1fdeb898ce6853aba2f2 100644 --- a/lib/kim/Install.py +++ b/lib/kim/Install.py @@ -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 -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 this will delete any previous installation in the current folder -n = do NOT download and build base KIM API library. @@ -109,7 +109,7 @@ nargs = len(args) if nargs == 0: error() thisdir = os.environ['PWD'] -version = "kim-api-v1.9.2" +version = "kim-api-v1.9.4" buildflag = False everythingflag = False @@ -166,9 +166,6 @@ if pathflag: mkfile.write("print_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)) else: kimdir = os.path.join(os.path.abspath(thisdir), "installed-" + version) @@ -191,9 +188,6 @@ if buildflag: mkfile.write("print_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)) # download entire kim-api tarball @@ -247,11 +241,16 @@ if buildflag: # add single OpenKIM model 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): print("\nkim-api is not installed") error() # 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) if verboseflag: print (txt.decode("UTF-8")) diff --git a/lib/kim/README b/lib/kim/README index 7a4230dc25e99a282b5ba9b8e439d0b0250da058..ce4ea1bdff42e55ad70b9101bdbea5b48ace61a6 100644 --- a/lib/kim/README +++ b/lib/kim/README @@ -20,47 +20,35 @@ Instructions: 1. Configure lammps for use with the kim-api library installed in this directory -$ printf "KIM_INSTALL_DIR=${PWD}\n" > ./Makefile.KIM_DIR -$ printf "include ${PWD}/lib/kim-api/Makefile.KIM_Config\n" > ./Makefile.KIM_Config +# replace X.Y.Z as appropriate here and below +$ printf "KIM_INSTALL_DIR=${PWD}/installed-kim-api-vX.Y.Z\n" > ./Makefile.KIM_DIR 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.tgz -$ tar zxvf kim-api-vX.Y.Z.tgz +$ wget http://s3.openkim.org/kim-api/kim-api-vX.Y.Z.txz +$ tar zxvf kim-api-vX.Y.Z.txz # configure the kim-api $ cd kim-api-vX.Y.Z -$ ./configure --prefix=${PWD}/../ - -# setup the desired kim item -$ make add-Pair_Johnson_Fe__MO_857282754307_002 +$ ./configure --prefix=${PWD}/../installed-kim-api-vX.Y.Z 3. Build and install the kim-api and model $ make $ make install - -# replace X with the KIM API major version number -$ make install-set-default-to-vX -$ cd ../ +$ cd .. 4. Remove source and build files $ 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) -$ wget https://openkim.org/download/EAM_Johnson_NearestNeighbor_Cu__MO_887933271505_001.tgz -$ tar zxvf EAM_Johnson_NearestNeighbor_Cu__MO_887933271505_001.tgz -$ 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 +$ source ${PWD}/kim-api-vX.Y.Z/bin/kim-api-v1-activate +$ kim-api-v1-collections-management install system Pair_Johnson_Fe__MO_857282754307_002 + ----------------- @@ -73,4 +61,4 @@ $ make g++ (or whatever target you wish) 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. -You should not normally need to edit this file. +You should not normally need to edit these files. diff --git a/lib/kim/pair-kim.release.info b/lib/kim/pair-kim.release.info deleted file mode 100644 index f6c3c01c4e5ea5a1b61f0fc1e6900e391df57a66..0000000000000000000000000000000000000000 --- a/lib/kim/pair-kim.release.info +++ /dev/null @@ -1,6 +0,0 @@ -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. diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index b35e90511f64bfa954f16ddd1de84a02f6df1c16..46e843158abe6649ba751b7480bba01e4ba94ebe 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -27,7 +27,6 @@ // includes from LAMMPS #include "pair_kim.h" -#include "pair_kim_version.h" #include "atom.h" #include "comm.h" #include "force.h" @@ -1094,18 +1093,6 @@ void PairKIM::write_descriptor(char** test_descriptor_string) "#\n" "# This file is automatically generated from LAMMPS pair_style " "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, "\n" "# The call number is (pair_style).(init_style): "); diff --git a/src/KIM/pair_kim_version.h b/src/KIM/pair_kim_version.h deleted file mode 100644 index a92f9dd9261b3afa7757e4ea54c88338a3f3bab3..0000000000000000000000000000000000000000 --- a/src/KIM/pair_kim_version.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- 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 */ diff --git a/src/Purge.list b/src/Purge.list index d4a824b36c1317d477ec0813847f92cb4dfa3cff..2e854ead3d577e4d6cb1a968e814f1cbdb954e65 100644 --- a/src/Purge.list +++ b/src/Purge.list @@ -16,6 +16,8 @@ style_region.h style_neigh_bin.h style_neigh_pair.h style_neigh_stencil.h +# deleted on 4 April 2018 +pair_kim_version.h # deleted on 15 December 2017 fix_python.cpp fix_python.h