#!/bin/csh -f

set SQM = ../../../bin/sqm
set SPDIFF = ../../dacdif
set GODIFF = "../../dacdif -a 0.05"
set SPTESTS = (znh+.pm3.sp znh+.znb.sp)
set GOTESTS = (znh+.pm3.go znh+.znb.go)

# single point tests
foreach i ($SPTESTS)
    set input = $i.in
    set output = $i.out
    $SQM -O -i $input -o $output || goto error
    $SPDIFF $output.save $output
end

# geometry optimization tests
# do not check the electronic energy and
# core repulsion energy, they are too sensitive!
# the same holds for the final cartesian coordinates
# since the optimization is done in internal coordinates
foreach i ($GOTESTS)
    set input = $i.in
    set output = $i.out
    $SQM -O -i $input -o $output || goto error
    grep -v 'Electronic energy' $output > tmp
    grep -v 'Core-core repulsion' tmp > tmp2
    grep -v 'DIPOLE' tmp2 > tmp
    grep -v 'QMMM:  ' tmp > $output
    rm tmp tmp2
    $GODIFF $output.save $output
end

exit(0)

error:
echo "  ${0}:  Program error"
exit(1)
