new Section package and start doc pages and build scripts
This commit is contained in:
82
lib/awpmd/Install.py
Normal file
82
lib/awpmd/Install.py
Normal file
@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# install.py tool to do a generic build of a library
|
||||
# soft linked to by many of the lib/Install.py files
|
||||
# used to automate the steps described in the corresponding lib/README
|
||||
|
||||
import sys,commands,os
|
||||
|
||||
# help message
|
||||
|
||||
help = """
|
||||
Syntax: python Install.py -m machine -e suffix
|
||||
specify -m and optionally -e, order does not matter
|
||||
-m = peform a clean followed by "make -f Makefile.machine"
|
||||
machine = suffix of a lib/Makefile.* file
|
||||
-e = set EXTRAMAKE variable in Makefile.machine to Makefile.lammps.suffix
|
||||
does not alter existing Makefile.machine
|
||||
"""
|
||||
|
||||
# print error message or help
|
||||
|
||||
def error(str=None):
|
||||
if not str: print help
|
||||
else: print "ERROR",str
|
||||
sys.exit()
|
||||
|
||||
# parse args
|
||||
|
||||
args = sys.argv[1:]
|
||||
nargs = len(args)
|
||||
if nargs == 0: error()
|
||||
|
||||
machine = None
|
||||
extraflag = 0
|
||||
|
||||
iarg = 0
|
||||
while iarg < nargs:
|
||||
if args[iarg] == "-m":
|
||||
if iarg+2 > nargs: error()
|
||||
machine = args[iarg+1]
|
||||
iarg += 2
|
||||
elif args[iarg] == "-e":
|
||||
if iarg+2 > nargs: error()
|
||||
extraflag = 1
|
||||
suffix = args[iarg+1]
|
||||
iarg += 2
|
||||
else: error()
|
||||
|
||||
# set lib from working dir
|
||||
|
||||
cwd = os.getcwd()
|
||||
lib = os.path.basename(cwd)
|
||||
|
||||
# create Makefile.auto as copy of Makefile.machine
|
||||
# reset EXTRAMAKE if requested
|
||||
|
||||
if not os.path.exists("Makefile.%s" % machine):
|
||||
error("lib/%s/Makefile.%s does not exist" % (lib,machine))
|
||||
|
||||
lines = open("Makefile.%s" % machine,'r').readlines()
|
||||
fp = open("Makefile.auto",'w')
|
||||
|
||||
for line in lines:
|
||||
words = line.split()
|
||||
if len(words) == 3 and extraflag and \
|
||||
words[0] == "EXTRAMAKE" and words[1] == '=':
|
||||
line = line.replace(words[2],"Makefile.lammps.%s" % suffix)
|
||||
print >>fp,line,
|
||||
|
||||
fp.close()
|
||||
|
||||
# make the library via Makefile.auto
|
||||
|
||||
print "Building lib%s.a ..." % lib
|
||||
cmd = "make -f Makefile.auto clean; make -f Makefile.auto"
|
||||
txt = commands.getoutput(cmd)
|
||||
print txt
|
||||
|
||||
if os.path.exists("lib%s.a" % lib): print "Build was successful"
|
||||
else: error("Build of lib/%s/lib%s.a was NOT successful" % (lib,lib))
|
||||
if not os.path.exists("Makefile.lammps"):
|
||||
print "lib/%s/Makefile.lammps was NOT created" % lib
|
||||
@ -19,6 +19,11 @@ links against when using the USER-AWPMD package.
|
||||
This library must be built with a C++ compiler, before LAMMPS is
|
||||
built, so LAMMPS can link against it.
|
||||
|
||||
You can type "make lib-awpmd" from the src directory to see help on
|
||||
how to build this library via make commands, or you can do the same
|
||||
thing by typing "python Install.py" from within this directory, or you
|
||||
can do it manually by following the instructions below.
|
||||
|
||||
Build the library using one of the provided Makefile.* files or create
|
||||
your own, specific to your compiler and system. For example:
|
||||
|
||||
@ -47,16 +52,16 @@ user-awpmd_SYSINC = leave blank for this package
|
||||
user-awpmd_SYSLIB = BLAS and LAPACK libraries needed by this package
|
||||
user-awpmd_SYSPATH = path(s) to where those libraries are
|
||||
|
||||
You have several choices for these settings:
|
||||
You have 3 choices for these settings:
|
||||
|
||||
If the 2 libraries are already installed on your system, the settings
|
||||
in Makefile.lammps.installed should work.
|
||||
a) If the 2 libraries are already installed on your system, the
|
||||
settings in Makefile.lammps.installed should work.
|
||||
|
||||
If they are not, you can install them yourself, and speficy the
|
||||
appropriate settings accordingly.
|
||||
b) If they are not, you can install them yourself, and specify the
|
||||
appropriate settings accordingly in a Makefile.lammps.* file
|
||||
and set the EXTRAMAKE setting in Makefile.* to that file.
|
||||
|
||||
If you want to use the minimalist version of these libraries provided
|
||||
with LAMMPS in lib/linalg, then the settings in Makefile.lammps.linalg
|
||||
should work. Note that in this case you also need to build the
|
||||
linear-algebra in lib/linalg; see the lib/linalg/README for more
|
||||
details.
|
||||
c) Use the minimalist version of these libraries provided with LAMMPS
|
||||
in lib/linalg, by using Makefile.lammps.linalg. In this case you also
|
||||
need to build the library in lib/linalg; see the lib/linalg/README
|
||||
file for more details.
|
||||
|
||||
Reference in New Issue
Block a user