From a5da3aa1ce77c7e66e42e984d078809bd137f90a Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 31 May 2013 15:17:46 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9987 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/Depend.sh | 73 ++++++++++++++++++++---------------- src/GPU/Install.sh | 2 +- src/Install.sh | 2 +- src/KIM/Install.sh | 2 +- src/MEAM/Install.sh | 2 +- src/OPT/Install.sh | 2 +- src/POEMS/Install.sh | 2 +- src/Package.sh | 14 +++---- src/REAX/Install.sh | 2 +- src/USER-ATC/Install.sh | 2 +- src/USER-AWPMD/Install.sh | 2 +- src/USER-CG-CMM/Install.sh | 2 +- src/USER-COLVARS/Install.sh | 2 +- src/USER-CUDA/Install.sh | 2 +- src/USER-MISC/Install.sh | 74 ++++++------------------------------- src/USER-MOLFILE/Install.sh | 2 +- src/USER-OMP/Install.sh | 62 ++++++++++++++++++++----------- src/USER-OMP/Package.sh | 40 -------------------- src/VORONOI/Install.sh | 2 +- 19 files changed, 115 insertions(+), 176 deletions(-) delete mode 100644 src/USER-OMP/Package.sh diff --git a/src/Depend.sh b/src/Depend.sh index 66e674286a..0f78b0bd20 100644 --- a/src/Depend.sh +++ b/src/Depend.sh @@ -12,10 +12,9 @@ # decisions on (un)installing individual child files are made by # the Install.sh script in the child package -# depend function: args = child-package 0/1 +# depend function: args = child-package # checks if child-package is installed, if not just return -# if parent package is being installed, reinstall the child -# if parent package is being uninstalled, uninstall the child, reinstall it +# otherwise update child package according to its dependencies depend () { cd $1 @@ -31,11 +30,11 @@ depend () { return fi - echo " re-installing package $1" + echo " updating package $1" if (test -e $1/Install.sh) then - cd $1; /bin/sh Install.sh 1; cd .. + cd $1; /bin/sh Install.sh 2; cd .. else - cd $1; /bin/sh ../Install.sh 1; cd .. + cd $1; /bin/sh ../Install.sh 2; cd .. fi } @@ -45,57 +44,69 @@ depend () { # GPU, OPT, USER-CUDA, USER-MISC, USER-OMP if (test $1 = "ASPHERE") then - depend GPU $2 - depend USER-OMP $2 + depend GPU + depend USER-OMP fi if (test $1 = "CLASS2") then - depend GPU $2 - depend USER-CUDA $2 - depend USER-OMP $2 + depend GPU + depend USER-CUDA + depend USER-OMP fi if (test $1 = "COLLOID") then - depend GPU $2 - depend USER-OMP $2 + depend GPU + depend USER-OMP +fi + +if (test $1 = "DIPOLE") then + depend USER-MISC + depend USER-OMP fi if (test $1 = "GRANULAR") then - depend USER-CUDA $2 - depend USER-OMP $2 + depend USER-CUDA + depend USER-OMP fi if (test $1 = "KSPACE") then - depend GPU $2 - depend OPT $2 - depend USER-CUDA $2 - depend USER-OMP $2 + depend GPU + depend OPT + depend USER-CUDA + depend USER-OMP fi if (test $1 = "MANYBODY") then - depend GPU $2 - depend OPT $2 - depend USER-CUDA $2 - depend USER-MISC $2 - depend USER-OMP $2 + depend GPU + depend OPT + depend USER-CUDA + depend USER-MISC + depend USER-OMP +fi + +if (test $1 = "MOLECULE") then + depend GPU + depend USER-CUDA + depend USER-MISC + depend USER-OMP fi if (test $1 = "PERI") then - depend USER-OMP $2 + depend USER-OMP fi if (test $1 = "RIGID") then - depend USER-OMP $2 + depend USER-OMP fi if (test $1 = "USER-CG-CMM") then - depend GPU $2 - depend USER-CUDA $2 - depend USER-OMP $2 + depend GPU + depend USER-CUDA + depend USER-OMP fi if (test $1 = "USER-MISC") then - depend GPU $2 - depend USER-OMP $2 + depend GPU + depend USER-OMP fi diff --git a/src/GPU/Install.sh b/src/GPU/Install.sh index be89885908..d65574aee3 100644 --- a/src/GPU/Install.sh +++ b/src/GPU/Install.sh @@ -15,7 +15,7 @@ action () { echo " updating src/$1" fi fi - elif (test ! -z "$2") then + elif (test -n "$2") then if (test ! -e ../$2) then rm -f ../$1 fi diff --git a/src/Install.sh b/src/Install.sh index 898e828e7f..322631fce9 100644 --- a/src/Install.sh +++ b/src/Install.sh @@ -19,7 +19,7 @@ action () { echo " updating src/$1" fi fi - elif (test ! -z "$2") then + elif (test -n "$2") then if (test ! -e ../$2) then rm -f ../$1 fi diff --git a/src/KIM/Install.sh b/src/KIM/Install.sh index 8a32fc50fc..df4670400e 100644 --- a/src/KIM/Install.sh +++ b/src/KIM/Install.sh @@ -15,7 +15,7 @@ action () { echo " updating src/$1" fi fi - elif (test ! -z "$2") then + elif (test -n "$2") then if (test ! -e ../$2) then rm -f ../$1 fi diff --git a/src/MEAM/Install.sh b/src/MEAM/Install.sh index d56b1daa4f..acf4c90910 100644 --- a/src/MEAM/Install.sh +++ b/src/MEAM/Install.sh @@ -15,7 +15,7 @@ action () { echo " updating src/$1" fi fi - elif (test ! -z "$2") then + elif (test -n "$2") then if (test ! -e ../$2) then rm -f ../$1 fi diff --git a/src/OPT/Install.sh b/src/OPT/Install.sh index 5976ed9ee4..2374072a69 100644 --- a/src/OPT/Install.sh +++ b/src/OPT/Install.sh @@ -15,7 +15,7 @@ action () { echo " updating src/$1" fi fi - elif (test ! -z "$2") then + elif (test -n "$2") then if (test ! -e ../$2) then rm -f ../$1 fi diff --git a/src/POEMS/Install.sh b/src/POEMS/Install.sh index 5179d098c6..b03792e4f1 100644 --- a/src/POEMS/Install.sh +++ b/src/POEMS/Install.sh @@ -15,7 +15,7 @@ action () { echo " updating src/$1" fi fi - elif (test ! -z "$2") then + elif (test -n "$2") then if (test ! -e ../$2) then rm -f ../$1 fi diff --git a/src/Package.sh b/src/Package.sh index c2ee53586a..839481c1b5 100644 --- a/src/Package.sh +++ b/src/Package.sh @@ -22,7 +22,7 @@ if (test $2 = "status") then for file in *.cpp *.h; do if (test ! -e ../$file) then echo " src/$file does not exist" - elif (test "`diff --brief $file ../$file`" != "") then + elif (! cmp -s $file ../$file) then echo " src/$file and $1/$file are different" fi done @@ -36,14 +36,14 @@ if (test $2 = "status") then elif (test $2 = "update") then echo "Updating src files from $1 package files" if (test $installed = 1) then - echo " re-installing package $1" + echo " updating package $1" if (test -e Install.sh) then - /bin/sh Install.sh 1 + /bin/sh Install.sh 2 else - /bin/sh ../Install.sh 1 + /bin/sh ../Install.sh 2 fi cd .. - /bin/sh Depend.sh $1 1 + /bin/sh Depend.sh $1 else echo " $1 package is not installed" fi @@ -57,7 +57,7 @@ elif (test $2 = "overwrite") then for file in *.cpp *.h; do if (test ! -e ../$file) then continue - elif (test "`diff --brief $file ../$file`" != "") then + elif (! cmp -s $file ../$file) then echo " overwriting $1/$file" cp ../$file . fi @@ -76,7 +76,7 @@ elif (test $2 = "diff") then for file in *.cpp *.h; do if (test ! -e ../$file) then echo " src/$file does not exist" - elif (test "`diff --brief $file ../$file`" != "") then + elif (! cmp -s $file ../$file) then echo "************************************************" echo "diff $1/$file src/$file " echo "************************************************" diff --git a/src/REAX/Install.sh b/src/REAX/Install.sh index 2c3aaf2302..af0f1e2436 100644 --- a/src/REAX/Install.sh +++ b/src/REAX/Install.sh @@ -15,7 +15,7 @@ action () { echo " updating src/$1" fi fi - elif (test ! -z "$2") then + elif (test -n "$2") then if (test ! -e ../$2) then rm -f ../$1 fi diff --git a/src/USER-ATC/Install.sh b/src/USER-ATC/Install.sh index 7659bbf955..197e94e29d 100755 --- a/src/USER-ATC/Install.sh +++ b/src/USER-ATC/Install.sh @@ -15,7 +15,7 @@ action () { echo " updating src/$1" fi fi - elif (test ! -z "$2") then + elif (test -n "$2") then if (test ! -e ../$2) then rm -f ../$1 fi diff --git a/src/USER-AWPMD/Install.sh b/src/USER-AWPMD/Install.sh index ff6e653a06..6fd0718b71 100644 --- a/src/USER-AWPMD/Install.sh +++ b/src/USER-AWPMD/Install.sh @@ -15,7 +15,7 @@ action () { echo " updating src/$1" fi fi - elif (test ! -z "$2") then + elif (test -n "$2") then if (test ! -e ../$2) then rm -f ../$1 fi diff --git a/src/USER-CG-CMM/Install.sh b/src/USER-CG-CMM/Install.sh index 65840bf344..1ae842ab3a 100644 --- a/src/USER-CG-CMM/Install.sh +++ b/src/USER-CG-CMM/Install.sh @@ -15,7 +15,7 @@ action () { echo " updating src/$1" fi fi - elif (test ! -z "$2") then + elif (test -n "$2") then if (test ! -e ../$2) then rm -f ../$1 fi diff --git a/src/USER-COLVARS/Install.sh b/src/USER-COLVARS/Install.sh index 2af8737d9f..a50799f47a 100755 --- a/src/USER-COLVARS/Install.sh +++ b/src/USER-COLVARS/Install.sh @@ -15,7 +15,7 @@ action () { echo " updating src/$1" fi fi - elif (test ! -z "$2") then + elif (test -n "$2") then if (test ! -e ../$2) then rm -f ../$1 fi diff --git a/src/USER-CUDA/Install.sh b/src/USER-CUDA/Install.sh index 0c43de7ef2..eb84139dcf 100755 --- a/src/USER-CUDA/Install.sh +++ b/src/USER-CUDA/Install.sh @@ -15,7 +15,7 @@ action () { echo " updating src/$1" fi fi - elif (test ! -z "$2") then + elif (test -n "$2") then if (test ! -e ../$2) then rm -f ../$1 fi diff --git a/src/USER-MISC/Install.sh b/src/USER-MISC/Install.sh index 4922111395..8b2e864787 100644 --- a/src/USER-MISC/Install.sh +++ b/src/USER-MISC/Install.sh @@ -15,72 +15,22 @@ action () { echo " updating src/$1" fi fi - elif (test ! -z "$2") then + elif (test ! -n "$2") then if (test ! -e ../$2) then rm -f ../$1 fi fi } -# list of files with optional dependencies +# all package files +# only a few files have dependencies -action angle_cosine_shift.cpp -action angle_cosine_shift.h -action angle_cosine_shift_exp.cpp -action angle_cosine_shift_exp.h -action angle_dipole.cpp -action angle_dipole.h -action angle_fourier.cpp -action angle_fourier.h -action angle_fourier_simple.cpp -action angle_fourier_simple.h -action angle_quartic.cpp -action angle_quartic.h -action bond_harmonic_shift.cpp -action bond_harmonic_shift.h -action bond_harmonic_shift_cut.cpp -action bond_harmonic_shift_cut.h -action compute_ackland_atom.cpp -action compute_ackland_atom.h -action compute_temp_rotate.cpp -action compute_temp_rotate.h -action dihedral_cosine_shift_exp.cpp -action dihedral_cosine_shift_exp.h -action dihedral_fourier.cpp -action dihedral_fourier.h -action dihedral_nharmonic.cpp -action dihedral_nharmonic.h -action dihedral_quadratic.cpp -action dihedral_quadratic.h -action dihedral_table.cpp -action dihedral_table.h -action fix_addtorque.cpp -action fix_addtorque.h -action fix_imd.cpp -action fix_imd.h -action fix_smd.cpp -action fix_smd.h -action improper_cossq.cpp -action improper_cossq.h -action improper_fourier.cpp -action improper_fourier.h -action improper_ring.cpp -action improper_ring.h -action pair_cdeam.cpp pair_eam_alloy.cpp -action pair_cdeam.h pair_eam_alloy.cpp -action pair_coul_diel.cpp -action pair_coul_diel.h -action pair_dipole_sf.cpp -action pair_dipole_sf.h -action pair_edip.cpp -action pair_edip.h -action pair_gauss_cut.cpp -action pair_gauss_cut.h -action pair_lj_sf.cpp -action pair_lj_sf.h -action pair_meam_spline.cpp -action pair_meam_spline.h -action pair_meam_sw_spline.cpp -action pair_meam_sw_spline.h -action pair_tersoff_table.cpp -action pair_tersoff_table.h +for file in *.cpp *.h; do + if (test $file = "pair_cdeam.cpp") then + action pair_cdeam.cpp pair_eam_alloy.cpp + elif (test $file = "pair_cdeam.h") then + action pair_cdeam.h pair_eam_alloy.cpp + else + action $file + fi +done diff --git a/src/USER-MOLFILE/Install.sh b/src/USER-MOLFILE/Install.sh index 3493e3a0e3..537cefda06 100644 --- a/src/USER-MOLFILE/Install.sh +++ b/src/USER-MOLFILE/Install.sh @@ -15,7 +15,7 @@ action () { echo " updating src/$1" fi fi - elif (test ! -z "$2") then + elif (test -n "$2") then if (test ! -e ../$2) then rm -f ../$1 fi diff --git a/src/USER-OMP/Install.sh b/src/USER-OMP/Install.sh index d948058c2e..9cbbda72a3 100644 --- a/src/USER-OMP/Install.sh +++ b/src/USER-OMP/Install.sh @@ -1,26 +1,50 @@ # Install/unInstall package files in LAMMPS +# mode = 0/1/2 for uninstall/install/update + +mode=$1 + +# arg1 = file, arg2 = file it depends on + +action () { + if (test $mode = 0) then + rm -f ../$1 + elif (! cmp -s $1 ../$1) then + if (test -z "$2" || test -e ../$2) then + cp $1 .. + if (test $mode = 2) then + echo " updating src/$1" + fi + fi + elif (test -n "$2") then + if (test ! -e ../$2) then + rm -f ../$1 + fi + fi +} # step 1: process all *_omp.cpp and *_omp.h files. # do not install child files if parent does not exist -for file in *_omp.cpp *_omp.h ; do - ofile=`echo $file | sed -e 's,\(.*\)_omp\.h,\1.h,' -e 's,\(.*\)_omp\.cpp,\1.cpp,'` - if (test $1 = 1) then - if (test $file = "thr_omp.h") || (test $file = "thr_omp.cpp") then - : # always install those files. - elif (test ! -e ../$ofile) then - continue - fi - - cp $file .. - - elif (test $1 = 0) then - rm -f ../$file - fi +for file in *_omp.cpp; do + test $file = thr_omp.cpp && continue + dep=${file%_omp.cpp}.cpp + action $file $dep done +for file in *_omp.h; do + test $file = thr_omp.h && continue + dep=${file%_omp.h}.h + action $file $dep +done + +action thr_omp.h +action thr_omp.cpp +action thr_data.h +action thr_data.cpp + # step 2: handle cases and tasks not handled in step 1. -if (test $1 = 1) then + +if (test $mode = 1) then if (test -e ../Makefile.package) then sed -i -e 's/[^ \t]*OMP[^ \t]* //' ../Makefile.package @@ -31,10 +55,7 @@ if (test $1 = 1) then touch ../accelerator_omp.h - cp thr_data.h .. - cp thr_data.cpp .. - -elif (test $1 = 0) then +elif (test $mode = 0) then if (test -e ../Makefile.package) then sed -i -e 's/[^ \t]*OMP[^ \t]* //' ../Makefile.package @@ -44,7 +65,4 @@ elif (test $1 = 0) then touch ../accelerator_omp.h - rm -f ../thr_data.h - rm -f ../thr_data.cpp - fi diff --git a/src/USER-OMP/Package.sh b/src/USER-OMP/Package.sh deleted file mode 100644 index e5093da4fd..0000000000 --- a/src/USER-OMP/Package.sh +++ /dev/null @@ -1,40 +0,0 @@ -# Update package files in LAMMPS -# Copy package file to src if it doesn't exists or is different. -# But only copy the file, if a non-OpenMP version exists and -# remove OpenMP versions that have no matching serial file -# installed, e.g. after a package has been removed. - -for file in *_omp.cpp *_omp.h ; do - # these are special cases and handled below - if (test $file = "thr_omp.h") || (test $file = "thr_omp.cpp") then - continue - fi - # derive name of non-OpenMP version - ofile=`echo $file | sed -e 's,\(.*\)_omp\.h,\1.h,' -e 's,\(.*\)_omp\.cpp,\1.cpp,'` - if (test ! -e ../$ofile) then - if (test -e ../$file) then - echo " removing src/$file" - rm -f ../$file - fi - else - if (test ! -e ../$file) then - echo " creating src/$file" - cp $file .. - elif ! cmp -s $file ../$file ; then - echo " updating src/$file" - cp $file .. - fi - fi -done - -# special case for files not covered by the automatic script above -for file in thr_data.h thr_data.cpp thr_omp.h thr_omp.cpp; do - if (test ! -e ../$file) then - echo " creating src/$file" - cp $file .. - elif ! cmp -s $file ../$file ; then - echo " updating src/$file" - cp $file .. - fi -done - diff --git a/src/VORONOI/Install.sh b/src/VORONOI/Install.sh index 65578f2550..ab310c0080 100755 --- a/src/VORONOI/Install.sh +++ b/src/VORONOI/Install.sh @@ -15,7 +15,7 @@ action () { echo " updating src/$1" fi fi - elif (test ! -z "$2") then + elif (test -n "$2") then if (test ! -e ../$2) then rm -f ../$1 fi