From 4d43e30b42e86c8026a9cd8ea326ea9c114f355d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 23 Nov 2013 19:32:50 +0100 Subject: [PATCH] implement tests for harmonic/shift --- regtest/bond/ref/log.harmonic-shift-a-none | 11 ----- .../bond/ref/log.harmonic-shift-cut-a-none | 11 ----- regtest/bond/ref/log.harmonic-shift-cut-none | 11 +++++ regtest/bond/ref/log.harmonic-shift-none | 11 +++++ regtest/bond/runtests.sh | 42 ++++++++++++------- 5 files changed, 49 insertions(+), 37 deletions(-) delete mode 100644 regtest/bond/ref/log.harmonic-shift-a-none delete mode 100644 regtest/bond/ref/log.harmonic-shift-cut-a-none create mode 100644 regtest/bond/ref/log.harmonic-shift-cut-none create mode 100644 regtest/bond/ref/log.harmonic-shift-none diff --git a/regtest/bond/ref/log.harmonic-shift-a-none b/regtest/bond/ref/log.harmonic-shift-a-none deleted file mode 100644 index cd91dd1fdf..0000000000 --- a/regtest/bond/ref/log.harmonic-shift-a-none +++ /dev/null @@ -1,11 +0,0 @@ -Step Temp E_pair E_mol TotEng Press - 0 0 0 0.040304848 0.040304848 183.5375 - 1 0.22393239 0 0.036893575 0.040231075 175.82761 --- -Step Temp E_pair E_mol TotEng Press - 0 0.22393239 0 0.036893575 0.040231075 175.82761 - 1 0.81991975 0 0.027814603 0.040034728 153.28706 --- -Step Temp E_pair E_mol TotEng Press - 1 0.22393239 0 0.036893575 0.040231075 175.82761 - 2 0.81991975 0 0.027814603 0.040034728 153.28706 diff --git a/regtest/bond/ref/log.harmonic-shift-cut-a-none b/regtest/bond/ref/log.harmonic-shift-cut-a-none deleted file mode 100644 index cd91dd1fdf..0000000000 --- a/regtest/bond/ref/log.harmonic-shift-cut-a-none +++ /dev/null @@ -1,11 +0,0 @@ -Step Temp E_pair E_mol TotEng Press - 0 0 0 0.040304848 0.040304848 183.5375 - 1 0.22393239 0 0.036893575 0.040231075 175.82761 --- -Step Temp E_pair E_mol TotEng Press - 0 0.22393239 0 0.036893575 0.040231075 175.82761 - 1 0.81991975 0 0.027814603 0.040034728 153.28706 --- -Step Temp E_pair E_mol TotEng Press - 1 0.22393239 0 0.036893575 0.040231075 175.82761 - 2 0.81991975 0 0.027814603 0.040034728 153.28706 diff --git a/regtest/bond/ref/log.harmonic-shift-cut-none b/regtest/bond/ref/log.harmonic-shift-cut-none new file mode 100644 index 0000000000..a8b0bcd388 --- /dev/null +++ b/regtest/bond/ref/log.harmonic-shift-cut-none @@ -0,0 +1,11 @@ +Step Temp E_pair E_mol TotEng Press + 0 0 0 -399.98185 -399.98185 82.670827 + 1 0.046543578 0 -399.98255 -399.98185 81.107729 +-- +Step Temp E_pair E_mol TotEng Press + 0 0.046543578 0 -180.16414 -180.16344 36.550781 + 1 0.095879348 0 -180.16488 -180.16345 34.84325 +-- +Step Temp E_pair E_mol TotEng Press + 1 0.046543578 0 -399.98255 -399.98185 81.107729 + 2 0.17899078 0 -399.98454 -399.98187 76.471982 diff --git a/regtest/bond/ref/log.harmonic-shift-none b/regtest/bond/ref/log.harmonic-shift-none new file mode 100644 index 0000000000..a8b0bcd388 --- /dev/null +++ b/regtest/bond/ref/log.harmonic-shift-none @@ -0,0 +1,11 @@ +Step Temp E_pair E_mol TotEng Press + 0 0 0 -399.98185 -399.98185 82.670827 + 1 0.046543578 0 -399.98255 -399.98185 81.107729 +-- +Step Temp E_pair E_mol TotEng Press + 0 0.046543578 0 -180.16414 -180.16344 36.550781 + 1 0.095879348 0 -180.16488 -180.16345 34.84325 +-- +Step Temp E_pair E_mol TotEng Press + 1 0.046543578 0 -399.98255 -399.98185 81.107729 + 2 0.17899078 0 -399.98454 -399.98187 76.471982 diff --git a/regtest/bond/runtests.sh b/regtest/bond/runtests.sh index 8c6afc87a6..384bc8f065 100755 --- a/regtest/bond/runtests.sh +++ b/regtest/bond/runtests.sh @@ -2,8 +2,21 @@ export OMP_NUM_THREADS=2 +if [ $# -lt 1 ] +then + cat < + +EOF +exit 0 +fi + +exe="$1" + + runcheck () { -exe=$1 +lmp=$1 sty=$2 coe=$3 arg=$4 @@ -11,10 +24,10 @@ log=$5 for n in 1 2 4 8 do \ - mpirun -np $n ${exe} -i in.bond_angle ${sty} ${coe} "${arg}" -log ${log}-${n} -echo none -screen none + mpirun -x OMP_NUM_THREADS -np $n ${lmp} -i in.bond_angle ${sty} ${coe} "${arg}" -log ${log}-${n} -echo none -screen none grep -A2 ^Step ${log}-${n} > out diff -u ref/${log} out && rm out ${log}-${n} && echo OK ${log} ${n} || echo ERROR ${log} ${n} - mpirun -np $n ${exe} -i in.bond_angle ${sty} ${coe} "${arg}" -log ${log}-omp-${n} -echo none -screen none -suffix omp + mpirun -x OMP_NUM_THREADS -np $n ${lmp} -i in.bond_angle ${sty} ${coe} "${arg}" -log ${log}-omp-${n} -echo none -screen none -suffix omp grep -A2 ^Step ${log}-omp-${n} > omp diff -u ref/${log} omp && rm omp ${log}-omp-${n} && echo OK ${log} omp ${n} || echo ERROR ${log} omp ${n} done @@ -22,27 +35,26 @@ done rm -f *.data *.restart log.* -runcheck lmp_g++ '-v bstyle harmonic' '-v bcoeff' '1 100.0 1.01' log.harmonic-none -runcheck lmp_g++ '-v bstyle morse' '-v bcoeff' '1 100.0 2.0 1.01' log.morse-none -runcheck lmp_g++ '-v bstyle nonlinear' '-v bcoeff' '1 100.0 1.01 2.0' log.nonlinear-none +runcheck ${exe} '-v bstyle harmonic' '-v bcoeff' '1 100.0 1.01' log.harmonic-none +runcheck ${exe} '-v bstyle morse' '-v bcoeff' '1 100.0 2.0 1.01' log.morse-none +runcheck ${exe} '-v bstyle nonlinear' '-v bcoeff' '1 100.0 1.01 2.0' log.nonlinear-none # first term of class2 is harmonic -runcheck lmp_g++ '-v bstyle class2' '-v bcoeff' '1 1.01 100.0 0.0 0.0' log.class2a-none -runcheck lmp_g++ '-v bstyle class2' '-v bcoeff' '1 1.01 100.0 80.0 80.0' log.class2b-none +runcheck ${exe} '-v bstyle class2' '-v bcoeff' '1 1.01 100.0 0.0 0.0' log.class2a-none +runcheck ${exe} '-v bstyle class2' '-v bcoeff' '1 1.01 100.0 80.0 80.0' log.class2b-none -runcheck lmp_g++ '-v bstyle fene' '-v bcoeff' '1 50.0 1.01 0.5 0.9' log.fene-none +runcheck ${exe} '-v bstyle fene' '-v bcoeff' '1 50.0 1.01 0.5 0.9' log.fene-none # hack to handle styles with a '/' mkdir -p fene -runcheck lmp_g++ '-v bstyle fene/expand' '-v bcoeff' '1 50.0 1.01 0.5 0.9 0.0' log.fene-expand-a-none -runcheck lmp_g++ '-v bstyle fene/expand' '-v bcoeff' '1 50.0 1.01 0.5 0.9 0.1' log.fene-expand-b-none +runcheck ${exe} '-v bstyle fene/expand' '-v bcoeff' '1 50.0 1.01 0.5 0.9 0.0' log.fene-expand-a-none +runcheck ${exe} '-v bstyle fene/expand' '-v bcoeff' '1 50.0 1.01 0.5 0.9 0.1' log.fene-expand-b-none rm -r fene mkdir -p harmonic/shift -#runcheck lmp_g++ '-v bstyle harmonic/shift' '-v bcoeff' '1 100.0 1.01 1.01' log.harmonic-shift-a-none -#runcheck lmp_g++ '-v bstyle harmonic/shift' '-v bcoeff' '1 100.0 1.01 2.0' log.harmonic-shift-b-none -#runcheck lmp_g++ '-v bstyle harmonic/shift/cut' '-v bcoeff' '1 100.0 1.01 1.01' log.harmonic-shift-cut-a-none -#runcheck lmp_g++ '-v bstyle harmonic/shift/cut' '-v bcoeff' '1 100.0 1.01 2.0' log.harmonic-shift-cut-b-none +runcheck ${exe} '-v bstyle harmonic/shift' '-v bcoeff' '1 100.0 1.01 2.5' log.harmonic-shift-none +runcheck ${exe} '-v bstyle harmonic/shift/cut' '-v bcoeff' '1 100.0 1.01 2.5' log.harmonic-shift-cut-none +rm -r harmonic # XXX: need special case inputs for bond style quartic and table.