forked from lijiext/lammps
Merge branch 'kim-install' into install-and-docs-reviewed
This commit is contained in:
commit
da7a5f55d3
|
@ -233,8 +233,8 @@ set any needed options for the package via "-pk" "command-line switch"_Section_s
|
||||||
use accelerated styles in your input via "-sf" "command-line switch"_Section_start.html#start_6 or "suffix"_suffix.html command | lmp_machine -in in.script -sf gpu
|
use accelerated styles in your input via "-sf" "command-line switch"_Section_start.html#start_6 or "suffix"_suffix.html command | lmp_machine -in in.script -sf gpu
|
||||||
:tb(c=2,s=|)
|
:tb(c=2,s=|)
|
||||||
|
|
||||||
Note that the first 4 steps can be done as a single command, using the
|
Note that the first 4 steps can be done as a single command with
|
||||||
src/Make.py tool. This tool is discussed in "Section
|
suitable make command invocations. This is discussed in "Section
|
||||||
4"_Section_packages.html of the manual, and its use is
|
4"_Section_packages.html of the manual, and its use is
|
||||||
illustrated in the individual accelerator sections. Typically these
|
illustrated in the individual accelerator sections. Typically these
|
||||||
steps only need to be done once, to create an executable that uses one
|
steps only need to be done once, to create an executable that uses one
|
||||||
|
|
|
@ -734,8 +734,8 @@ package"_Section_start.html#start_3.
|
||||||
"smd/wall/surface"_fix_smd_wall_surface.html,
|
"smd/wall/surface"_fix_smd_wall_surface.html,
|
||||||
"temp/rescale/eff"_fix_temp_rescale_eff.html,
|
"temp/rescale/eff"_fix_temp_rescale_eff.html,
|
||||||
"ti/spring"_fix_ti_spring.html,
|
"ti/spring"_fix_ti_spring.html,
|
||||||
"ttm/mod"_fix_ttm.html
|
"ttm/mod"_fix_ttm.html,
|
||||||
"wall/ees"_fix_wall_ees.html
|
"wall/ees"_fix_wall_ees.html,
|
||||||
"wall/region/ees"_fix_wall_ees.html :tb(c=6,ea=c)
|
"wall/region/ees"_fix_wall_ees.html :tb(c=6,ea=c)
|
||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
|
@ -49,6 +49,7 @@ Lists of both kinds of directories are given below.
|
||||||
Lowercase directories :h4
|
Lowercase directories :h4
|
||||||
|
|
||||||
accelerate: run with various acceleration options (OpenMP, GPU, Phi)
|
accelerate: run with various acceleration options (OpenMP, GPU, Phi)
|
||||||
|
airebo: polyethylene with AIREBO potential
|
||||||
balance: dynamic load balancing, 2d system
|
balance: dynamic load balancing, 2d system
|
||||||
body: body particles, 2d system
|
body: body particles, 2d system
|
||||||
cmap: CMAP 5-body contributions to CHARMM force field
|
cmap: CMAP 5-body contributions to CHARMM force field
|
||||||
|
|
|
@ -492,14 +492,38 @@ Minnesota).
|
||||||
|
|
||||||
[Install or un-install:]
|
[Install or un-install:]
|
||||||
|
|
||||||
Using this package requires the KIM library and its models
|
Before building LAMMPS with this package, you must first download and
|
||||||
(interatomic potentials) to be downloaded and installed on your
|
build the KIM library and include the KIM models that you want to
|
||||||
system. The library can be downloaded and built in lib/kim or
|
use. You can do this manually if you prefer; follow the instructions
|
||||||
elsewhere on your system. Details of the download, build, and install
|
in lib/kim/README. You can also do it in one step from the lammps/src
|
||||||
process for KIM are given in the lib/kim/README file.
|
dir, using a command like these, which simply invoke the
|
||||||
|
lib/kim/Install.py script with the specified args.
|
||||||
|
|
||||||
Once that process is complete, you can then install/un-install the
|
make lib-kim # print help message
|
||||||
package and build LAMMPS in the usual manner:
|
make lib-kim args="-b . none" # install KIM API lib with only example models
|
||||||
|
make lib-kim args="-b . Glue_Ercolessi_Adams_Al__MO_324507536345_001" # ditto plus one model
|
||||||
|
make lib-kim args="-b . OpenKIM" # install KIM API lib with all models
|
||||||
|
make lib-kim args="-a EAM_Dynamo_Ackland_W__MO_141627196590_002" # add one model or model driver :pre
|
||||||
|
|
||||||
|
Note that in LAMMPS lingo, a KIM model driver is a pair style
|
||||||
|
(e.g. EAM or Tersoff). A KIM model is a pair style for a particular
|
||||||
|
element or alloy and set of parameters, e.g. EAM for Cu with a
|
||||||
|
specific EAM potential file. Also note that installing the KIM API
|
||||||
|
library with all its models, may take around 30 min to build. Of
|
||||||
|
course you only need to do that once.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
You can then install/un-install the package and build LAMMPS in the
|
||||||
|
usual manner:
|
||||||
|
|
||||||
make yes-kim
|
make yes-kim
|
||||||
make machine :pre
|
make machine :pre
|
||||||
|
@ -1414,7 +1438,7 @@ lib/linalg. In the latter case you also need to build the library
|
||||||
in lib/linalg with a command like these:
|
in lib/linalg with a command like these:
|
||||||
|
|
||||||
make lib-linalg # print help message
|
make lib-linalg # print help message
|
||||||
make lib-atc args="-m gfortran" # build with GNU Fortran compiler
|
make lib-linalg args="-m gfortran" # build with GNU Fortran compiler
|
||||||
|
|
||||||
You can then install/un-install the package and build LAMMPS in the
|
You can then install/un-install the package and build LAMMPS in the
|
||||||
usual manner:
|
usual manner:
|
||||||
|
@ -2469,8 +2493,8 @@ step from the lammps/src dir, using a command like these, which simply
|
||||||
invoke the lib/smd/Install.py script with the specified args:
|
invoke the lib/smd/Install.py script with the specified args:
|
||||||
|
|
||||||
make lib-smd # print help message
|
make lib-smd # print help message
|
||||||
make lib-smd args="-g -l" # download in default lib/smd/eigen-eigen-*
|
make lib-smd args="-g -l" # download and build in default lib/smd/eigen-eigen-*
|
||||||
make lib-smd args="-h . eigen -g -l" # download in lib/smd/eigen
|
make lib-smd args="-h . eigen -g -l" # download and build in lib/smd/eigen
|
||||||
make lib-smd args="-h ~ eigen -g -l" # download and build in ~/eigen :pre
|
make lib-smd args="-h ~ eigen -g -l" # download and build in ~/eigen :pre
|
||||||
|
|
||||||
Note that the final -l switch is to create a symbolic (soft) link
|
Note that the final -l switch is to create a symbolic (soft) link
|
||||||
|
|
|
@ -74,13 +74,8 @@ Run lammps/lib/gpu/nvc_get_devices (after building the GPU library, see below) t
|
||||||
This requires two steps (a,b): build the GPU library, then build
|
This requires two steps (a,b): build the GPU library, then build
|
||||||
LAMMPS with the GPU package.
|
LAMMPS with the GPU package.
|
||||||
|
|
||||||
You can do both these steps in one line, using the src/Make.py script,
|
You can do both these steps in one line as described in
|
||||||
described in "Section 4"_Section_packages.html of the manual.
|
"Section 4"_Section_packages.html of the manual.
|
||||||
Type "Make.py -h" for help. If run from the src directory, this
|
|
||||||
command will create src/lmp_gpu using src/MAKE/Makefile.mpi as the
|
|
||||||
starting Makefile.machine:
|
|
||||||
|
|
||||||
Make.py -p gpu -gpu mode=single arch=31 -o gpu -a lib-gpu file mpi :pre
|
|
||||||
|
|
||||||
Or you can follow these two (a,b) steps:
|
Or you can follow these two (a,b) steps:
|
||||||
|
|
||||||
|
|
|
@ -225,11 +225,9 @@ source /opt/intel/parallel_studio_xe_2016.3.067/psxevars.sh
|
||||||
# or psxevars.csh for C-shell
|
# or psxevars.csh for C-shell
|
||||||
make intel_cpu_intelmpi :pre
|
make intel_cpu_intelmpi :pre
|
||||||
|
|
||||||
Alternatively, the build can be accomplished with the src/Make.py
|
Alternatively this can be done as a single command with
|
||||||
script, described in "Section 4"_Section_packages.html of the
|
suitable make command invocations. This is discussed in "Section
|
||||||
manual. Type "Make.py -h" for help. For an example:
|
4"_Section_packages.html of the manual.
|
||||||
|
|
||||||
Make.py -v -p intel omp -intel cpu -a file intel_cpu_intelmpi :pre
|
|
||||||
|
|
||||||
Note that if you build with support for a Phi coprocessor, the same
|
Note that if you build with support for a Phi coprocessor, the same
|
||||||
binary can be used on nodes with or without coprocessors installed.
|
binary can be used on nodes with or without coprocessors installed.
|
||||||
|
@ -244,8 +242,7 @@ highly recommended for CCFLAGS and LINKFLAGS. LIB should include
|
||||||
is required for CCFLAGS and "-qoffload" is required for LINKFLAGS.
|
is required for CCFLAGS and "-qoffload" is required for LINKFLAGS.
|
||||||
Other recommended CCFLAG options for best performance are
|
Other recommended CCFLAG options for best performance are
|
||||||
"-O2 -fno-alias -ansi-alias -qoverride-limits fp-model fast=2
|
"-O2 -fno-alias -ansi-alias -qoverride-limits fp-model fast=2
|
||||||
-no-prec-div". The Make.py command will add all of these
|
-no-prec-div".
|
||||||
automatically.
|
|
||||||
|
|
||||||
NOTE: The vectorization and math capabilities can differ depending on
|
NOTE: The vectorization and math capabilities can differ depending on
|
||||||
the CPU. For Intel compilers, the "-x" flag specifies the type of
|
the CPU. For Intel compilers, the "-x" flag specifies the type of
|
||||||
|
|
|
@ -60,8 +60,7 @@ More details follow.
|
||||||
use a C++11 compatible compiler
|
use a C++11 compatible compiler
|
||||||
make yes-kokkos
|
make yes-kokkos
|
||||||
make mpi KOKKOS_DEVICES=OpenMP # build with the KOKKOS package
|
make mpi KOKKOS_DEVICES=OpenMP # build with the KOKKOS package
|
||||||
make kokkos_omp # or Makefile.kokkos_omp already has variable set
|
make kokkos_omp # or Makefile.kokkos_omp already has variable set :pre
|
||||||
Make.py -v -p kokkos -kokkos omp -o mpi -a file mpi # or one-line build via Make.py :pre
|
|
||||||
|
|
||||||
mpirun -np 16 lmp_mpi -k on -sf kk -in in.lj # 1 node, 16 MPI tasks/node, no threads
|
mpirun -np 16 lmp_mpi -k on -sf kk -in in.lj # 1 node, 16 MPI tasks/node, no threads
|
||||||
mpirun -np 2 -ppn 1 lmp_mpi -k on t 16 -sf kk -in in.lj # 2 nodes, 1 MPI task/node, 16 threads/task
|
mpirun -np 2 -ppn 1 lmp_mpi -k on t 16 -sf kk -in in.lj # 2 nodes, 1 MPI task/node, 16 threads/task
|
||||||
|
@ -82,8 +81,7 @@ use a C++11 compatible compiler
|
||||||
KOKKOS_DEVICES = Cuda, OpenMP
|
KOKKOS_DEVICES = Cuda, OpenMP
|
||||||
KOKKOS_ARCH = Kepler35
|
KOKKOS_ARCH = Kepler35
|
||||||
make yes-kokkos
|
make yes-kokkos
|
||||||
make machine
|
make machine :pre
|
||||||
Make.py -p kokkos -kokkos cuda arch=31 -o kokkos_cuda -a file kokkos_cuda :pre
|
|
||||||
|
|
||||||
mpirun -np 1 lmp_cuda -k on t 6 -sf kk -in in.lj # one MPI task, 6 threads on CPU
|
mpirun -np 1 lmp_cuda -k on t 6 -sf kk -in in.lj # one MPI task, 6 threads on CPU
|
||||||
mpirun -np 4 -ppn 1 lmp_cuda -k on t 6 -sf kk -in in.lj # ditto on 4 nodes :pre
|
mpirun -np 4 -ppn 1 lmp_cuda -k on t 6 -sf kk -in in.lj # ditto on 4 nodes :pre
|
||||||
|
@ -98,8 +96,7 @@ use a C++11 compatible compiler
|
||||||
KOKKOS_DEVICES = OpenMP
|
KOKKOS_DEVICES = OpenMP
|
||||||
KOKKOS_ARCH = KNC
|
KOKKOS_ARCH = KNC
|
||||||
make yes-kokkos
|
make yes-kokkos
|
||||||
make machine
|
make machine :pre
|
||||||
Make.py -p kokkos -kokkos phi -o kokkos_phi -a file mpi :pre
|
|
||||||
|
|
||||||
host=MIC, Intel Phi with 61 cores (240 threads/phi via 4x hardware threading):
|
host=MIC, Intel Phi with 61 cores (240 threads/phi via 4x hardware threading):
|
||||||
mpirun -np 1 lmp_g++ -k on t 240 -sf kk -in in.lj # 1 MPI task on 1 Phi, 1*240 = 240
|
mpirun -np 1 lmp_g++ -k on t 240 -sf kk -in in.lj # 1 MPI task on 1 Phi, 1*240 = 240
|
||||||
|
@ -135,9 +132,9 @@ mode like the USER-INTEL package supports.
|
||||||
You must choose at build time whether to build for CPUs (OpenMP),
|
You must choose at build time whether to build for CPUs (OpenMP),
|
||||||
GPUs, or Phi.
|
GPUs, or Phi.
|
||||||
|
|
||||||
You can do any of these in one line, using the src/Make.py script,
|
You can do any of these in one line, using the suitable make command
|
||||||
described in "Section 4"_Section_packages.html of the manual.
|
line flags as described in "Section 4"_Section_packages.html of the
|
||||||
Type "Make.py -h" for help. If run from the src directory, these
|
manual. If run from the src directory, these
|
||||||
commands will create src/lmp_kokkos_omp, lmp_kokkos_cuda, and
|
commands will create src/lmp_kokkos_omp, lmp_kokkos_cuda, and
|
||||||
lmp_kokkos_phi. Note that the OMP and PHI options use
|
lmp_kokkos_phi. Note that the OMP and PHI options use
|
||||||
src/MAKE/Makefile.mpi as the starting Makefile.machine. The CUDA
|
src/MAKE/Makefile.mpi as the starting Makefile.machine. The CUDA
|
||||||
|
|
|
@ -23,8 +23,7 @@ one or more 16-core nodes. More details follow.
|
||||||
use -fopenmp with CCFLAGS and LINKFLAGS in Makefile.machine
|
use -fopenmp with CCFLAGS and LINKFLAGS in Makefile.machine
|
||||||
make yes-user-omp
|
make yes-user-omp
|
||||||
make mpi # build with USER-OMP package, if settings added to Makefile.mpi
|
make mpi # build with USER-OMP package, if settings added to Makefile.mpi
|
||||||
make omp # or Makefile.omp already has settings
|
make omp # or Makefile.omp already has settings :pre
|
||||||
Make.py -v -p omp -o mpi -a file mpi # or one-line build via Make.py :pre
|
|
||||||
|
|
||||||
lmp_mpi -sf omp -pk omp 16 < in.script # 1 MPI task, 16 threads
|
lmp_mpi -sf omp -pk omp 16 < in.script # 1 MPI task, 16 threads
|
||||||
mpirun -np 4 lmp_mpi -sf omp -pk omp 4 -in in.script # 4 MPI tasks, 4 threads/task
|
mpirun -np 4 lmp_mpi -sf omp -pk omp 4 -in in.script # 4 MPI tasks, 4 threads/task
|
||||||
|
@ -40,14 +39,11 @@ each MPI task running on a CPU.
|
||||||
|
|
||||||
The lines above illustrate how to include/build with the USER-OMP
|
The lines above illustrate how to include/build with the USER-OMP
|
||||||
package in two steps, using the "make" command. Or how to do it with
|
package in two steps, using the "make" command. Or how to do it with
|
||||||
one command via the src/Make.py script, described in "Section
|
one command as described in "Section 4"_Section_packages.html of the manual.
|
||||||
4"_Section_packages.html of the manual. Type "Make.py -h" for
|
|
||||||
help.
|
|
||||||
|
|
||||||
Note that the CCFLAGS and LINKFLAGS settings in Makefile.machine must
|
Note that the CCFLAGS and LINKFLAGS settings in Makefile.machine must
|
||||||
include "-fopenmp". Likewise, if you use an Intel compiler, the
|
include "-fopenmp". Likewise, if you use an Intel compiler, the
|
||||||
CCFLAGS setting must include "-restrict". The Make.py command will
|
CCFLAGS setting must include "-restrict".
|
||||||
add these automatically.
|
|
||||||
|
|
||||||
[Run with the USER-OMP package from the command line:]
|
[Run with the USER-OMP package from the command line:]
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,7 @@ Here is a quick overview of how to use the OPT package. More details
|
||||||
follow.
|
follow.
|
||||||
|
|
||||||
make yes-opt
|
make yes-opt
|
||||||
make mpi # build with the OPT package
|
make mpi # build with the OPT package :pre
|
||||||
Make.py -v -p opt -o mpi -a file mpi # or one-line build via Make.py :pre
|
|
||||||
|
|
||||||
lmp_mpi -sf opt -in in.script # run in serial
|
lmp_mpi -sf opt -in in.script # run in serial
|
||||||
mpirun -np 4 lmp_mpi -sf opt -in in.script # run in parallel :pre
|
mpirun -np 4 lmp_mpi -sf opt -in in.script # run in parallel :pre
|
||||||
|
@ -35,13 +34,10 @@ None.
|
||||||
|
|
||||||
The lines above illustrate how to build LAMMPS with the OPT package in
|
The lines above illustrate how to build LAMMPS with the OPT package in
|
||||||
two steps, using the "make" command. Or how to do it with one command
|
two steps, using the "make" command. Or how to do it with one command
|
||||||
via the src/Make.py script, described in "Section
|
as described in "Section 4"_Section_packages.html of the manual.
|
||||||
4"_Section_packages.html of the manual. Type "Make.py -h" for
|
|
||||||
help.
|
|
||||||
|
|
||||||
Note that if you use an Intel compiler to build with the OPT package,
|
Note that if you use an Intel compiler to build with the OPT package,
|
||||||
the CCFLAGS setting in your Makefile.machine must include "-restrict".
|
the CCFLAGS setting in your Makefile.machine must include "-restrict".
|
||||||
The Make.py command will add this automatically.
|
|
||||||
|
|
||||||
[Run with the OPT package from the command line:]
|
[Run with the OPT package from the command line:]
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,8 @@ atoms in the specified group. This can be useful for models where a
|
||||||
large portion of the simulation is particles that do not interact with
|
large portion of the simulation is particles that do not interact with
|
||||||
other particles or with each other via pairwise interactions. The
|
other particles or with each other via pairwise interactions. The
|
||||||
group specified with this option must also be specified via the
|
group specified with this option must also be specified via the
|
||||||
"atom_modify first"_atom_modify.html command.
|
"atom_modify first"_atom_modify.html command. Note that specifying
|
||||||
|
"all" as the group-ID effectively turns off the {include} option.
|
||||||
|
|
||||||
The {exclude} option turns off pairwise interactions between certain
|
The {exclude} option turns off pairwise interactions between certain
|
||||||
pairs of atoms, by not including them in the neighbor list. These are
|
pairs of atoms, by not including them in the neighbor list. These are
|
||||||
|
@ -213,5 +214,5 @@ space.
|
||||||
[Default:]
|
[Default:]
|
||||||
|
|
||||||
The option defaults are delay = 10, every = 1, check = yes, once = no,
|
The option defaults are delay = 10, every = 1, check = yes, once = no,
|
||||||
cluster = no, include = all, exclude = none, page = 100000, one =
|
cluster = no, include = all (same as no include option defined),
|
||||||
2000, and binsize = 0.0.
|
exclude = none, page = 100000, one = 2000, and binsize = 0.0.
|
||||||
|
|
|
@ -58,7 +58,7 @@ These are the sample problems and their output in the various
|
||||||
sub-directories:
|
sub-directories:
|
||||||
|
|
||||||
accelerate: use of all the various accelerator packages
|
accelerate: use of all the various accelerator packages
|
||||||
airebo: example for using AIREBO and AIREBO-M
|
airebo: polyethylene with AIREBO potential
|
||||||
balance: dynamic load balancing, 2d system
|
balance: dynamic load balancing, 2d system
|
||||||
body: body particles, 2d system
|
body: body particles, 2d system
|
||||||
cmap: CMAP 5-body contributions to CHARMM force field
|
cmap: CMAP 5-body contributions to CHARMM force field
|
||||||
|
|
|
@ -9,12 +9,21 @@ import sys,commands,os
|
||||||
# help message
|
# help message
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
Syntax: python Install.py -m machine -e suffix
|
Syntax from src dir: make lib-libname args="-m machine -e suffix"
|
||||||
specify -m and optionally -e, order does not matter
|
Syntax from lib dir: python Install.py -m machine -e suffix
|
||||||
|
|
||||||
|
libname = name of lib dir (e.g. atc, colvars, h5md, meam, poems, etc)
|
||||||
|
specify -m and optionally -e, order does not matter
|
||||||
|
|
||||||
-m = peform a clean followed by "make -f Makefile.machine"
|
-m = peform a clean followed by "make -f Makefile.machine"
|
||||||
machine = suffix of a lib/Makefile.* file
|
machine = suffix of a lib/Makefile.* file
|
||||||
-e = set EXTRAMAKE variable in Makefile.machine to Makefile.lammps.suffix
|
-e = set EXTRAMAKE variable in Makefile.machine to Makefile.lammps.suffix
|
||||||
does not alter existing Makefile.machine
|
does not alter existing Makefile.machine
|
||||||
|
|
||||||
|
Examplesx:
|
||||||
|
|
||||||
|
make lib-colvars args="-m g++" # build COLVARS lib with GNU g++ compiler
|
||||||
|
make lib-meam args="-m ifort" # build MEAM lib with Intel ifort compiler
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# print error message or help
|
# print error message or help
|
||||||
|
|
|
@ -8,14 +8,17 @@ import sys,os,re,commands
|
||||||
# help message
|
# help message
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
Syntax: python Install.py -i isuffix -h hdir -a arch -p precision -e esuffix -m -o osuffix
|
Syntax from src dir: make lib-gpu args="-i isuffix -h hdir -a arch -p precision -e esuffix -m -o osuffix"
|
||||||
specify one or more options, order does not matter
|
Syntax from lib dir: python Install.py -i isuffix -h hdir -a arch -p precision -e esuffix -m -o osuffix
|
||||||
copies an existing Makefile.isuffix in lib/gpu to Makefile.auto
|
|
||||||
optionally edits these variables in Makefile.auto:
|
specify one or more options, order does not matter
|
||||||
CUDA_HOME, CUDA_ARCH, CUDA_PRECISION, EXTRAMAKE
|
|
||||||
optionally uses Makefile.auto to build the GPU library -> libgpu.a
|
copies an existing Makefile.isuffix in lib/gpu to Makefile.auto
|
||||||
and to copy a Makefile.lammps.esuffix -> Makefile.lammps
|
optionally edits these variables in Makefile.auto:
|
||||||
optionally copies Makefile.auto to a new Makefile.osuffix
|
CUDA_HOME, CUDA_ARCH, CUDA_PRECISION, EXTRAMAKE
|
||||||
|
optionally uses Makefile.auto to build the GPU library -> libgpu.a
|
||||||
|
and to copy a Makefile.lammps.esuffix -> Makefile.lammps
|
||||||
|
optionally copies Makefile.auto to a new Makefile.osuffix
|
||||||
|
|
||||||
-i = use Makefile.isuffix as starting point, copy to Makefile.auto
|
-i = use Makefile.isuffix as starting point, copy to Makefile.auto
|
||||||
default isuffix = linux
|
default isuffix = linux
|
||||||
|
@ -34,6 +37,12 @@ Syntax: python Install.py -i isuffix -h hdir -a arch -p precision -e esuffix -m
|
||||||
also copies EXTRAMAKE file -> Makefile.lammps
|
also copies EXTRAMAKE file -> Makefile.lammps
|
||||||
-e can set which Makefile.lammps.esuffix file is copied
|
-e can set which Makefile.lammps.esuffix file is copied
|
||||||
-o = copy final Makefile.auto to Makefile.osuffix
|
-o = copy final Makefile.auto to Makefile.osuffix
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
make lib-gpu args="-m" # build GPU lib with default Makefile.linux
|
||||||
|
make lib-gpu args="-i xk7 -p single -o xk7.single" # create new Makefile.xk7.single, altered for single-precision
|
||||||
|
make lib-gpu args="-i xk7 -p single -o xk7.single -m" # ditto, also build GPU lib
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# print error message or help
|
# print error message or help
|
||||||
|
|
|
@ -1,150 +1,232 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
# install.py tool to setup the kim-api library
|
# install.pa tool to setup the kim-api library
|
||||||
# used to automate the steps described in the README file in this dir
|
# used to automate the steps described in the README file in this dir
|
||||||
|
from __future__ import print_function
|
||||||
import sys,os,re,urllib,commands
|
import sys,os,re,subprocess
|
||||||
|
try: from urllib.request import urlretrieve as geturl
|
||||||
|
except: from urllib import urlretrieve as geturl
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
Syntax: install.py -v version -c kim-dir -b kim-model-name -a kim-name
|
Syntax from src dir: make lib-kim args="-v version -b kim-install-dir kim-name -a kim-name"
|
||||||
specify one or more options, order does not matter
|
Syntax from lib dir: python Install.py -v version -b kim-install-dir kim-name -a kim-name
|
||||||
-v = version of kim-api to download and work with
|
|
||||||
default = kim-api-v1.8.2 (current as of June 2017)
|
specify one or more options, order does not matter
|
||||||
-c = create Makefile.KIM_DIR within lammps lib/kim to configure lammps
|
|
||||||
for use with the kim-api library installed at "kim-dir" (absolute
|
-v = version of KIM API library to use
|
||||||
path). default = this dir
|
default = kim-api-v1.8.2 (current as of June 2017)
|
||||||
-b = build kim-api and kim model where kim-model-name can be a specific
|
-b = download and build KIM API library with KIM models
|
||||||
openkim.org model name (such as
|
kim-dir = where to install/build the KIM API library
|
||||||
"EAM_Dynamo_Ackland_W__MO_141627196590_002") or the keyword
|
use "." to install in lib/kim
|
||||||
"OpenKIM" to install all compatible models from the openkim.org
|
kim-name = none to install only the example KIM models
|
||||||
site.
|
kim-name = KIM model name (see example below) + examples
|
||||||
-a = add kim-name openkim.org item (model driver or model) to existing
|
kim-name = OpenKIM to install all models
|
||||||
kim-api instalation.
|
from the openkim.org site (this can take 30 minutes or more)
|
||||||
|
-a = add single KIM model or model driver with kim-name
|
||||||
|
to existing KIM API lib (see example below)
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
make lib-kim args="-b . none" # install KIM API lib with only example models
|
||||||
|
make lib-kim args="-b . Glue_Ercolessi_Adams_Al__MO_324507536345_001" # ditto plus one model
|
||||||
|
make lib-kim args="-b . OpenKIM" # install KIM API lib with all models
|
||||||
|
make lib-kim args="-a EAM_Dynamo_Ackland_W__MO_141627196590_002" # 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():
|
def error():
|
||||||
print help
|
print(help)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
# parse args
|
# parse args
|
||||||
|
|
||||||
args = sys.argv
|
args = sys.argv[1:]
|
||||||
|
nargs = len(args)
|
||||||
|
if nargs == 0: error()
|
||||||
|
|
||||||
thisdir = os.environ['PWD']
|
thisdir = os.environ['PWD']
|
||||||
dir = thisdir
|
|
||||||
version = "kim-api-v1.8.2"
|
version = "kim-api-v1.8.2"
|
||||||
|
|
||||||
dirflag = 0
|
buildflag = False
|
||||||
buildflag = 0
|
addflag = False
|
||||||
addflag = 0
|
|
||||||
|
|
||||||
iarg = 1
|
iarg = 0
|
||||||
while iarg < len(args):
|
while iarg < len(args):
|
||||||
if args[iarg] == "-v":
|
if args[iarg] == "-v":
|
||||||
if iarg+2 > len(args): error()
|
if iarg+2 > len(args): error()
|
||||||
version = args[iarg+1]
|
version = args[iarg+1]
|
||||||
iarg += 2
|
iarg += 2
|
||||||
elif args[iarg] == "-c":
|
|
||||||
dirflag = 1
|
|
||||||
if iarg+2 > len(args): error()
|
|
||||||
dir = args[iarg+1]
|
|
||||||
iarg += 2
|
|
||||||
elif args[iarg] == "-b":
|
elif args[iarg] == "-b":
|
||||||
buildflag = 1
|
buildflag = True
|
||||||
if iarg+2 > len(args): error()
|
if iarg+3 > len(args): error()
|
||||||
modelname = args[iarg+1]
|
dir = args[iarg+1]
|
||||||
iarg += 2
|
modelname = args[iarg+2]
|
||||||
|
iarg += 3
|
||||||
elif args[iarg] == "-a":
|
elif args[iarg] == "-a":
|
||||||
addflag = 1
|
addflag = True
|
||||||
if iarg+2 > len(args): error()
|
if iarg+2 > len(args): error()
|
||||||
addmodelname = args[iarg+1]
|
addmodelname = args[iarg+1]
|
||||||
iarg += 2
|
iarg += 2
|
||||||
else: error()
|
else: error()
|
||||||
|
|
||||||
thisdir = os.path.abspath(thisdir)
|
thisdir = os.path.abspath(thisdir)
|
||||||
dir = os.path.abspath(dir)
|
|
||||||
url = "https://s3.openkim.org/kim-api/%s.tgz" % version
|
url = "https://s3.openkim.org/kim-api/%s.tgz" % version
|
||||||
|
|
||||||
# download and unpack tarball
|
# download KIM tarball, unpack, build KIM
|
||||||
|
# either in lib/kim or user-requested location
|
||||||
|
|
||||||
|
if buildflag:
|
||||||
|
|
||||||
if not os.path.isfile("%s/Makefile.KIM_DIR" % thisdir):
|
# set install directory
|
||||||
open("%s/Makefile.KIM_DIR" % thisdir, 'w').write("KIM_INSTALL_DIR=%s" % dir)
|
|
||||||
open("%s/Makefile.KIM_Config" % thisdir, 'w').write("include %s/lib/kim-api/Makefile.KIM_Config" % dir)
|
|
||||||
print "Created %s/Makefile.KIM_DIR : using %s" % (thisdir,dir)
|
|
||||||
else:
|
|
||||||
if dirflag == 1:
|
|
||||||
open("%s/Makefile.KIM_DIR" % thisdir, 'w').write("KIM_INSTALL_DIR=%s" % dir)
|
|
||||||
open("%s/Makefile.KIM_Config" % thisdir, 'w').write("include %s/lib/kim-api/Makefile.KIM_Config" % dir)
|
|
||||||
print "Updated %s/Makefile.KIM_DIR : using %s" % (thisdir,dir)
|
|
||||||
|
|
||||||
|
dir = os.path.join(os.path.abspath(dir), "installed-" + version)
|
||||||
|
|
||||||
if buildflag == 1:
|
# check to see if an installed kim-api already exists and wipe it out.
|
||||||
# download kim-api
|
|
||||||
print "Downloading kim-api tarball ..."
|
if os.path.isdir(dir):
|
||||||
urllib.urlretrieve(url,"%s/%s.tgz" % (thisdir,version))
|
print("kim-api is already installed at %s.\nRemoving it for re-install" % dir)
|
||||||
print "Unpacking kim-api tarball ..."
|
cmd = "rm -rf %s" % dir
|
||||||
|
subprocess.check_output(cmd,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" % dir)
|
||||||
|
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" % dir)
|
||||||
|
|
||||||
|
print("Created %s/Makefile.KIM_DIR : using %s" % (thisdir,dir))
|
||||||
|
|
||||||
|
# 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 zxvf %s.tgz" % (thisdir,version,version)
|
||||||
txt = commands.getstatusoutput(cmd)
|
subprocess.check_output(cmd,shell=True)
|
||||||
if txt[0] != 0: error()
|
|
||||||
|
|
||||||
# configure kim-api
|
# configure kim-api
|
||||||
print "Configuring kim-api ..."
|
|
||||||
|
print("Configuring kim-api ...")
|
||||||
cmd = "cd %s/%s; ./configure --prefix='%s'" % (thisdir,version,dir)
|
cmd = "cd %s/%s; ./configure --prefix='%s'" % (thisdir,version,dir)
|
||||||
txt = commands.getstatusoutput(cmd)
|
subprocess.check_output(cmd,shell=True)
|
||||||
print txt[1]
|
|
||||||
if txt[0] != 0: error()
|
|
||||||
|
|
||||||
# build kim-api
|
# build kim-api
|
||||||
print "Configuring model : %s" % modelname
|
|
||||||
cmd = "cd %s/%s; make add-%s" % (thisdir,version,modelname)
|
print("Configuring model : %s" % modelname)
|
||||||
txt = commands.getstatusoutput(cmd)
|
if modelname == "none":
|
||||||
print txt[1]
|
cmd = "cd %s/%s; make add-examples" % (thisdir,version)
|
||||||
if txt[0] != 0: error()
|
else:
|
||||||
#
|
if modelname == "OpenKIM":
|
||||||
print "Building kim-api ..."
|
print("configuring all OpenKIM models, this will take a while ...")
|
||||||
|
cmd = "cd %s/%s; make add-examples; make add-%s" % \
|
||||||
|
(thisdir,version,modelname)
|
||||||
|
subprocess.check_output(cmd,shell=True)
|
||||||
|
|
||||||
|
print("Building kim-api ...")
|
||||||
cmd = "cd %s/%s; make" % (thisdir,version)
|
cmd = "cd %s/%s; make" % (thisdir,version)
|
||||||
txt = commands.getstatusoutput(cmd)
|
subprocess.check_output(cmd,shell=True)
|
||||||
print txt[1]
|
|
||||||
if txt[0] != 0: error()
|
|
||||||
|
|
||||||
# install kim-api
|
# install kim-api
|
||||||
print "Installing kim-api ..."
|
|
||||||
|
print("Installing kim-api ...")
|
||||||
cmd = "cd %s/%s; make install" % (thisdir,version)
|
cmd = "cd %s/%s; make install" % (thisdir,version)
|
||||||
txt = commands.getstatusoutput(cmd)
|
subprocess.check_output(cmd,shell=True)
|
||||||
print txt[1]
|
|
||||||
if txt[0] != 0: error()
|
|
||||||
#
|
|
||||||
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 = commands.getstatusoutput(cmd)
|
subprocess.check_output(cmd,shell=True)
|
||||||
print txt[1]
|
|
||||||
if txt[0] != 0: error()
|
|
||||||
|
|
||||||
# remove source files
|
# remove source files
|
||||||
print "Removing kim-api source and build files ..."
|
|
||||||
cmd = "cd %s; rm -rf %s; rm -rf %s.tgz" % (thisdir,version,version)
|
|
||||||
txt = commands.getstatusoutput(cmd)
|
|
||||||
print txt[1]
|
|
||||||
if txt[0] != 0: error()
|
|
||||||
|
|
||||||
if addflag == 1:
|
print("Removing kim-api source and build files ...")
|
||||||
# download model
|
cmd = "cd %s; rm -rf %s; rm -rf %s.tgz" % (thisdir,version,version)
|
||||||
|
subprocess.check_output(cmd,shell=True)
|
||||||
|
|
||||||
|
# add a single model (and possibly its driver) to existing KIM installation
|
||||||
|
|
||||||
|
if addflag:
|
||||||
|
|
||||||
|
# get location of installed kim-api
|
||||||
|
|
||||||
|
if not os.path.isfile("%s/Makefile.KIM_DIR" % thisdir):
|
||||||
|
print("kim-api is not installed")
|
||||||
|
error()
|
||||||
|
else:
|
||||||
|
cmd = "cd %s; make -f Makefile.KIM_DIR print_dir" % thisdir
|
||||||
|
dir = subprocess.check_output(cmd,shell=True)[1]
|
||||||
|
|
||||||
|
# download single model
|
||||||
|
# try first via urllib
|
||||||
|
# if fails (probably due to no SSL support), use wget
|
||||||
|
|
||||||
|
print("Downloading item tarball ...")
|
||||||
url = "https://openkim.org/download/%s.tgz" % addmodelname
|
url = "https://openkim.org/download/%s.tgz" % addmodelname
|
||||||
print "Downloading item tarball ..."
|
geturl(url,"%s/%s.tgz" % (thisdir,addmodelname))
|
||||||
urllib.urlretrieve(url,"%s/%s.tgz" % (thisdir,addmodelname))
|
|
||||||
print "Unpacking item tarball ..."
|
print("Unpacking item tarball ...")
|
||||||
cmd = "cd %s; tar zxvf %s.tgz" % (thisdir,addmodelname)
|
cmd = "cd %s; tar zxvf %s.tgz" % (thisdir,addmodelname)
|
||||||
txt = commands.getstatusoutput(cmd)
|
subprocess.check_output(cmd,shell=True)
|
||||||
if txt[0] != 0: error()
|
|
||||||
#
|
print("Building item ...")
|
||||||
print "Building item ..."
|
|
||||||
cmd = "cd %s/%s; make; make install" %(thisdir,addmodelname)
|
cmd = "cd %s/%s; make; make install" %(thisdir,addmodelname)
|
||||||
txt = commands.getstatusoutput(cmd)
|
try:
|
||||||
print txt[1]
|
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||||
if txt[0] != 0: error()
|
except subprocess.CalledProcessError as e:
|
||||||
#
|
|
||||||
print "Removing kim item source and build files ..."
|
# Error: but first, check to see if it needs a driver
|
||||||
|
firstRunOutput = e.output.decode()
|
||||||
|
|
||||||
|
cmd = "cd %s/%s; make kim-item-type" % (thisdir,addmodelname)
|
||||||
|
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||||
|
txt = txt.decode().strip()
|
||||||
|
if txt == "ParameterizedModel":
|
||||||
|
|
||||||
|
# Get and install driver
|
||||||
|
|
||||||
|
cmd = "cd %s/%s; make model-driver-name" % (thisdir,addmodelname)
|
||||||
|
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||||
|
adddrivername = txt.decode().strip()
|
||||||
|
print("First installing model driver: %s" % adddrivername)
|
||||||
|
cmd = "cd %s; python Install.py -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()
|
||||||
|
|
||||||
|
# now install the model that needed the driver
|
||||||
|
|
||||||
|
print("Now installing model : %s" % addmodelname)
|
||||||
|
cmd = "cd %s; python Install.py -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())
|
||||||
|
sys.exit()
|
||||||
|
else:
|
||||||
|
print(firstRunOutput)
|
||||||
|
print("Error, unable to build and install OpenKIM item: %s" \
|
||||||
|
% addmodelname)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
# success the first time
|
||||||
|
|
||||||
|
print(txt)
|
||||||
|
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)
|
||||||
txt = commands.getstatusoutput(cmd)
|
subprocess.check_output(cmd,shell=True)
|
||||||
print txt[1]
|
|
||||||
if txt[0] != 0: error()
|
|
||||||
|
|
|
@ -8,14 +8,16 @@ James Sethna (Cornell U). Ryan Elliott is the main developer for the
|
||||||
KIM API and he also maintains the code that implements the pair_style
|
KIM API and he also maintains the code that implements the pair_style
|
||||||
kim command.
|
kim command.
|
||||||
|
|
||||||
To download, build, and install the KIM API on your system, follow
|
You can type "make lib-kim" from the src directory to see help on
|
||||||
these steps. You can use the install.py script to automate these steps.
|
how to download and 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.
|
||||||
|
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Instructions:
|
Instructions:
|
||||||
|
|
||||||
|
|
||||||
1. Configure lammps for use with the kim-api library installed in this directory
|
1. Configure lammps for use with the kim-api library installed in this directory
|
||||||
|
|
||||||
$ printf "KIM_INSTALL_DIR=${PWD}\n" > ./Makefile.KIM_DIR
|
$ printf "KIM_INSTALL_DIR=${PWD}\n" > ./Makefile.KIM_DIR
|
||||||
|
@ -65,7 +67,7 @@ $ rm -rf EAM_Johnson_NearestNeighbor_Cu__MO_887933271505_001.tgz
|
||||||
When these steps are complete you can build LAMMPS with the KIM
|
When these steps are complete you can build LAMMPS with the KIM
|
||||||
package installed:
|
package installed:
|
||||||
|
|
||||||
$ cd ../../src
|
$ cd lammpos/src
|
||||||
$ make yes-kim
|
$ make yes-kim
|
||||||
$ make g++ (or whatever target you wish)
|
$ make g++ (or whatever target you wish)
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,15 @@ import sys,commands,os
|
||||||
# help message
|
# help message
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
Syntax: python Install.py -m machine
|
Syntax from src dir: make lib-linalg args="-m machine"
|
||||||
|
Syntax from lib dir: python Install.py -m machine
|
||||||
|
|
||||||
-m = peform a clean followed by "make -f Makefile.machine"
|
-m = peform a clean followed by "make -f Makefile.machine"
|
||||||
machine = suffix of a lib/Makefile.* file
|
machine = suffix of a lib/Makefile.* file
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
make lib-linalg args="-m gfortran" # build with GNU Fortran compiler
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# print error message or help
|
# print error message or help
|
||||||
|
|
|
@ -8,8 +8,11 @@ import sys,os,re,commands
|
||||||
# help message
|
# help message
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
Syntax: python Install.py -h hpath hdir -g -b [suffix] -l
|
Syntax from src dir: make lib-mscg args="-h hpath hdir -g -b [suffix] -l"
|
||||||
specify one or more options, order does not matter
|
Syntax from lib dir: python Install.py -h hpath hdir -g -b [suffix] -l
|
||||||
|
|
||||||
|
specify one or more options, order does not matter
|
||||||
|
|
||||||
-h = set home dir of MS-CG to be hpath/hdir
|
-h = set home dir of MS-CG to be hpath/hdir
|
||||||
hpath can be full path, contain '~' or '.' chars
|
hpath can be full path, contain '~' or '.' chars
|
||||||
default hpath = . = lib/mscg
|
default hpath = . = lib/mscg
|
||||||
|
@ -22,6 +25,10 @@ Syntax: python Install.py -h hpath hdir -g -b [suffix] -l
|
||||||
optional suffix specifies which src/Make/Makefile.suffix to use
|
optional suffix specifies which src/Make/Makefile.suffix to use
|
||||||
default suffix = g++_simple
|
default suffix = g++_simple
|
||||||
-l = create 2 softlinks (includelink,liblink) in lib/mscg to MS-CG src dir
|
-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
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# settings
|
# settings
|
||||||
|
|
|
@ -3,13 +3,19 @@
|
||||||
# Install.py tool to download, unpack, and point to the Eigen library
|
# 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
|
# used to automate the steps described in the README file in this dir
|
||||||
|
|
||||||
import sys,os,re,glob,commands
|
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 message
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
Syntax: python Install.py -h hpath hdir -g -l
|
Syntax from src dir: make lib-smd args="-h hpath hdir -g -l"
|
||||||
specify one or more options, order does not matter
|
Syntax from lib dir: python Install.py -h hpath hdir -g -l
|
||||||
|
|
||||||
|
specify one or more options, order does not matter
|
||||||
|
|
||||||
-h = set home dir of Eigen to be hpath/hdir
|
-h = set home dir of Eigen to be hpath/hdir
|
||||||
hpath can be full path, contain '~' or '.' chars
|
hpath can be full path, contain '~' or '.' chars
|
||||||
default hpath = . = lib/smd
|
default hpath = . = lib/smd
|
||||||
|
@ -19,18 +25,23 @@ Syntax: python Install.py -h hpath hdir -g -l
|
||||||
hpath must already exist
|
hpath must already exist
|
||||||
if hdir already exists, it will be deleted before unpack
|
if hdir already exists, it will be deleted before unpack
|
||||||
-l = create softlink (includelink) in lib/smd to Eigen src dir
|
-l = create softlink (includelink) in lib/smd to Eigen src dir
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
make lib-smd args="-g -l" # download/build in default lib/smd/eigen-eigen-*
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# settings
|
# settings
|
||||||
|
|
||||||
url = "http://bitbucket.org/eigen/eigen/get/3.3.3.tar.gz"
|
version = '3.3.4'
|
||||||
|
url = "http://bitbucket.org/eigen/eigen/get/%s.tar.gz" % version
|
||||||
tarball = "eigen.tar.gz"
|
tarball = "eigen.tar.gz"
|
||||||
|
|
||||||
# print error message or help
|
# print error message or help
|
||||||
|
|
||||||
def error(str=None):
|
def error(str=None):
|
||||||
if not str: print help
|
if not str: print(help)
|
||||||
else: print "ERROR",str
|
else: print("ERROR",str)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
# expand to full path name
|
# expand to full path name
|
||||||
|
@ -73,26 +84,26 @@ if not os.path.isdir(homepath): error("Eigen path does not exist")
|
||||||
# glob to find name of dir it unpacks to
|
# glob to find name of dir it unpacks to
|
||||||
|
|
||||||
if grabflag:
|
if grabflag:
|
||||||
print "Downloading Eigen ..."
|
print("Downloading Eigen ...")
|
||||||
cmd = "curl -L %s > %s/%s" % (url,homepath,tarball)
|
geturl(url,"%s/%s" % (homepath,tarball))
|
||||||
print cmd
|
|
||||||
print commands.getoutput(cmd)
|
|
||||||
|
|
||||||
print "Unpacking Eigen tarball ..."
|
print("Unpacking Eigen tarball ...")
|
||||||
edir = glob.glob("%s/eigen-eigen-*" % homepath)
|
edir = glob.glob("%s/eigen-eigen-*" % homepath)
|
||||||
for one in edir:
|
for one in edir:
|
||||||
if os.path.isdir(one): commands.getoutput("rm -rf %s" % one)
|
if os.path.isdir(one):
|
||||||
cmd = "cd %s; tar zxvf %s" % (homepath,tarball)
|
subprocess.check_output("rm -rf %s" % one,shell=True)
|
||||||
commands.getoutput(cmd)
|
cmd = 'cd "%s"; tar -xzvf %s' % (homepath,tarball)
|
||||||
|
subprocess.check_output(cmd,shell=True)
|
||||||
if homedir != "ee":
|
if homedir != "ee":
|
||||||
if os.path.exists(homedir): commands.getoutput("rm -rf %s" % homedir)
|
if os.path.exists(homedir):
|
||||||
|
subprocess.check_output("rm -rf %s" % homedir,shell=True)
|
||||||
edir = glob.glob("%s/eigen-eigen-*" % homepath)
|
edir = glob.glob("%s/eigen-eigen-*" % homepath)
|
||||||
os.rename(edir[0],"%s/%s" % (homepath,homedir))
|
os.rename(edir[0],"%s/%s" % (homepath,homedir))
|
||||||
|
|
||||||
# create link in lib/smd to Eigen src dir
|
# create link in lib/smd to Eigen src dir
|
||||||
|
|
||||||
if linkflag:
|
if linkflag:
|
||||||
print "Creating link to Eigen files"
|
print("Creating link to Eigen files")
|
||||||
if os.path.isfile("includelink") or os.path.islink("includelink"):
|
if os.path.isfile("includelink") or os.path.islink("includelink"):
|
||||||
os.remove("includelink")
|
os.remove("includelink")
|
||||||
if homedir == "ee":
|
if homedir == "ee":
|
||||||
|
@ -100,4 +111,4 @@ if linkflag:
|
||||||
linkdir = edir[0]
|
linkdir = edir[0]
|
||||||
else: linkdir = "%s/%s" % (homepath,homedir)
|
else: linkdir = "%s/%s" % (homepath,homedir)
|
||||||
cmd = "ln -s %s includelink" % linkdir
|
cmd = "ln -s %s includelink" % linkdir
|
||||||
commands.getoutput(cmd)
|
subprocess.check_output(cmd,shell=True)
|
||||||
|
|
|
@ -2,14 +2,19 @@
|
||||||
|
|
||||||
# Install.py tool to download, unpack, build, and link to the Voro++ library
|
# 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
|
# used to automate the steps described in the README file in this dir
|
||||||
|
from __future__ import print_function
|
||||||
import sys,os,re,urllib,commands
|
import sys,os,re,subprocess
|
||||||
|
try: from urllib.request import urlretrieve as geturl
|
||||||
|
except: from urllib import urlretrieve as geturl
|
||||||
|
|
||||||
# help message
|
# help message
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
Syntax: python Install.py -v version -h hpath hdir -g -b -l
|
Syntax from src dir: make lib-voronoi args="-v version -h hpath hdir -g -b -l"
|
||||||
specify one or more options, order does not matter
|
Syntax from lib dir: python Install.py -v version -h hpath hdir -g -b -l
|
||||||
|
|
||||||
|
specify one or more options, order does not matter
|
||||||
|
|
||||||
-v = version of Voro++ to download and build
|
-v = version of Voro++ to download and build
|
||||||
default version = voro++-0.4.6 (current as of Jan 2015)
|
default version = voro++-0.4.6 (current as of Jan 2015)
|
||||||
-h = set home dir of Voro++ to be hpath/hdir
|
-h = set home dir of Voro++ to be hpath/hdir
|
||||||
|
@ -22,6 +27,10 @@ Syntax: python Install.py -v version -h hpath hdir -g -b -l
|
||||||
if hdir already exists, it will be deleted before unpack
|
if hdir already exists, it will be deleted before unpack
|
||||||
-b = build Voro++ library in its src dir
|
-b = build Voro++ library in its src dir
|
||||||
-l = create 2 softlinks (includelink,liblink) in lib/voronoi to Voro++ src dir
|
-l = create 2 softlinks (includelink,liblink) in lib/voronoi to Voro++ src dir
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
make lib-voronoi args="-g -b -l" # download/build in lib/voronoi/voro++-0.4.6
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# settings
|
# settings
|
||||||
|
@ -32,8 +41,8 @@ url = "http://math.lbl.gov/voro++/download/dir/%s.tar.gz" % version
|
||||||
# print error message or help
|
# print error message or help
|
||||||
|
|
||||||
def error(str=None):
|
def error(str=None):
|
||||||
if not str: print help
|
if not str: print(help)
|
||||||
else: print "ERROR",str
|
else: print("ERROR",str)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
# expand to full path name
|
# expand to full path name
|
||||||
|
@ -51,9 +60,9 @@ if nargs == 0: error()
|
||||||
homepath = "."
|
homepath = "."
|
||||||
homedir = version
|
homedir = version
|
||||||
|
|
||||||
grabflag = 0
|
grabflag = False
|
||||||
buildflag = 0
|
buildflag = False
|
||||||
linkflag = 0
|
linkflag = False
|
||||||
|
|
||||||
iarg = 0
|
iarg = 0
|
||||||
while iarg < nargs:
|
while iarg < nargs:
|
||||||
|
@ -67,13 +76,13 @@ while iarg < nargs:
|
||||||
homedir = args[iarg+2]
|
homedir = args[iarg+2]
|
||||||
iarg += 3
|
iarg += 3
|
||||||
elif args[iarg] == "-g":
|
elif args[iarg] == "-g":
|
||||||
grabflag = 1
|
grabflag = True
|
||||||
iarg += 1
|
iarg += 1
|
||||||
elif args[iarg] == "-b":
|
elif args[iarg] == "-b":
|
||||||
buildflag = 1
|
buildflag = True
|
||||||
iarg += 1
|
iarg += 1
|
||||||
elif args[iarg] == "-l":
|
elif args[iarg] == "-l":
|
||||||
linkflag = 1
|
linkflag = True
|
||||||
iarg += 1
|
iarg += 1
|
||||||
else: error()
|
else: error()
|
||||||
|
|
||||||
|
@ -84,35 +93,38 @@ homedir = "%s/%s" % (homepath,homedir)
|
||||||
# download and unpack Voro++ tarball
|
# download and unpack Voro++ tarball
|
||||||
|
|
||||||
if grabflag:
|
if grabflag:
|
||||||
print "Downloading Voro++ ..."
|
print("Downloading Voro++ ...")
|
||||||
urllib.urlretrieve(url,"%s/%s.tar.gz" % (homepath,version))
|
geturl(url,"%s/%s.tar.gz" % (homepath,version))
|
||||||
|
|
||||||
print "Unpacking Voro++ tarball ..."
|
print("Unpacking Voro++ tarball ...")
|
||||||
if os.path.exists("%s/%s" % (homepath,version)):
|
if os.path.exists("%s/%s" % (homepath,version)):
|
||||||
commands.getoutput("rm -rf %s/%s" % (homepath,version))
|
cmd = 'rm -rf "%s/%s"' % (homepath,version)
|
||||||
cmd = "cd %s; tar zxvf %s.tar.gz" % (homepath,version)
|
subprocess.check_output(cmd,shell=True)
|
||||||
commands.getoutput(cmd)
|
cmd = 'cd "%s"; tar -xzvf %s.tar.gz' % (homepath,version)
|
||||||
|
subprocess.check_output(cmd,shell=True)
|
||||||
if os.path.basename(homedir) != version:
|
if os.path.basename(homedir) != version:
|
||||||
if os.path.exists(homedir): commands.getoutput("rm -rf %s" % homedir)
|
if os.path.exists(homedir):
|
||||||
|
cmd = 'rm -rf "%s"' % homedir
|
||||||
|
subprocess.check_output(cmd,shell=True)
|
||||||
os.rename("%s/%s" % (homepath,version),homedir)
|
os.rename("%s/%s" % (homepath,version),homedir)
|
||||||
|
|
||||||
# build Voro++
|
# build Voro++
|
||||||
|
|
||||||
if buildflag:
|
if buildflag:
|
||||||
print "Building Voro++ ..."
|
print("Building Voro++ ...")
|
||||||
cmd = "cd %s; make" % homedir
|
cmd = 'cd "%s"; make' % homedir
|
||||||
txt = commands.getoutput(cmd)
|
txt = subprocess.check_output(cmd,shell=True)
|
||||||
print txt
|
print(txt)
|
||||||
|
|
||||||
# create 2 links in lib/voronoi to Voro++ src dir
|
# create 2 links in lib/voronoi to Voro++ src dir
|
||||||
|
|
||||||
if linkflag:
|
if linkflag:
|
||||||
print "Creating links to Voro++ include and lib files"
|
print("Creating links to Voro++ include and lib files")
|
||||||
if os.path.isfile("includelink") or os.path.islink("includelink"):
|
if os.path.isfile("includelink") or os.path.islink("includelink"):
|
||||||
os.remove("includelink")
|
os.remove("includelink")
|
||||||
if os.path.isfile("liblink") or os.path.islink("liblink"):
|
if os.path.isfile("liblink") or os.path.islink("liblink"):
|
||||||
os.remove("liblink")
|
os.remove("liblink")
|
||||||
cmd = "ln -s %s/src includelink" % homedir
|
cmd = ['ln -s "%s/src" includelink' % homedir, 'includelink']
|
||||||
commands.getoutput(cmd)
|
subprocess.check_output(cmd,shell=True)
|
||||||
cmd = "ln -s %s/src liblink" % homedir
|
cmd = ['ln -s "%s/src" liblink' % homedir]
|
||||||
commands.getoutput(cmd)
|
subprocess.check_output(cmd,shell=True)
|
||||||
|
|
|
@ -116,7 +116,8 @@ help:
|
||||||
@echo 'make package-overwrite replace package files with src files'
|
@echo 'make package-overwrite replace package files with src files'
|
||||||
@echo 'make package-diff (pd) diff src files against package files'
|
@echo 'make package-diff (pd) diff src files against package files'
|
||||||
@echo ''
|
@echo ''
|
||||||
@echo 'make lib-package download/build/install a package library'
|
@echo 'make lib-package help for download/build/install a package library'
|
||||||
|
@echo 'make lib-package args="..." download/build/install a package library'
|
||||||
@echo 'make purge purge obsolete copies of source files'
|
@echo 'make purge purge obsolete copies of source files'
|
||||||
@echo ''
|
@echo ''
|
||||||
@echo 'make machine build LAMMPS for machine'
|
@echo 'make machine build LAMMPS for machine'
|
||||||
|
|
Loading…
Reference in New Issue