diff --git a/lib/kim/Install.py b/lib/kim/Install.py index 315bb4e11..f7ddcfda9 100644 --- a/lib/kim/Install.py +++ b/lib/kim/Install.py @@ -1,276 +1,276 @@ #!/usr/bin/env python # install.py tool to 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 -o %s %s" % (fname,url) + 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 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) this will delete any previous installation in the current folder -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). -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="-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="-n -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # only add one model or model driver See the list of KIM model drivers here: https://openkim.org/kim-items/model-drivers/alphabetical See the list of all KIM models here: https://openkim.org/kim-items/models/by-model-drivers See the list of example KIM models included by default here: https://openkim.org/kim-api in the "What is in the KIM API source package?" section """ def error(): print(help) sys.exit() # expand to full path name # process leading '~' or relative path def fullpath(path): return os.path.abspath(os.path.expanduser(path)) # parse args args = sys.argv[1:] nargs = len(args) thisdir = os.environ['PWD'] version = "kim-api-v1.8.2" buildflag = True everythingflag = False addflag = False verboseflag = False pathflag = False iarg = 0 while iarg < len(args): if args[iarg] == "-v": if iarg+2 > len(args): error() version = args[iarg+1] iarg += 2 elif args[iarg] == "-b": buildflag = True iarg += 1 elif args[iarg] == "-n": buildflag = False iarg += 1 elif args[iarg] == "-p": if iarg+2 > len(args): error() kimdir = fullpath(args[iarg+1]) pathflag = True buildflag = False iarg += 2 elif args[iarg] == "-a": addflag = True if iarg+2 > len(args): error() addmodelname = args[iarg+1] if addmodelname == "everything": buildflag = True everythingflag = True addflag = False iarg += 2 elif args[iarg] == "-vv": verboseflag = True iarg += 1 else: error() thisdir = os.path.abspath(thisdir) url = "https://s3.openkim.org/kim-api/%s.tgz" % version # set KIM API directory if pathflag: if not os.path.isdir(kimdir): print("\nkim-api is not installed at %s" % kimdir) error() # configure LAMMPS to use existing kim-api installation with open("%s/Makefile.KIM_DIR" % thisdir, 'w') as mkfile: mkfile.write("KIM_INSTALL_DIR=%s\n\n" % kimdir) mkfile.write(".DUMMY: print_dir\n\n") 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) # download KIM tarball, unpack, build KIM if buildflag: # check to see if an installed kim-api already exists and wipe it out. if os.path.isdir(kimdir): print("kim-api is already installed at %s.\nRemoving it for re-install" % kimdir) - cmd = "rm -rf %s" % kimdir + cmd = 'rm -rf "%s"' % kimdir subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) # configure LAMMPS to use kim-api to be installed with open("%s/Makefile.KIM_DIR" % thisdir, 'w') as mkfile: mkfile.write("KIM_INSTALL_DIR=%s\n\n" % kimdir) mkfile.write(".DUMMY: print_dir\n\n") 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 print("Downloading kim-api tarball ...") geturl(url,"%s/%s.tgz" % (thisdir,version)) print("Unpacking kim-api tarball ...") - cmd = "cd %s; rm -rf %s; tar zxvf %s.tgz" % (thisdir,version,version) + cmd = 'cd "%s"; rm -rf "%s"; tar -xzvf %s.tgz' % (thisdir,version,version) subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) # configure kim-api print("Configuring kim-api ...") - cmd = "cd %s/%s; ./configure --prefix='%s'" % (thisdir,version,kimdir) + cmd = 'cd "%s/%s"; ./configure --prefix="%s"' % (thisdir,version,kimdir) subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) # build kim-api print("Configuring example Models") - cmd = "cd %s/%s; make add-examples" % (thisdir,version) + cmd = 'cd "%s/%s"; make add-examples' % (thisdir,version) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) if verboseflag: print (txt.decode("UTF-8")) if everythingflag: print("Configuring all OpenKIM models, this will take a while ...") - cmd = "cd %s/%s; make add-OpenKIM" % (thisdir,version) + cmd = 'cd "%s/%s"; make add-OpenKIM' % (thisdir,version) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) if verboseflag: print(txt.decode("UTF-8")) print("Building kim-api ...") - cmd = "cd %s/%s; make" % (thisdir,version) + cmd = 'cd "%s/%s"; make' % (thisdir,version) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) if verboseflag: print(txt.decode("UTF-8")) # install kim-api print("Installing kim-api ...") - cmd = "cd %s/%s; make install" % (thisdir,version) + cmd = 'cd "%s/%s"; make install' % (thisdir,version) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) if verboseflag: print(txt.decode("UTF-8")) - cmd = "cd %s/%s; make install-set-default-to-v1" %(thisdir,version) + cmd = 'cd "%s/%s"; make install-set-default-to-v1' %(thisdir,version) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) if verboseflag: print(txt.decode("UTF-8")) # remove source files print("Removing kim-api source and build files ...") - cmd = "cd %s; rm -rf %s; rm -rf %s.tgz" % (thisdir,version,version) + cmd = 'cd "%s"; rm -rf %s; rm -rf %s.tgz' % (thisdir,version,version) subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) # add a single model (and possibly its driver) to existing KIM installation if addflag: if not os.path.isdir(kimdir): print("\nkim-api is not installed") error() # download single model print("Downloading tarball for %s..." % addmodelname) url = "https://openkim.org/download/%s.tgz" % addmodelname geturl(url,"%s/%s.tgz" % (thisdir,addmodelname)) print("Unpacking item tarball ...") - cmd = "cd %s; tar zxvf %s.tgz" % (thisdir,addmodelname) + cmd = 'cd "%s"; tar -xzvf %s.tgz' % (thisdir,addmodelname) subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) print("Building item ...") - cmd = "cd %s/%s; make; make install" %(thisdir,addmodelname) + cmd = 'cd "%s/%s"; make; make install' %(thisdir,addmodelname) try: txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) except subprocess.CalledProcessError as e: # Error: but first, check to see if it needs a driver firstRunOutput = e.output.decode("UTF-8") - cmd = "cd %s/%s; make kim-item-type" % (thisdir,addmodelname) + cmd = 'cd "%s/%s"; make kim-item-type' % (thisdir,addmodelname) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) txt = txt.decode("UTF-8") if txt == "ParameterizedModel": # Get and install driver - cmd = "cd %s/%s; make model-driver-name" % (thisdir,addmodelname) + cmd = 'cd "%s/%s"; make model-driver-name' % (thisdir,addmodelname) txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) adddrivername = txt.decode("UTF-8").strip() print("First installing model driver: %s..." % adddrivername) - cmd = "cd %s; python Install.py -n -a %s" % (thisdir,adddrivername) + cmd = 'cd "%s"; python Install.py -n -a %s' % (thisdir,adddrivername) try: txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) except subprocess.CalledProcessError as e: print(e.output) sys.exit() if verboseflag: print(txt.decode("UTF-8")) # now install the model that needed the driver print("Now installing model : %s" % addmodelname) - cmd = "cd %s; python Install.py -n -a %s" % (thisdir,addmodelname) + cmd = 'cd "%s"; python Install.py -n -a %s' % (thisdir,addmodelname) try: txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) except subprocess.CalledProcessError as e: print(e.output) sys.exit() print(txt.decode("UTF-8")) sys.exit() else: print(firstRunOutput) print("Error, unable to build and install OpenKIM item: %s" \ % addmodelname) sys.exit() # success the first time if verboseflag: print(txt.decode("UTF-8")) print("Removing kim item source and build files ...") - cmd = "cd %s; rm -rf %s; rm -rf %s.tgz" %(thisdir,addmodelname,addmodelname) + cmd = 'cd "%s"; rm -rf %s; rm -rf %s.tgz' %(thisdir,addmodelname,addmodelname) subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) diff --git a/lib/mscg/.gitignore b/lib/mscg/.gitignore new file mode 100644 index 000000000..7d45bcb60 --- /dev/null +++ b/lib/mscg/.gitignore @@ -0,0 +1,4 @@ +# files to ignore +/liblink +/includelink +/MSCG-release-master diff --git a/lib/mscg/Install.py b/lib/mscg/Install.py index 7b10be189..db86b0a7a 100644 --- a/lib/mscg/Install.py +++ b/lib/mscg/Install.py @@ -1,129 +1,135 @@ #!/usr/bin/env python # Install.py tool to download, unpack, build, and link to the MS-CG library # used to automate the steps described in the README file in this dir -import sys,os,re,commands +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="-h hpath hdir -g -b [suffix] -l" -Syntax from lib dir: python Install.py -h hpath hdir -g -b [suffix] -l +Syntax from src dir: make lib-mscg args="-p [path] -m [suffix]" +Syntax from lib dir: python Install.py -p [path] -m [suffix] specify one or more options, order does not matter - -h = set home dir of MS-CG to be hpath/hdir - hpath can be full path, contain '~' or '.' chars - default hpath = . = lib/mscg - default hdir = MSCG-release-master = what GitHub zipfile unpacks to - -g = grab (download) zipfile from MS-CG GitHub website - unpack it to hpath/hdir - hpath must already exist - if hdir already exists, it will be deleted before unpack - -b = build MS-CG library in its src dir - optional suffix specifies which src/Make/Makefile.suffix to use + -b = download and build MS-CG library (default) + -p = specify folder of existing MS-CG installation + -m = machine suffix specifies which src/Make/Makefile.suffix to use default suffix = g++_simple - -l = create 2 softlinks (includelink,liblink) in lib/mscg to MS-CG src dir Example: -make lib-mscg args="-g -b -l" # download/build in lib/mscg/MSCG-release-master +make lib-mscg args="-b " # download/build in lib/mscg/MSCG-release-master """ # settings -url = "https://github.com/uchicago-voth/MSCG-release/archive/master.zip" -zipfile = "MS-CG-master.zip" -zipdir = "MSCG-release-master" +url = "http://github.com/uchicago-voth/MSCG-release/archive/master.tar.gz" +tarfile = "MS-CG-master.tar.gz" +tardir = "MSCG-release-master" # print error message or help def error(str=None): - if not str: print help - else: print "ERROR",str + if not str: print(help) + else: print("ERROR",str) sys.exit() # expand to full path name # process leading '~' or relative path - + def fullpath(path): return os.path.abspath(os.path.expanduser(path)) - + # parse args args = sys.argv[1:] nargs = len(args) -if nargs == 0: error() homepath = "." -homedir = zipdir +homedir = tardir -grabflag = 0 -buildflag = 0 +buildflag = True +pathflag = False +linkflag = True msuffix = "g++_simple" -linkflag = 0 iarg = 0 while iarg < nargs: - if args[iarg] == "-h": - if iarg+3 > nargs: error() - homepath = args[iarg+1] - homedir = args[iarg+2] - iarg += 3 - elif args[iarg] == "-g": - grabflag = 1 - iarg += 1 + if args[iarg] == "-p": + 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() + msuffix = args[iarg+1] + iarg += 2 elif args[iarg] == "-b": - buildflag = 1 - if iarg+1 < nargs and args[iarg+1][0] != '-': - msuffix = args[iarg+1] - iarg += 1 - iarg += 1 - elif args[iarg] == "-l": - linkflag = 1 + buildflag = True iarg += 1 else: error() homepath = fullpath(homepath) -if not os.path.isdir(homepath): error("MS-CG path does not exist") homedir = "%s/%s" % (homepath,homedir) -# download and unpack MS-CG zipfile +if (pathflag): + if not os.path.isdir(mscgpath): error("MS-CG path does not exist") + homedir = mscgpath + +if (buildflag and pathflag): + error("Cannot use -b and -p flag at the same time") -if grabflag: - print "Downloading MS-CG ..." - cmd = "curl -L %s > %s/%s" % (url,homepath,zipfile) - print cmd - print commands.getoutput(cmd) +# download and unpack MS-CG tarfile - print "Unpacking MS-CG zipfile ..." - if os.path.exists("%s/%s" % (homepath,zipdir)): - commands.getoutput("rm -rf %s/%s" % (homepath,zipdir)) - cmd = "cd %s; unzip %s" % (homepath,zipfile) - commands.getoutput(cmd) - if os.path.basename(homedir) != zipdir: - if os.path.exists(homedir): commands.getoutput("rm -rf %s" % homedir) - os.rename("%s/%s" % (homepath,zipdir),homedir) +if buildflag: + print("Downloading MS-CG ...") + geturl(url,"%s/%s" % (homepath,tarfile)) + + print("Unpacking MS-CG tarfile ...") + if os.path.exists("%s/%s" % (homepath,tardir)): + cmd = 'rm -rf "%s/%s"' % (homepath,tardir) + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + cmd = 'cd "%s"; tar -xzvf %s' % (homepath,tarfile) + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + os.remove("%s/%s" % (homepath,tarfile)) + if os.path.basename(homedir) != tardir: + if os.path.exists(homedir): + cmd = 'rm -rf "%s"' % homedir + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + os.rename("%s/%s" % (homepath,tardir),homedir) # build MS-CG if buildflag: - print "Building MS-CG ..." - cmd = "cd %s/src; cp Make/Makefile.%s .; make -f Makefile.%s" % \ + print("Building MS-CG ...") + cmd = 'cd "%s/src"; cp Make/Makefile.%s .; make -f Makefile.%s' % \ (homedir,msuffix,msuffix) - txt = commands.getoutput(cmd) - print txt + txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + print(txt.decode('UTF-8')) # create 2 links in lib/mscg to MS-CG src dir if linkflag: - print "Creating links to MS-CG include and lib files" + print("Creating links to MS-CG include and lib files") if os.path.isfile("includelink") or os.path.islink("includelink"): os.remove("includelink") if os.path.isfile("liblink") or os.path.islink("liblink"): os.remove("liblink") - cmd = "ln -s %s/src includelink" % homedir - commands.getoutput(cmd) - cmd = "ln -s %s/src liblink" % homedir - commands.getoutput(cmd) + cmd = 'ln -s "%s/src" includelink' % homedir + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + cmd = 'ln -s "%s/src" liblink' % homedir + subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) diff --git a/lib/poems/Makefile.g++ b/lib/poems/Makefile.g++ index 54c897a22..afcbc4a01 100644 --- a/lib/poems/Makefile.g++ +++ b/lib/poems/Makefile.g++ @@ -1,101 +1,101 @@ # * # *_________________________________________________________________________* # * POEMS: PARALLELIZABLE OPEN SOURCE EFFICIENT MULTIBODY SOFTWARE * # * DESCRIPTION: SEE READ-ME * # * FILE NAME: Makefile * # * AUTHORS: See Author List * # * GRANTS: See Grants List * # * COPYRIGHT: (C) 2005 by Authors as listed in Author's List * # * LICENSE: Please see License Agreement * # * DOWNLOAD: Free at www.rpi.edu/~anderk5 * # * ADMINISTRATOR: Prof. Kurt Anderson * # * Computational Dynamics Lab * # * Rensselaer Polytechnic Institute * # * 110 8th St. Troy NY 12180 * # * CONTACT: anderk5@rpi.edu * # *_________________________________________________________________________*/ SHELL = /bin/sh # which file will be copied to Makefile.lammps EXTRAMAKE = Makefile.lammps.empty # ------ FILES ------ SRC_MAIN = workspace.cpp system.cpp poemsobject.cpp INC_MAIN = workspace.h system.h poemsobject.h SRC_BODY = body.cpp rigidbody.cpp particle.cpp inertialframe.cpp INC_BODY = bodies.h body.h rigidbody.h particle.h inertialframe.h SRC_JOINT = joint.cpp revolutejoint.cpp prismaticjoint.cpp sphericaljoint.cpp \ freebodyjoint.cpp body23joint.cpp mixedjoint.cpp INC_JOINT = joints.h joint.h revolutejoint.h prismaticjoint.h sphericaljoint.h \ freebodyjoint.h body23joint.h mixedjoint.h SRC_POINT = point.cpp fixedpoint.cpp INC_POINT = points.h point.h fixedpoint.h SRC_SOLVE = solver.cpp INC_SOLVE = solver.h SRC_ORDERN = onsolver.cpp onfunctions.cpp onbody.cpp INC_ORDERN = onsolver.h onfunctions.h onbody.h SRC_MAT = virtualmatrix.cpp matrix.cpp matrixfun.cpp mat3x3.cpp virtualcolmatrix.cpp \ colmatrix.cpp vect3.cpp virtualrowmatrix.cpp rowmatrix.cpp mat6x6.cpp vect6.cpp \ fastmatrixops.cpp colmatmap.cpp eulerparameters.cpp vect4.cpp norm.cpp mat4x4.cpp \ INC_MAT = matrices.h virtualmatrix.h matrix.h matrixfun.h mat3x3.h virtualcolmatrix.h \ colmatrix.h vect3.h virtualrowmatrix.h rowmatrix.h mat6x6.h vect6.h \ fastmatrixops.h colmatmap.h eulerparameters.h vect4.h norm.h mat4x4.h SRC_MISC = poemstreenode.cpp INC_MISC = poemslist.h poemstreenode.h poemstree.h poemsnodelib.h SystemProcessor.h defines.h POEMSChain.h SRC = $(SRC_MAIN) $(SRC_BODY) $(SRC_JOINT) $(SRC_POINT) $(SRC_SOLVE) $(SRC_ORDERN) $(SRC_MAT) $(SRC_MISC) INC = $(INC_MAIN) $(INC_BODY) $(INC_JOINT) $(INC_POINT) $(INC_SOLVE) $(INC_ORDERN) $(INC_MAT) $(INC_MISC) FILES = $(SRC) $(INC) Makefile Authors_List.txt Grants_List.txt POEMS_License.txt README Copyright_Notice # ------ DEFINITIONS ------ LIB = libpoems.a OBJ = $(SRC:.cpp=.o) # ------ SETTINGS ------ CC = g++ -CCFLAGS = -O -g -fPIC -Wall #-Wno-deprecated +CCFLAGS = -O3 -g -fPIC -Wall #-Wno-deprecated ARCHIVE = ar ARCHFLAG = -rc DEPFLAGS = -M LINK = g++ LINKFLAGS = -O USRLIB = SYSLIB = # ------ MAKE PROCEDURE ------ lib: $(OBJ) $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) @cp $(EXTRAMAKE) Makefile.lammps # ------ COMPILE RULES ------ %.o:%.cpp $(CC) $(CCFLAGS) -c $< # ------ DEPENDENCIES ------ include .depend # ------ CLEAN ------ clean: -rm *.o *.d *~ $(LIB) tar: -tar -cvf ../POEMS.tar $(FILES) diff --git a/lib/poems/Makefile.mingw32-cross b/lib/poems/Makefile.mingw32-cross deleted file mode 100644 index 17e81b51f..000000000 --- a/lib/poems/Makefile.mingw32-cross +++ /dev/null @@ -1,110 +0,0 @@ -# * -# *_________________________________________________________________________* -# * POEMS: PARALLELIZABLE OPEN SOURCE EFFICIENT MULTIBODY SOFTWARE * -# * DESCRIPTION: SEE READ-ME * -# * FILE NAME: Makefile * -# * AUTHORS: See Author List * -# * GRANTS: See Grants List * -# * COPYRIGHT: (C) 2005 by Authors as listed in Author's List * -# * LICENSE: Please see License Agreement * -# * DOWNLOAD: Free at www.rpi.edu/~anderk5 * -# * ADMINISTRATOR: Prof. Kurt Anderson * -# * Computational Dynamics Lab * -# * Rensselaer Polytechnic Institute * -# * 110 8th St. Troy NY 12180 * -# * CONTACT: anderk5@rpi.edu * -# *_________________________________________________________________________*/ - -SHELL = /bin/sh - -# which file will be copied to Makefile.lammps - -EXTRAMAKE = Makefile.lammps.empty - -# ------ FILES ------ - -SRC_MAIN = workspace.cpp system.cpp poemsobject.cpp -INC_MAIN = workspace.h system.h poemsobject.h - -SRC_BODY = body.cpp rigidbody.cpp particle.cpp inertialframe.cpp -INC_BODY = bodies.h body.h rigidbody.h particle.h inertialframe.h - - -SRC_JOINT = joint.cpp revolutejoint.cpp prismaticjoint.cpp sphericaljoint.cpp \ - freebodyjoint.cpp body23joint.cpp mixedjoint.cpp -INC_JOINT = joints.h joint.h revolutejoint.h prismaticjoint.h sphericaljoint.h \ - freebodyjoint.h body23joint.h mixedjoint.h - -SRC_POINT = point.cpp fixedpoint.cpp -INC_POINT = points.h point.h fixedpoint.h - -SRC_SOLVE = solver.cpp -INC_SOLVE = solver.h - -SRC_ORDERN = onsolver.cpp onfunctions.cpp onbody.cpp -INC_ORDERN = onsolver.h onfunctions.h onbody.h - -SRC_MAT = virtualmatrix.cpp matrix.cpp matrixfun.cpp mat3x3.cpp virtualcolmatrix.cpp \ - colmatrix.cpp vect3.cpp virtualrowmatrix.cpp rowmatrix.cpp mat6x6.cpp vect6.cpp \ - fastmatrixops.cpp colmatmap.cpp eulerparameters.cpp vect4.cpp norm.cpp mat4x4.cpp \ - -INC_MAT = matrices.h virtualmatrix.h matrix.h matrixfun.h mat3x3.h virtualcolmatrix.h \ - colmatrix.h vect3.h virtualrowmatrix.h rowmatrix.h mat6x6.h vect6.h \ - fastmatrixops.h colmatmap.h eulerparameters.h vect4.h norm.h mat4x4.h - -SRC_MISC = poemstreenode.cpp -INC_MISC = poemslist.h poemstreenode.h poemstree.h poemsnodelib.h SystemProcessor.h defines.h POEMSChain.h - -SRC = $(SRC_MAIN) $(SRC_BODY) $(SRC_JOINT) $(SRC_POINT) $(SRC_SOLVE) $(SRC_ORDERN) $(SRC_MAT) $(SRC_MISC) -INC = $(INC_MAIN) $(INC_BODY) $(INC_JOINT) $(INC_POINT) $(INC_SOLVE) $(INC_ORDERN) $(INC_MAT) $(INC_MISC) - -FILES = $(SRC) $(INC) Makefile Authors_List.txt Grants_List.txt POEMS_License.txt README Copyright_Notice - -# ------ DEFINITIONS ------ - -DIR = Obj_mingw32/ -LIB = $(DIR)libpoems.a -OBJ = $(SRC:%.cpp=$(DIR)%.o) - -# ------ SETTINGS ------ - -CC = i686-w64-mingw32-g++ -CCFLAGS = -O2 -march=i686 -mtune=generic -mfpmath=387 -mpc64 \ - -ffast-math -funroll-loops -finline-functions -fno-rtti \ - -fno-exceptions -fstrict-aliasing \ - -Wall -W -Wno-uninitialized -ARCHIVE = i686-w64-mingw32-ar -ARCHFLAG = -rcs -DEPFLAGS = -M -LINK = i686-w64-mingw32-g++ -LINKFLAGS = -O -USRLIB = -SYSLIB = - -# ------ MAKE PROCEDURE ------ - -default: $(DIR) $(LIB) - -$(DIR): - -mkdir $(DIR) - -$(LIB): $(OBJ) - $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) - @cp $(EXTRAMAKE) Makefile.lammps - -# ------ COMPILE RULES ------ - -$(DIR)%.o:%.cpp - $(CC) $(CCFLAGS) -c $< -o $@ - -# ------ DEPENDENCIES ------ - -include .depend - -# ------ CLEAN ------ - -clean: - -rm $(DIR)*.o $(DIR)*.d *~ $(LIB) - -tar: - -tar -cvf ../POEMS.tar $(FILES) diff --git a/lib/poems/Makefile.mingw32-cross-mpi b/lib/poems/Makefile.mingw32-cross-mpi deleted file mode 100644 index 1e35c5b46..000000000 --- a/lib/poems/Makefile.mingw32-cross-mpi +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- wrapper for non-MPI libraries - -SHELL=/bin/sh - -all: - $(MAKE) $(MFLAGS) mingw32-cross - -rm -f Obj_mingw32-mpi - ln -s Obj_mingw32 Obj_mingw32-mpi - -clean: - $(MAKE) $(MFLAGS) clean-mingw32-cross - -rm -f Obj_mingw32-mpi - diff --git a/lib/poems/Makefile.mingw64-cross-mpi b/lib/poems/Makefile.mingw64-cross-mpi deleted file mode 100644 index ca6f4a6d4..000000000 --- a/lib/poems/Makefile.mingw64-cross-mpi +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- wrapper for non-MPI libraries - -SHELL=/bin/sh - -all: - $(MAKE) $(MFLAGS) mingw64-cross - -rm -f Obj_mingw64-mpi - ln -s Obj_mingw64 Obj_mingw64-mpi - -clean: - $(MAKE) $(MFLAGS) clean-mingw64-cross - -rm -f Obj_mingw64-mpi - diff --git a/lib/poems/Makefile.mingw64-cross b/lib/poems/Makefile.mpi similarity index 86% rename from lib/poems/Makefile.mingw64-cross rename to lib/poems/Makefile.mpi index 2df43dea9..0f0546419 100644 --- a/lib/poems/Makefile.mingw64-cross +++ b/lib/poems/Makefile.mpi @@ -1,110 +1,101 @@ # * # *_________________________________________________________________________* # * POEMS: PARALLELIZABLE OPEN SOURCE EFFICIENT MULTIBODY SOFTWARE * # * DESCRIPTION: SEE READ-ME * # * FILE NAME: Makefile * # * AUTHORS: See Author List * # * GRANTS: See Grants List * # * COPYRIGHT: (C) 2005 by Authors as listed in Author's List * # * LICENSE: Please see License Agreement * # * DOWNLOAD: Free at www.rpi.edu/~anderk5 * # * ADMINISTRATOR: Prof. Kurt Anderson * # * Computational Dynamics Lab * # * Rensselaer Polytechnic Institute * # * 110 8th St. Troy NY 12180 * # * CONTACT: anderk5@rpi.edu * # *_________________________________________________________________________*/ SHELL = /bin/sh # which file will be copied to Makefile.lammps EXTRAMAKE = Makefile.lammps.empty # ------ FILES ------ SRC_MAIN = workspace.cpp system.cpp poemsobject.cpp INC_MAIN = workspace.h system.h poemsobject.h SRC_BODY = body.cpp rigidbody.cpp particle.cpp inertialframe.cpp INC_BODY = bodies.h body.h rigidbody.h particle.h inertialframe.h SRC_JOINT = joint.cpp revolutejoint.cpp prismaticjoint.cpp sphericaljoint.cpp \ freebodyjoint.cpp body23joint.cpp mixedjoint.cpp INC_JOINT = joints.h joint.h revolutejoint.h prismaticjoint.h sphericaljoint.h \ freebodyjoint.h body23joint.h mixedjoint.h SRC_POINT = point.cpp fixedpoint.cpp INC_POINT = points.h point.h fixedpoint.h SRC_SOLVE = solver.cpp INC_SOLVE = solver.h SRC_ORDERN = onsolver.cpp onfunctions.cpp onbody.cpp INC_ORDERN = onsolver.h onfunctions.h onbody.h SRC_MAT = virtualmatrix.cpp matrix.cpp matrixfun.cpp mat3x3.cpp virtualcolmatrix.cpp \ colmatrix.cpp vect3.cpp virtualrowmatrix.cpp rowmatrix.cpp mat6x6.cpp vect6.cpp \ fastmatrixops.cpp colmatmap.cpp eulerparameters.cpp vect4.cpp norm.cpp mat4x4.cpp \ INC_MAT = matrices.h virtualmatrix.h matrix.h matrixfun.h mat3x3.h virtualcolmatrix.h \ colmatrix.h vect3.h virtualrowmatrix.h rowmatrix.h mat6x6.h vect6.h \ fastmatrixops.h colmatmap.h eulerparameters.h vect4.h norm.h mat4x4.h SRC_MISC = poemstreenode.cpp INC_MISC = poemslist.h poemstreenode.h poemstree.h poemsnodelib.h SystemProcessor.h defines.h POEMSChain.h SRC = $(SRC_MAIN) $(SRC_BODY) $(SRC_JOINT) $(SRC_POINT) $(SRC_SOLVE) $(SRC_ORDERN) $(SRC_MAT) $(SRC_MISC) INC = $(INC_MAIN) $(INC_BODY) $(INC_JOINT) $(INC_POINT) $(INC_SOLVE) $(INC_ORDERN) $(INC_MAT) $(INC_MISC) FILES = $(SRC) $(INC) Makefile Authors_List.txt Grants_List.txt POEMS_License.txt README Copyright_Notice # ------ DEFINITIONS ------ -DIR = Obj_mingw64/ -LIB = $(DIR)libpoems.a -OBJ = $(SRC:%.cpp=$(DIR)%.o) +LIB = libpoems.a +OBJ = $(SRC:.cpp=.o) # ------ SETTINGS ------ -CC = x86_64-w64-mingw32-g++ -CCFLAGS = -O2 -march=core2 -mtune=core2 -msse2 -mpc64 \ - -ffast-math -funroll-loops -finline-functions -fno-rtti \ - -fno-exceptions -fstrict-aliasing \ - -Wall -W -Wno-uninitialized -ARCHIVE = x86_64-w64-mingw32-ar -ARCHFLAG = -rcs +CC = mpicxx +CCFLAGS = -O3 -g -fPIC -Wall #-Wno-deprecated +ARCHIVE = ar +ARCHFLAG = -rc DEPFLAGS = -M -LINK = x86_64-w64-mingw32-g++ +LINK = mpicxx LINKFLAGS = -O USRLIB = SYSLIB = # ------ MAKE PROCEDURE ------ -default: $(DIR) $(LIB) - -$(DIR): - -mkdir $(DIR) - -$(LIB): $(OBJ) +lib: $(OBJ) $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) @cp $(EXTRAMAKE) Makefile.lammps # ------ COMPILE RULES ------ -$(DIR)%.o:%.cpp - $(CC) $(CCFLAGS) -c $< -o $@ +%.o:%.cpp + $(CC) $(CCFLAGS) -c $< # ------ DEPENDENCIES ------ include .depend # ------ CLEAN ------ clean: - -rm $(DIR)*.o $(DIR)*.d *~ $(LIB) + -rm *.o *.d *~ $(LIB) tar: -tar -cvf ../POEMS.tar $(FILES) diff --git a/lib/poems/Makefile.serial b/lib/poems/Makefile.serial new file mode 120000 index 000000000..9d7bb000f --- /dev/null +++ b/lib/poems/Makefile.serial @@ -0,0 +1 @@ +Makefile.g++ \ No newline at end of file diff --git a/lib/qmmm/Makefile.mpi b/lib/qmmm/Makefile.mpi new file mode 100644 index 000000000..590b1047f --- /dev/null +++ b/lib/qmmm/Makefile.mpi @@ -0,0 +1,66 @@ +# -*- Makefile -*- for coupling LAMMPS to PWscf for QM/MM molecular dynamics + +# this file will be copied to Makefile.lammps +EXTRAMAKE = Makefile.lammps.empty + +# top level directory of Quantum ESPRESSO 5.4.1 or later +QETOPDIR=$(HOME)/compile/espresso + +# import compiler settings from Quantum ESPRESSO +sinclude $(QETOPDIR)/make.sys + +# FLAGS for c++ OpenMPI 1.8.8 or later when QE was compiled with GNU Fortran 4.x +MPICXX=mpicxx +MPICXXFLAGS= -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 -O2 -g -fPIC\ + -I../../src -I$(QETOPDIR)/COUPLE/include +MPILIBS=-fopenmp -lgfortran -ldl -ljpeg -lpng -lz -lmpi_mpifh -lmpi + +# location of required libraries +# part 1: hi-level libraries for building pw.x +PWOBJS = \ +$(QETOPDIR)/COUPLE/src/libqecouple.a \ +$(QETOPDIR)/PW/src/libpw.a \ +$(QETOPDIR)/Modules/libqemod.a +# part 2: lo-level libraries for all of Q-E +LIBOBJS = \ +$(QETOPDIR)/FFTXlib/libqefft.a \ +$(QETOPDIR)/LAXlib/libqela.a \ +$(QETOPDIR)/clib/clib.a \ +$(QETOPDIR)/iotk/src/libiotk.a + +# part 3: add-on libraries and main library for LAMMPS +sinclude ../../src/Makefile.package +LAMMPSCFG = mpi +LAMMPSLIB = ../../src/liblammps_$(LAMMPSCFG).a + +# part 4: local QM/MM library and progams +SRC=pwqmmm.c libqmmm.c +OBJ=$(SRC:%.c=%.o) + + +default: libqmmm.a + +all : tldeps libqmmm.a pwqmmm.x + +pwqmmm.x : pwqmmm.o $(OBJ) $(PWOBJS) $(LIBOBJS) $(LAMMPSLIB) + $(MPICXX) $(LDFLAGS) -o $@ $^ $(PKG_PATH) $(PKG_LIB) $(MPILIBS) $(LIBS) + +libqmmm.a: libqmmm.o + $(AR) $(ARFLAGS) $@ $^ + @cp $(EXTRAMAKE) Makefile.lammps + +%.o: %.c + $(MPICXX) -c $(LAMMPSFLAGS) $(MPICXXFLAGS) $< -o $@ + +tldeps: + ( cd $(QETOPDIR) ; $(MAKE) $(MFLAGS) couple || exit 1) + $(MAKE) -C ../../src $(MFLAGS) $(LAMMPSCFG) + $(MAKE) -C ../../src $(MFLAGS) mode=lib $(LAMMPSCFG) + +clean : + -rm -f *.x *.o *.a *~ *.F90 *.d *.mod *.i *.L + +# explicit dependencies + +pwqmmm.o: pwqmmm.c libqmmm.h +libqmmm.o: libqmmm.c libqmmm.h diff --git a/lib/qmmm/Makefile.serial b/lib/qmmm/Makefile.serial new file mode 100644 index 000000000..f09148279 --- /dev/null +++ b/lib/qmmm/Makefile.serial @@ -0,0 +1,66 @@ +# -*- Makefile -*- for coupling LAMMPS to PWscf for QM/MM molecular dynamics + +# this file will be copied to Makefile.lammps +EXTRAMAKE = Makefile.lammps.empty + +# top level directory of Quantum ESPRESSO 5.4.1 or later +QETOPDIR=$(HOME)/compile/espresso + +# import compiler settings from Quantum ESPRESSO +sinclude $(QETOPDIR)/make.sys + +# FLAGS for GNU c++ with STUBS. non-functional for real coupling +MPICXX=g++ +MPICXXFLAGS= -I../../src/STUBS -O2 -g -fPIC\ + -I../../src -I$(QETOPDIR)/COUPLE/include +MPILIBS=-fopenmp -lgfortran -ldl -ljpeg -lpng -lz -lmpi_mpifh -lmpi + +# location of required libraries +# part 1: hi-level libraries for building pw.x +PWOBJS = \ +$(QETOPDIR)/COUPLE/src/libqecouple.a \ +$(QETOPDIR)/PW/src/libpw.a \ +$(QETOPDIR)/Modules/libqemod.a +# part 2: lo-level libraries for all of Q-E +LIBOBJS = \ +$(QETOPDIR)/FFTXlib/libqefft.a \ +$(QETOPDIR)/LAXlib/libqela.a \ +$(QETOPDIR)/clib/clib.a \ +$(QETOPDIR)/iotk/src/libiotk.a + +# part 3: add-on libraries and main library for LAMMPS +sinclude ../../src/Makefile.package +LAMMPSCFG = mpi +LAMMPSLIB = ../../src/liblammps_$(LAMMPSCFG).a + +# part 4: local QM/MM library and progams +SRC=pwqmmm.c libqmmm.c +OBJ=$(SRC:%.c=%.o) + + +default: libqmmm.a + +all : tldeps libqmmm.a pwqmmm.x + +pwqmmm.x : pwqmmm.o $(OBJ) $(PWOBJS) $(LIBOBJS) $(LAMMPSLIB) + $(MPICXX) $(LDFLAGS) -o $@ $^ $(PKG_PATH) $(PKG_LIB) $(MPILIBS) $(LIBS) + +libqmmm.a: libqmmm.o + $(AR) $(ARFLAGS) $@ $^ + @cp $(EXTRAMAKE) Makefile.lammps + +%.o: %.c + $(MPICXX) -c $(LAMMPSFLAGS) $(MPICXXFLAGS) $< -o $@ + +tldeps: + ( cd $(QETOPDIR) ; $(MAKE) $(MFLAGS) couple || exit 1) + $(MAKE) -C ../../src $(MFLAGS) $(LAMMPSCFG) + $(MAKE) -C ../../src $(MFLAGS) mode=lib $(LAMMPSCFG) + +clean : + -rm -f *.x *.o *.a *~ *.F90 *.d *.mod *.i *.L + +# explicit dependencies + +pwqmmm.o: pwqmmm.c libqmmm.h +libqmmm.o: libqmmm.c libqmmm.h diff --git a/lib/reax/Makefile.gfortran b/lib/reax/Makefile.gfortran index b2b16fcc5..ab4230168 100644 --- a/lib/reax/Makefile.gfortran +++ b/lib/reax/Makefile.gfortran @@ -1,51 +1,51 @@ # * # *_________________________________________________________________________* # * Fortran Library for Reactive Force Field * # * DESCRIPTION: SEE READ-ME * # * FILE NAME: Makefile * # * CONTRIBUTING AUTHORS: Hansohl Cho(MIT), Aidan Thompson(SNL) * # * and Greg Wagner(SNL) * # * CONTACT: hansohl@mit.edu, athompson@sandia.gov, gjwagne@sandia.gov * # *_________________________________________________________________________*/ SHELL = /bin/sh # which file will be copied to Makefile.lammps EXTRAMAKE = Makefile.lammps.gfortran # ------ FILES ------ SRC = reax_connect.F reax_inout.F reax_lammps.F reax_poten.F reax_reac.F reax_charges.F HEADERFILES = reax_defs.h *.blk # ------ DEFINITIONS ------ LIB = libreax.a OBJ = $(SRC:.F=.o) # ------ SETTINGS ------ F90 = gfortran -F90FLAGS = -O -fPIC -fno-second-underscore +F90FLAGS = -O3 -fPIC -fno-second-underscore ARCHIVE = ar ARCHFLAG = -rc USRLIB = SYSLIB = # ------ MAKE PROCEDURE ------ lib: $(OBJ) $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) @cp $(EXTRAMAKE) Makefile.lammps # ------ COMPILE RULES ------ %.o:%.F $(HEADERFILES) $(F90) $(F90FLAGS) -c $< # ------ CLEAN ------ clean: -rm *.o $(LIB) diff --git a/lib/smd/Makefile.lammps b/lib/reax/Makefile.lammps.empty similarity index 57% copy from lib/smd/Makefile.lammps copy to lib/reax/Makefile.lammps.empty index 7bbf3924e..758755f3c 100644 --- a/lib/smd/Makefile.lammps +++ b/lib/reax/Makefile.lammps.empty @@ -1,5 +1,5 @@ # Settings that the LAMMPS build will import when this package library is used -user-smd_SYSINC = -user-smd_SYSLIB = -user-smd_SYSPATH = +reax_SYSINC = +reax_SYSLIB = +reax_SYSPATH = diff --git a/lib/reax/Makefile.gfortran b/lib/reax/Makefile.mpi similarity index 91% copy from lib/reax/Makefile.gfortran copy to lib/reax/Makefile.mpi index b2b16fcc5..142f7e9bc 100644 --- a/lib/reax/Makefile.gfortran +++ b/lib/reax/Makefile.mpi @@ -1,51 +1,51 @@ # * # *_________________________________________________________________________* # * Fortran Library for Reactive Force Field * # * DESCRIPTION: SEE READ-ME * # * FILE NAME: Makefile * # * CONTRIBUTING AUTHORS: Hansohl Cho(MIT), Aidan Thompson(SNL) * # * and Greg Wagner(SNL) * # * CONTACT: hansohl@mit.edu, athompson@sandia.gov, gjwagne@sandia.gov * # *_________________________________________________________________________*/ SHELL = /bin/sh # which file will be copied to Makefile.lammps -EXTRAMAKE = Makefile.lammps.gfortran +EXTRAMAKE = Makefile.lammps.empty # ------ FILES ------ SRC = reax_connect.F reax_inout.F reax_lammps.F reax_poten.F reax_reac.F reax_charges.F HEADERFILES = reax_defs.h *.blk # ------ DEFINITIONS ------ LIB = libreax.a OBJ = $(SRC:.F=.o) # ------ SETTINGS ------ -F90 = gfortran -F90FLAGS = -O -fPIC -fno-second-underscore +F90 = mpifort +F90FLAGS = -O3 -fPIC ARCHIVE = ar ARCHFLAG = -rc USRLIB = SYSLIB = # ------ MAKE PROCEDURE ------ lib: $(OBJ) $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) @cp $(EXTRAMAKE) Makefile.lammps # ------ COMPILE RULES ------ %.o:%.F $(HEADERFILES) $(F90) $(F90FLAGS) -c $< # ------ CLEAN ------ clean: -rm *.o $(LIB) diff --git a/lib/reax/Makefile.serial b/lib/reax/Makefile.serial new file mode 120000 index 000000000..c52fbcb98 --- /dev/null +++ b/lib/reax/Makefile.serial @@ -0,0 +1 @@ +Makefile.gfortran \ No newline at end of file diff --git a/lib/smd/Install.py b/lib/smd/Install.py index 337f993be..fe0283563 100644 --- a/lib/smd/Install.py +++ b/lib/smd/Install.py @@ -1,117 +1,117 @@ #!/usr/bin/env python # Install.py tool to download, unpack, and point to the Eigen library # used to automate the steps described in the README file in this dir 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 or: make lib-smd args="-p /usr/include/eigen3" Syntax from lib dir: python Install.py 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) -p = specify folder holding an existing installation of Eigen -v = set version of Eigen library to download and set up (default = 3.3.4) Example: make lib-smd args="-b" # download/build in default lib/smd/eigen-eigen-* """ # settings version = '3.3.4' tarball = "eigen.tar.gz" # print error message or help def error(str=None): if not str: print(help) else: print("ERROR",str) sys.exit() # expand to full path name # process leading '~' or relative path def fullpath(path): return os.path.abspath(os.path.expanduser(path)) # parse args args = sys.argv[1:] nargs = len(args) homepath = "." homedir = "eigen3" grabflag = True buildflag = True pathflag = False linkflag = True iarg = 0 while iarg < nargs: if args[iarg] == "-v": if iarg+2 > nargs: error() version = args[iarg+1] iarg += 2 elif args[iarg] == "-p": if iarg+2 > nargs: error() eigenpath = fullpath(args[iarg+1]) pathflag = True buildflag = False iarg += 2 elif args[iarg] == "-b": buildflag = True iarg += 1 else: error() homepath = fullpath(homepath) if (pathflag): if not os.path.isdir(eigenpath): error("Eigen path does not exist") if (buildflag and pathflag): error("Cannot use -b and -p flag at the same time") # download and unpack Eigen tarball # use glob to find name of dir it unpacks to if buildflag: print("Downloading Eigen ...") url = "http://bitbucket.org/eigen/eigen/get/%s.tar.gz" % version geturl(url,"%s/%s" % (homepath,tarball)) print("Unpacking Eigen tarball ...") edir = glob.glob("%s/eigen-eigen-*" % homepath) for one in edir: if os.path.isdir(one): - subprocess.check_output("rm -rf %s" % one,stderr=subprocess.STDOUT,shell=True) + subprocess.check_output('rm -rf "%s"' % one,stderr=subprocess.STDOUT,shell=True) cmd = 'cd "%s"; tar -xzvf %s' % (homepath,tarball) subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) edir = glob.glob("%s/eigen-eigen-*" % homepath) os.rename(edir[0],"%s/%s" % (homepath,homedir)) os.remove(tarball) # create link in lib/smd to Eigen src dir if linkflag: print("Creating link to Eigen files") if os.path.isfile("includelink") or os.path.islink("includelink"): os.remove("includelink") if pathflag: linkdir = eigenpath else: linkdir = "%s/%s" % (homepath,homedir) - cmd = "ln -s %s includelink" % linkdir + cmd = 'ln -s "%s" includelink' % linkdir subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) diff --git a/lib/smd/Makefile.lammps b/lib/smd/Makefile.lammps index 7bbf3924e..6951a1394 100644 --- a/lib/smd/Makefile.lammps +++ b/lib/smd/Makefile.lammps @@ -1,5 +1,5 @@ # Settings that the LAMMPS build will import when this package library is used -user-smd_SYSINC = +user-smd_SYSINC = -I../../lib/includelink/eigen3 user-smd_SYSLIB = user-smd_SYSPATH = diff --git a/lib/voronoi/Install.py b/lib/voronoi/Install.py index 17bba5e8e..6db0495a3 100644 --- a/lib/voronoi/Install.py +++ b/lib/voronoi/Install.py @@ -1,128 +1,135 @@ #!/usr/bin/env python # Install.py tool to download, unpack, build, and link to the Voro++ library # used to automate the steps described in the README file in this dir from __future__ import print_function import sys,os,re,subprocess -try: from urllib.request import urlretrieve as geturl -except: from urllib import urlretrieve as geturl + +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 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: 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 -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 """ # settings version = "voro++-0.4.6" url = "http://math.lbl.gov/voro++/download/dir/%s.tar.gz" % version # print error message or help def error(str=None): if not str: print(help) else: print("ERROR",str) sys.exit() # expand to full path name # process leading '~' or relative path def fullpath(path): return os.path.abspath(os.path.expanduser(path)) # parse args args = sys.argv[1:] nargs = len(args) homepath = "." homedir = version -grabflag = True buildflag = True pathflag = False linkflag = True iarg = 0 while iarg < nargs: if args[iarg] == "-v": if iarg+2 > nargs: error() version = args[iarg+1] iarg += 2 elif args[iarg] == "-p": if iarg+2 > nargs: error() voropath = fullpath(args[iarg+1]) pathflag = True buildflag = False iarg += 2 elif args[iarg] == "-b": buildflag = True iarg += 1 else: error() homepath = fullpath(homepath) homedir = "%s/%s" % (homepath,version) if (pathflag): if not os.path.isdir(voropath): error("Voro++ path does not exist") homedir = voropath if (buildflag and pathflag): error("Cannot use -b and -p flag at the same time") # download and unpack Voro++ tarball -if grabflag: +if buildflag: print("Downloading Voro++ ...") geturl(url,"%s/%s.tar.gz" % (homepath,version)) print("Unpacking Voro++ tarball ...") if os.path.exists("%s/%s" % (homepath,version)): cmd = 'rm -rf "%s/%s"' % (homepath,version) subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) cmd = 'cd "%s"; tar -xzvf %s.tar.gz' % (homepath,version) subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) os.remove("%s/%s.tar.gz" % (homepath,version)) if os.path.basename(homedir) != version: if os.path.exists(homedir): cmd = 'rm -rf "%s"' % homedir subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) os.rename("%s/%s" % (homepath,version),homedir) # build Voro++ if buildflag: print("Building Voro++ ...") cmd = 'cd "%s"; make' % homedir txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) print(txt.decode('UTF-8')) # create 2 links in lib/voronoi to Voro++ src dir if linkflag: print("Creating links to Voro++ include and lib files") if os.path.isfile("includelink") or os.path.islink("includelink"): os.remove("includelink") if os.path.isfile("liblink") or os.path.islink("liblink"): os.remove("liblink") - cmd = ['ln -s "%s/src" includelink' % homedir, 'includelink'] + cmd = 'ln -s "%s/src" includelink' % homedir subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) - cmd = ['ln -s "%s/src" liblink' % homedir] + cmd = 'ln -s "%s/src" liblink' % homedir subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)