Index: tests/integration/MolecularDynamics/testsuite-integration-moleculardynamics-water-system.at
===================================================================
--- tests/integration/MolecularDynamics/testsuite-integration-moleculardynamics-water-system.at	(revision 37fe17af51254cfec7e28d072b401aeec079c13a)
+++ tests/integration/MolecularDynamics/testsuite-integration-moleculardynamics-water-system.at	(revision 37fe17af51254cfec7e28d072b401aeec079c13a)
@@ -0,0 +1,99 @@
+#
+#    MoleCuilder - creates and alters molecular systems
+#    Copyright (C) 2017 Frederik Heber
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+### testing molecular dynamics simulation of box filled with water
+
+# perform test with PoolWorkers using molecuilder_poolworker
+AT_SETUP([Molecular Dynamics - water-filled box])
+AT_KEYWORDS([molecular-dynamics water])
+
+# check that ports are unique over all tests such that they may run in parallel
+WORKERPORT=12140
+CONTROLLERPORT=12141
+WORKERLISTENPORT=12142
+
+# start service in background
+${AUTOTEST_PATH}/molecuilder_server --workerport $WORKERPORT --controllerport $CONTROLLERPORT --timeout 3 &
+server_pid=$!
+AT_CHECK([sleep 2], 0, [ignore], [ignore], [kill $server_pid])
+AT_CHECK([kill -s 0 $server_pid], 0, [ignore], [ignore], [kill $server_pid])
+
+# enlist a worker to work on jobs
+../../molecuilder_poolworker -v 5 --server 127.0.0.1:${WORKERPORT} --hostname 127.0.0.1 --listen $WORKERLISTENPORT &
+worker_script_pid=$!
+worker_pid=`ps -ef | grep molecuilder_poolworker | grep $worker_script_pid | awk '{print $2}'`
+AT_CHECK([sleep 2], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([kill -s 0 $worker_pid], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# create jobs via molecuilder
+molfile="water.pdb"
+outputfile="water-system.data"
+AT_CHECK([cp -f ${abs_top_srcdir}/tests/integration/MolecularDynamics/pre/$molfile $molfile], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([chmod +rw $molfile], 0)
+AT_CHECK([../../molecuilder \
+	-l $molfile \
+	-i $outputfile \
+	-o tremolo \
+	--set-tremolo-atomdata "Id type x=3 u=3 F=3 neighbors=2" \
+	--change-box "10,0,10,0,0,10" \
+	--select-molecule-by-order -1 \
+	--fill-regular-grid \
+		--mesh-size 3 3 3 \
+		--mesh-offset "0.5,0.5,0.5" \
+		--min-distance 3.1 \
+	--set-boundary-conditions Wrap Wrap Wrap \
+	--select-all-atoms \
+	--set-parser-parameters mpqc \
+		--parser-parameters "theory=CLHF;basis=3-21G;" \
+	--molecular-dynamics \
+		--keep-bondgraph 1 \
+		--parse-state-files 0 \
+		--deltat 0.5 \
+		--steps 30 \
+		--order 1 \
+		--grid-level 4 \
+		--server-address 127.0.0.1 \
+		--server-port ${CONTROLLERPORT} \
+		--DoLongrange 0], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# send removeall to server such that all workers shutdown
+AT_CHECK([${AUTOTEST_PATH}/molecuilder_controller --server 127.0.0.1:$CONTROLLERPORT --command removeall], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# check that worker is truely down
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $worker_pid $server_pid])
+AT_CHECK([kill $worker_pid], 1, [ignore], [ignore], [kill $server_pid])
+
+# shutdown controller socket 
+AT_CHECK([${AUTOTEST_PATH}/molecuilder_controller --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [stdout], [ignore], [kill $server_pid])
+
+# check that server is truely down
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+AT_CHECK([kill $server_pid], 1, [ignore], [ignore])
+
+# check forces at initial two steps
+lines=`echo "2+81+1+81" | bc`
+AT_CHECK([head -n $lines $outputfile | diff - ${abs_top_srcdir}/tests/integration/MolecularDynamics/post/water-system_initial_steps.data], 0)
+
+# check average temperature
+tempfile="water-system.ekin"
+AT_CHECK([../../molecuilder \
+	-i $outputfile \
+	--select-all-atoms \
+	--save-temperature $tempfile], 0, [ignore], [ignore])
+AT_CHECK([diff $tempfile ${abs_top_srcdir}/tests/integration/MolecularDynamics/post/$tempfile], 0)
+
+AT_CLEANUP
