diff --git a/lib/colvars/Install.py b/lib/colvars/Install.py index 01e70543f22dd9575821fbaf289521838ecd54ba..030644ceb52bb8672767423fb43030d56bc4045a 100644 --- a/lib/colvars/Install.py +++ b/lib/colvars/Install.py @@ -45,12 +45,12 @@ while iarg < nargs: if args[iarg] == "-m": if iarg+2 > len(args): error() machine = args[iarg+1] - iarg += 2 + iarg += 2 elif args[iarg] == "-e": if iarg+2 > len(args): error() extraflag = True suffix = args[iarg+1] - iarg += 2 + iarg += 2 else: error() # set lib from working dir diff --git a/lib/gpu/Install.py b/lib/gpu/Install.py index 657f1c8fcc7b0be48db185f318a67f65e1d12635..6ea2159de5821b5765f9731812d0862eef143707 100644 --- a/lib/gpu/Install.py +++ b/lib/gpu/Install.py @@ -14,7 +14,7 @@ Syntax from lib dir: python Install.py -m machine -h hdir -a arch -p precision - specify one or more options, order does not matter -copies an existing Makefile.machine in lib/gpu to Makefile.auto +copies an existing Makefile.machine in lib/gpu to Makefile.auto optionally edits these variables in Makefile.auto: CUDA_HOME, CUDA_ARCH, CUDA_PRECISION, EXTRAMAKE optionally uses Makefile.auto to build the GPU library -> libgpu.a @@ -26,7 +26,7 @@ optionally copies Makefile.auto to a new Makefile.osuffix -h = set CUDA_HOME variable in Makefile.auto to hdir hdir = path to NVIDIA Cuda software, e.g. /usr/local/cuda -a = set CUDA_ARCH variable in Makefile.auto to arch - use arch = 20 for Tesla C2050/C2070 (Fermi) (deprecated as of CUDA 8.0) + use arch = 20 for Tesla C2050/C2070 (Fermi) (deprecated as of CUDA 8.0) or GeForce GTX 580 or similar use arch = 30 for Tesla K10 (Kepler) use arch = 35 for Tesla K40 (Kepler) or GeForce GTX Titan or similar @@ -108,10 +108,10 @@ if pflag: elif precision == "mixed": precstr = "-D_SINGLE_DOUBLE" elif precision == "single": precstr = "-D_SINGLE_SINGLE" else: error("Invalid precision setting") - + # create Makefile.auto # reset EXTRAMAKE, CUDA_HOME, CUDA_ARCH, CUDA_PRECISION if requested - + if not os.path.exists("Makefile.%s" % isuffix): error("lib/gpu/Makefile.%s does not exist" % isuffix) diff --git a/lib/kim/Install.py b/lib/kim/Install.py index 21ea859852904a00c8f2a5cc825f84adf0cdb8fd..aa244ee6eabd0f1296c1f39fd74639aab9f021dc 100644 --- a/lib/kim/Install.py +++ b/lib/kim/Install.py @@ -6,6 +6,8 @@ from __future__ import print_function import sys,os,re,subprocess +# help message + help = """ Syntax from src dir: make lib-kim args="-b -v version -a kim-name" or: make lib-kim args="-b -a everything" @@ -23,7 +25,7 @@ specify one or more options, order does not matter -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 + 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). @@ -78,13 +80,27 @@ def which(program): return None def geturl(url,fname): + success = False + if which('curl') != None: cmd = 'curl -L -o "%s" %s' % (fname,url) - elif which('wget') != None: + try: + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + success = True + except subprocess.CalledProcessError as e: + print("Calling curl failed with: %s" % e.output.decode('UTF-8')) + + if not success and which('wget') != None: cmd = 'wget -O "%s" %s' % (fname,url) - else: error("cannot find 'wget' or 'curl' to download source code") - txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) - return txt + try: + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + success = True + except subprocess.CalledProcessError as e: + print("Calling wget failed with: %s" % e.output.decode('UTF-8')) + + if not success: + error("Failed to download source code with 'curl' or 'wget'") + return # parse args diff --git a/lib/mscg/Install.py b/lib/mscg/Install.py index 154f5aa5220e0a67c603f9edc56bdb44411681e8..76c986ef6d5f2409c448f7eeaec92d1e06d759b3 100644 --- a/lib/mscg/Install.py +++ b/lib/mscg/Install.py @@ -65,13 +65,27 @@ def which(program): return None def geturl(url,fname): + success = False + if which('curl') != None: cmd = 'curl -L -o "%s" %s' % (fname,url) - elif which('wget') != None: + try: + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + success = True + except subprocess.CalledProcessError as e: + print("Calling curl failed with: %s" % e.output.decode('UTF-8')) + + if not success and which('wget') != None: cmd = 'wget -O "%s" %s' % (fname,url) - else: error("cannot find 'wget' or 'curl' to download source code") - txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) - return txt + try: + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + success = True + except subprocess.CalledProcessError as e: + print("Calling wget failed with: %s" % e.output.decode('UTF-8')) + + if not success: + error("Failed to download source code with 'curl' or 'wget'") + return # parse args diff --git a/lib/smd/Install.py b/lib/smd/Install.py index 00891339d0806d319fbbacb2602eff12dba329b0..9247cb449b762b7435377d9fabef2eca4c7326d3 100644 --- a/lib/smd/Install.py +++ b/lib/smd/Install.py @@ -65,13 +65,27 @@ def which(program): return None def geturl(url,fname): + success = False + if which('curl') != None: cmd = 'curl -L -o "%s" %s' % (fname,url) - elif which('wget') != None: + try: + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + success = True + except subprocess.CalledProcessError as e: + print("Calling curl failed with: %s" % e.output.decode('UTF-8')) + + if not success and which('wget') != None: cmd = 'wget -O "%s" %s' % (fname,url) - else: error("cannot find 'wget' or 'curl' to download source code") - txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) - return txt + try: + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + success = True + except subprocess.CalledProcessError as e: + print("Calling wget failed with: %s" % e.output.decode('UTF-8')) + + if not success: + error("Failed to download source code with 'curl' or 'wget'") + return # parse args diff --git a/lib/voronoi/Install.py b/lib/voronoi/Install.py index 4998358d27af55447ecf880d960d180d9fdc8fac..f40eb53bc67a0ff650bfe45635ba61879bd78231 100644 --- a/lib/voronoi/Install.py +++ b/lib/voronoi/Install.py @@ -64,13 +64,27 @@ def which(program): return None def geturl(url,fname): + success = False + if which('curl') != None: cmd = 'curl -L -o "%s" %s' % (fname,url) - elif which('wget') != None: + try: + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + success = True + except subprocess.CalledProcessError as e: + print("Calling curl failed with: %s" % e.output.decode('UTF-8')) + + if not success and which('wget') != None: cmd = 'wget -O "%s" %s' % (fname,url) - else: error("cannot find 'wget' or 'curl' to download source code") - txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) - return txt + try: + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + success = True + except subprocess.CalledProcessError as e: + print("Calling wget failed with: %s" % e.output.decode('UTF-8')) + + if not success: + error("Failed to download source code with 'curl' or 'wget'") + return # parse args diff --git a/src/Makefile b/src/Makefile index 7dfc2c312aafe24337c7645e9e399eed2d05f0c9..3b67d2284fb8b968a513280d7a93fd3c9a6ecae1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -339,17 +339,18 @@ no-%: fi; # download/build/install a package library +# update the timestamp on main.cpp to trigger a relink with "make machine" lib-%: @if [ -e ../lib/$(LIBDIR)/Install.py ]; then \ echo "Installing lib $(@:lib-%=%)"; \ - cd ../lib/$(LIBDIR); $(PYTHON) Install.py $(args); \ + ( cd ../lib/$(LIBDIR); $(PYTHON) Install.py $(args) ); \ elif [ -e ../lib/$(LIBUSERDIR)/Install.py ]; then \ echo "Installing lib $(@:lib-user-%=%)"; \ - cd ../lib/$(LIBUSERDIR); $(PYTHON) Install.py $(args); \ + ( cd ../lib/$(LIBUSERDIR); $(PYTHON) Install.py $(args) ); \ else \ echo "Install script for lib $(@:lib-%=%) does not exist"; \ - fi; + fi; touch main.cpp # status = list src files that differ from package files # update = replace src files with newer package files diff --git a/src/pair.cpp b/src/pair.cpp index ce711c4f5ded8f7f768b02979f5bff99b4e20825..05319e33f2c7925d803e862f6323e8e1d4229242 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -75,7 +75,7 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp) ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag = dipoleflag = 0; reinitflag = 1; - // pair_modify settingsx + // pair_modify settings compute_flag = 1; manybody_flag = 0; diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index fa79f1cf970d3876b1fb71a7ecf39e8f3ffb316a..31360d13ff131f7c874d1164e74d61dc59031ef8 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -36,7 +36,7 @@ PairHybrid::PairHybrid(LAMMPS *lmp) : Pair(lmp), map(NULL), special_lj(NULL), special_coul(NULL), compute_tally(NULL) { nstyles = 0; - + outerflag = 0; respaflag = 0; @@ -490,7 +490,7 @@ void PairHybrid::init_style() if (((force->special_lj[i] == 0.0) || (force->special_lj[i] == 1.0)) && (force->special_lj[i] != special_lj[istyle][i])) error->all(FLERR,"Pair_modify special setting for pair hybrid " - "incompatible with global special_bonds setting"); + "incompatible with global special_bonds setting"); } } @@ -500,7 +500,7 @@ void PairHybrid::init_style() || (force->special_coul[i] == 1.0)) && (force->special_coul[i] != special_coul[istyle][i])) error->all(FLERR,"Pair_modify special setting for pair hybrid " - "incompatible with global special_bonds setting"); + "incompatible with global special_bonds setting"); } } } @@ -832,6 +832,12 @@ void PairHybrid::modify_params(int narg, char **arg) Pair::modify_params(narg,arg); for (int m = 0; m < nstyles; m++) styles[m]->modify_params(narg,arg); } + + // reset global compute_flag since there may have been changes + // to any of the substyles + compute_flag = 0; + for (int m = 0; m < nstyles; m++) + if (styles[m]->compute_flag) compute_flag = 1; } /* ----------------------------------------------------------------------