diff --git a/lib/Install.py b/lib/Install.py index 416a2319c640de962640b1f7be307098608294c0..d30cbffcf140ef3f8b0edfdfe902a78b819d39b3 100644 --- a/lib/Install.py +++ b/lib/Install.py @@ -23,8 +23,9 @@ specify -m and optionally -e, order does not matter Examples: -make lib-poems args="-m g++" # build COLVARS lib with GNU g++ compiler -make lib-meam args="-m ifort" # build MEAM lib with Intel ifort compiler +make lib-poems args="-m serial" # build POEMS lib with same settings as in the serial Makefile in src +make lib-colvars args="-m mpi" # build USER-COLVARS lib with same settings as in the mpi Makefile in src +make lib-meam args="-m ifort" # build MEAM lib with custom Makefile.ifort (using Intel Fortran) """ # print error message or help diff --git a/lib/kim/Install.py b/lib/kim/Install.py index f7ddcfda967ae0f7ae0b95fd5efd928e8416c8ba..06479d2d4dd9480f0de8685f6b1535e61d240e0e 100644 --- a/lib/kim/Install.py +++ b/lib/kim/Install.py @@ -1,44 +1,41 @@ #!/usr/bin/env python -# install.py tool to setup the kim-api library +# install.py tool to download, compile, and setup the kim-api library # used to automate the steps described in the README file in this dir + from __future__ import print_function import sys,os,re,subprocess -# transparently use either urllib or an external tool -try: - import ssl - try: from urllib.request import urlretrieve as geturl - except: from urllib import urlretrieve as geturl -except: - def geturl(url,fname): - cmd = 'curl -L -o "%s" %s' % (fname,url) - txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) - return txt - help = """ -Syntax from src dir: make lib-kim args="-v version -a kim-name" -Syntax from lib dir: python Install.py -v version -a kim-name +Syntax from src dir: make lib-kim args="-b -v version -a kim-name" + or: make lib-kim args="-b -a everything" + or: make lib-kim args="-n -a kim-name" + or: make lib-kim args="-p /usr/local/open-kim -a kim-name" +Syntax from lib dir: python Install.py -b -v version -a kim-name + or: python Install.py -b -a everything + or: python Install.py -n -a kim-name + or: python Install.py -p /usr/local/open-kim -a kim-name specify one or more options, order does not matter -v = version of KIM API library to use default = kim-api-v1.8.2 (current as of June 2017) - -b = download and build base KIM API library with example Models (default) + -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. Use an existing installation + -n = do NOT download and build base KIM API library. + Use an existing installation -p = specify location of KIM API installation (implies -n) -a = add single KIM model or model driver with kim-name to existing KIM API lib (see example below). If kim-name = everything, then rebuild KIM API library with - all available OpenKIM Models (this implies -b). + *all* available OpenKIM Models (make take a long time). -vv = be more verbose about what is happening while the script runs Examples: -make lib-kim # install KIM API lib with only example models +make lib-kim args="-b" # install KIM API lib with only example models make lib-kim args="-a Glue_Ercolessi_Adams_Al__MO_324507536345_001" # Ditto plus one model -make lib-kim args="-a everything" # install KIM API lib with all models +make lib-kim args="-b -a everything" # install KIM API lib with all models make lib-kim args="-n -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # only add one model or model driver See the list of KIM model drivers here: @@ -52,8 +49,9 @@ https://openkim.org/kim-api in the "What is in the KIM API source package?" section """ -def error(): - print(help) +def error(str=None): + if not str: print(help) + else: print("ERROR",str) sys.exit() # expand to full path name @@ -62,15 +60,21 @@ def error(): def fullpath(path): return os.path.abspath(os.path.expanduser(path)) +def geturl(url,fname): + cmd = 'curl -L -o "%s" %s' % (fname,url) + txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + return txt + # parse args args = sys.argv[1:] nargs = len(args) +if nargs == 0: error() thisdir = os.environ['PWD'] version = "kim-api-v1.8.2" -buildflag = True +buildflag = False everythingflag = False addflag = False verboseflag = False diff --git a/lib/mscg/Install.py b/lib/mscg/Install.py index 70d2eda241660b55e5e65cb0ebba5a571ac29268..e4e5ec5613c2b2f0c290df097b24dea8d257c11c 100644 --- a/lib/mscg/Install.py +++ b/lib/mscg/Install.py @@ -6,32 +6,26 @@ from __future__ import print_function import sys,os,re,subprocess -try: - import ssl - try: from urllib.request import urlretrieve as geturl - except: from urllib import urlretrieve as geturl -except: - def geturl(url,fname): - cmd = 'curl -L -o "%s" %s' % (fname,url) - txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) - return txt - # help message help = """ Syntax from src dir: make lib-mscg args="-p [path] -m [suffix]" + or: make lib-mscg args="-b -m [suffix]" Syntax from lib dir: python Install.py -p [path] -m [suffix] +Syntax from lib dir: python Install.py -b -m [suffix] specify one or more options, order does not matter - -b = download and build MS-CG library (default) + -b = download and build MS-CG library -p = specify folder of existing MS-CG installation -m = machine suffix specifies which src/Make/Makefile.suffix to use default suffix = g++_simple Example: -make lib-mscg args="-b " # download/build in lib/mscg/MSCG-release-master +make lib-mscg args="-b -m serial " # download/build in lib/mscg/MSCG-release-master with settings compatible with "make serial" +make lib-mscg args="-b -m mpi " # download/build in lib/mscg/MSCG-release-master with settings compatible with "make mpi" +make lib-mscg args="-p /usr/local/mscg-release " # use existing MS-CG installation in /usr/local/mscg-release """ # settings @@ -53,15 +47,21 @@ def error(str=None): def fullpath(path): return os.path.abspath(os.path.expanduser(path)) +def geturl(url,fname): + cmd = 'curl -L -o "%s" %s' % (fname,url) + txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + return txt + # parse args args = sys.argv[1:] nargs = len(args) +if nargs == 0: error() homepath = "." homedir = tardir -buildflag = True +buildflag = False pathflag = False linkflag = True msuffix = "g++_simple" @@ -72,7 +72,6 @@ while iarg < nargs: if iarg+2 > nargs: error() mscgpath = fullpath(args[iarg+1]) pathflag = True - buildflag = False iarg += 2 elif args[iarg] == "-m": if iarg+2 > nargs: error() @@ -93,6 +92,9 @@ if (pathflag): if (buildflag and pathflag): error("Cannot use -b and -p flag at the same time") +if (not buildflag and not pathflag): + error("Have to use either -b or -p flag") + # download and unpack MS-CG tarfile if buildflag: diff --git a/lib/smd/Install.py b/lib/smd/Install.py index fe0283563969b928b308974bf09cd766732206fe..1c270bea5e8e824f3671044dfcef64666c38ebb1 100644 --- a/lib/smd/Install.py +++ b/lib/smd/Install.py @@ -5,22 +5,20 @@ from __future__ import print_function import sys,os,re,glob,subprocess -try: from urllib.request import urlretrieve as geturl -except: from urllib import urlretrieve as geturl # help message help = """ -Syntax from src dir: make lib-smd +Syntax from src dir: make lib-smd args="-b" or: make lib-smd args="-p /usr/include/eigen3" -Syntax from lib dir: python Install.py +Syntax from lib dir: python Install.py -b or: python Install.py -p /usr/include/eigen3" or: python Install.py -v 3.3.4 -b specify one or more options, order does not matter - -b = download and unpack/configure the Eigen library (default) + -b = download and unpack/configure the Eigen library -p = specify folder holding an existing installation of Eigen -v = set version of Eigen library to download and set up (default = 3.3.4) @@ -28,6 +26,7 @@ specify one or more options, order does not matter Example: make lib-smd args="-b" # download/build in default lib/smd/eigen-eigen-* +make lib-smd args="-p /usr/include/eigen3" # use existing Eigen installation in /usr/include/eigen3 """ # settings @@ -48,16 +47,21 @@ def error(str=None): def fullpath(path): return os.path.abspath(os.path.expanduser(path)) +def geturl(url,fname): + cmd = 'curl -L -o "%s" %s' % (fname,url) + txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + return txt + # parse args args = sys.argv[1:] nargs = len(args) +if nargs == 0: error() homepath = "." homedir = "eigen3" -grabflag = True -buildflag = True +buildflag = False pathflag = False linkflag = True @@ -71,7 +75,6 @@ while iarg < nargs: if iarg+2 > nargs: error() eigenpath = fullpath(args[iarg+1]) pathflag = True - buildflag = False iarg += 2 elif args[iarg] == "-b": buildflag = True @@ -86,6 +89,9 @@ if (pathflag): if (buildflag and pathflag): error("Cannot use -b and -p flag at the same time") +if (not buildflag and not pathflag): + error("Have to use either -b or -p flag") + # download and unpack Eigen tarball # use glob to find name of dir it unpacks to diff --git a/lib/voronoi/Install.py b/lib/voronoi/Install.py index 6db0495a37f048ab94dff1d04d5eb2551bb46912..5a246bbeb18a9b340d187b6b87495511bf8169a2 100644 --- a/lib/voronoi/Install.py +++ b/lib/voronoi/Install.py @@ -6,35 +6,26 @@ from __future__ import print_function import sys,os,re,subprocess -try: - import ssl - try: from urllib.request import urlretrieve as geturl - except: from urllib import urlretrieve as geturl -except: - def geturl(url,fname): - cmd = 'curl -L -o "%s" %s' % (fname,url) - txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) - return txt - # help message help = """ -Syntax from src dir: make lib-voronoi +Syntax from src dir: make lib-voronoi args="-b" or: make lib-voronoi args="-p /usr/local/voro++-0.4.6" - or: make lib-voronoi args="-v voro++-0.4.6 -b" -Syntax from lib dir: python Install.py -v voro++-0.4.6 -b - or: python Install.py + or: make lib-voronoi args="-b -v voro++-0.4.6" +Syntax from lib dir: python Install.py -b -v voro++-0.4.6 + or: python Install.py -b or: python Install.py -p /usr/local/voro++-0.4.6 specify one or more options, order does not matter - -b = download and build the Voro++ library (default) - -p = specify folder of existing Voro++ installation + -b = download and build the Voro++ library + -p = specify folder of existing Voro++ installation -v = set version of Voro++ to download and build (default voro++-0.4.6) Example: make lib-voronoi args="-b" # download/build in lib/voronoi/voro++-0.4.6 +make lib-voronoi args="-p $HOME/voro++-0.4.6" # use existing Voro++ installation in $HOME/voro++-0.4.6 """ # settings @@ -55,15 +46,21 @@ def error(str=None): def fullpath(path): return os.path.abspath(os.path.expanduser(path)) +def geturl(url,fname): + cmd = 'curl -L -o "%s" %s' % (fname,url) + txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + return txt + # parse args args = sys.argv[1:] nargs = len(args) +if nargs == 0: error() homepath = "." homedir = version -buildflag = True +buildflag = False pathflag = False linkflag = True @@ -77,7 +74,6 @@ while iarg < nargs: if iarg+2 > nargs: error() voropath = fullpath(args[iarg+1]) pathflag = True - buildflag = False iarg += 2 elif args[iarg] == "-b": buildflag = True @@ -94,6 +90,9 @@ if (pathflag): if (buildflag and pathflag): error("Cannot use -b and -p flag at the same time") +if (not buildflag and not pathflag): + error("Have to use either -b or -p flag") + # download and unpack Voro++ tarball if buildflag: