Index: tests/integration/Makefile.am
===================================================================
--- tests/integration/Makefile.am	(revision c837db7379c954077d4efb8b85fa76ac56a84cda)
+++ tests/integration/Makefile.am	(revision e43a6df096d03e1e035e3899d6f975e3496b18d0)
@@ -19,5 +19,9 @@
 	$(srcdir)/MolecularDynamics/testsuite-integration-moleculardynamics-methane.at \
 	$(srcdir)/MolecularDynamics/testsuite-integration-moleculardynamics-ethane.at \
-	$(srcdir)/MolecularDynamics/testsuite-integration-moleculardynamics-water-system.at
+	$(srcdir)/MolecularDynamics/testsuite-integration-moleculardynamics-water-system.at \
+	$(srcdir)/StructureOptimization/testsuite-integration-structureoptimization.at \
+	$(srcdir)/StructureOptimization/testsuite-integration-structureoptimization-water.at \
+	$(srcdir)/StructureOptimization/testsuite-integration-structureoptimization-methane.at \
+	$(srcdir)/StructureOptimization/testsuite-integration-structureoptimization-ethane.at
 endif
 
Index: tests/integration/StructureOptimization/pre/ethane.pdb
===================================================================
--- tests/integration/StructureOptimization/pre/ethane.pdb	(revision e43a6df096d03e1e035e3899d6f975e3496b18d0)
+++ tests/integration/StructureOptimization/pre/ethane.pdb	(revision e43a6df096d03e1e035e3899d6f975e3496b18d0)
@@ -0,0 +1,18 @@
+REMARK created by molecuilder on Wed Feb 27 12:17:18 2013, time step 0
+ATOM      1 C01 0alk 00          3.125  10.442  10.000  0.00  0.00           C 0
+ATOM      2 C02 0alk 00          4.374   9.559  10.000  0.00  0.00           C 0
+ATOM      3 H01 0alk 00          3.125  11.071   9.110  0.00  0.00           H 0
+ATOM      4 H02 0alk 00          3.125  11.071  10.890  0.00  0.00           H 0
+ATOM      5 H03 0alk 00          4.374   8.929   9.110  0.00  0.00           H 0
+ATOM      6 H04 0alk 00          4.374   8.929  10.890  0.00  0.00           H 0
+ATOM      7 H05 0alk 00          2.235   9.813  10.000  0.00  0.00           H 0
+ATOM      8 H06 0alk 00          5.264  10.188  10.000  0.00  0.00           H 0
+CONECT    1    2    3    4    7                                                 
+CONECT    2    1    5    6    8                                                 
+CONECT    3    1                                                                
+CONECT    4    1                                                                
+CONECT    5    2                                                                
+CONECT    6    2                                                                
+CONECT    7    1                                                                
+CONECT    8    2                                                                
+END
Index: tests/integration/StructureOptimization/pre/methane.pdb
===================================================================
--- tests/integration/StructureOptimization/pre/methane.pdb	(revision e43a6df096d03e1e035e3899d6f975e3496b18d0)
+++ tests/integration/StructureOptimization/pre/methane.pdb	(revision e43a6df096d03e1e035e3899d6f975e3496b18d0)
@@ -0,0 +1,12 @@
+REMARK created by molecuilder on Wed Jul 12 22:06:51 2017, time step 59
+ATOM      1 C01 0non 01         10.000  10.000  10.000  0.00  0.00           C 0
+ATOM      2 H01 0non 01         11.083  10.000  10.000  0.00  0.00           H 0
+ATOM      3 H02 0non 01          9.639  11.021  10.000  0.00  0.00           H 0
+ATOM      4 H03 0non 01          9.639   9.490  10.884  0.00  0.00           H 0
+ATOM      5 H04 0non 01          9.639   9.490   9.116  0.00  0.00           H 0
+CONECT    1    2    4    5    3                                                 
+CONECT    2    1                                                                
+CONECT    3    1                                                                
+CONECT    4    1                                                                
+CONECT    5    1                                                                
+END
Index: tests/integration/StructureOptimization/pre/water.pdb
===================================================================
--- tests/integration/StructureOptimization/pre/water.pdb	(revision e43a6df096d03e1e035e3899d6f975e3496b18d0)
+++ tests/integration/StructureOptimization/pre/water.pdb	(revision e43a6df096d03e1e035e3899d6f975e3496b18d0)
@@ -0,0 +1,8 @@
+REMARK created by molecuilder on Tue Feb 26 16:16:10 2013, time step 0
+ATOM      1 O01 0non 01          0.000   0.000   0.000  0.00  0.00           O 0
+ATOM      2 H01 0non 01          0.720   0.000   0.558  0.00  0.00           H 0
+ATOM      3 H02 0non 01         -0.720   0.000   0.558  0.00  0.00           H 0
+CONECT    1    2    3                                                           
+CONECT    2    1                                                                
+CONECT    3    1                                                                
+END
Index: tests/integration/StructureOptimization/testsuite-integration-structureoptimization-ethane.at
===================================================================
--- tests/integration/StructureOptimization/testsuite-integration-structureoptimization-ethane.at	(revision e43a6df096d03e1e035e3899d6f975e3496b18d0)
+++ tests/integration/StructureOptimization/testsuite-integration-structureoptimization-ethane.at	(revision e43a6df096d03e1e035e3899d6f975e3496b18d0)
@@ -0,0 +1,92 @@
+#
+#    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 structure optimization simulation of ethane
+
+# perform test with PoolWorkers using molecuilder_poolworker
+AT_SETUP([Structure Optimization - ethane])
+AT_KEYWORDS([optimize-structure ethane])
+
+# check that ports are unique over all tests such that they may run in parallel
+WORKERPORT=12200
+CONTROLLERPORT=12201
+WORKERLISTENPORT=12202
+
+# 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="ethane.pdb"
+outputfile="ethane.data"
+AT_CHECK([cp -f ${abs_top_srcdir}/tests/integration/StructureOptimization/pre/$molfile $molfile], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([chmod +rw $molfile], 0)
+AT_CHECK([../../molecuilder \
+	-i $molfile \
+	-o tremolo \
+	--set-tremolo-atomdata "Id type x=3 u=3 F=3 neighbors=2" \
+	--select-all-atoms \
+	--center-in-box "10,0,10,0,0,10" \
+	--set-random-number-distribution "uniform_real" \
+		--random-number-distribution-parameters "min=0;max=1;" \
+	--set-random-number-engine "lagged_fibonacci607" \
+		--random-number-engine-parameters "seed=5;" \
+	--random-perturbation 0.1 \
+	--set-boundary-conditions Wrap Wrap Wrap \
+	--update-molecules \
+	--set-parser-parameters mpqc \
+		--parser-parameters "theory=CLHF;basis=3-21G;" \
+	--optimize-structure \
+		--keep-bondgraph 1 \
+		--parse-state-files 0 \
+		--deltat 0.5 \
+		--steps 30 \
+		--order 1 \
+		--server-address 127.0.0.1 \
+		--server-port ${CONTROLLERPORT} \
+		--DoLongrange 0], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
+
+# check remaining force
+components=`grep "at step #30 are (.*,.*,.*)" stdout | sed -e "s#.*(\(.*\),\(.*\),\(.*\)).*#\1\t\2\t\3#"`
+echo "remaining components are ($components)"
+threshold="1.8e-3"
+AT_CHECK([echo "$components" | awk -v threshold="$threshold" -F"\t" '{ for (i=0;i<3;++i) { if (($i > threshold) || ($i < -threshold)) exit 5} }'], 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])
+
+AT_CLEANUP
Index: tests/integration/StructureOptimization/testsuite-integration-structureoptimization-methane.at
===================================================================
--- tests/integration/StructureOptimization/testsuite-integration-structureoptimization-methane.at	(revision e43a6df096d03e1e035e3899d6f975e3496b18d0)
+++ tests/integration/StructureOptimization/testsuite-integration-structureoptimization-methane.at	(revision e43a6df096d03e1e035e3899d6f975e3496b18d0)
@@ -0,0 +1,92 @@
+#
+#    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 structure optimization simulation of methane
+
+# perform test with PoolWorkers using molecuilder_poolworker
+AT_SETUP([Structure Optimization - methane])
+AT_KEYWORDS([optimize-structure methane])
+
+# check that ports are unique over all tests such that they may run in parallel
+WORKERPORT=12210
+CONTROLLERPORT=12211
+WORKERLISTENPORT=12212
+
+# 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="methane.pdb"
+outputfile="methane.data"
+AT_CHECK([cp -f ${abs_top_srcdir}/tests/integration/StructureOptimization/pre/$molfile $molfile], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([chmod +rw $molfile], 0)
+AT_CHECK([../../molecuilder \
+	-i $molfile \
+	-o tremolo \
+	--set-tremolo-atomdata "Id type x=3 u=3 F=3 neighbors=2" \
+	--select-all-atoms \
+	--center-in-box "10,0,10,0,0,10" \
+	--set-random-number-distribution "uniform_real" \
+		--random-number-distribution-parameters "min=0;max=1;" \
+	--set-random-number-engine "lagged_fibonacci607" \
+		--random-number-engine-parameters "seed=5;" \
+	--random-perturbation 0.1 \
+	--set-boundary-conditions Wrap Wrap Wrap \
+	--update-molecules \
+	--set-parser-parameters mpqc \
+		--parser-parameters "theory=CLHF;basis=3-21G;" \
+	--optimize-structure \
+		--keep-bondgraph 1 \
+		--parse-state-files 0 \
+		--deltat 0.5 \
+		--steps 30 \
+		--order 1 \
+		--server-address 127.0.0.1 \
+		--server-port ${CONTROLLERPORT} \
+		--DoLongrange 0], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
+
+# check remaining force
+components=`grep "at step #30 are (.*,.*,.*)" stdout | sed -e "s#.*(\(.*\),\(.*\),\(.*\)).*#\1\t\2\t\3#"`
+echo "remaining components are ($components)"
+threshold="1.2e-3"
+AT_CHECK([echo "$components" | awk -v threshold="$threshold" -F"\t" '{ for (i=0;i<3;++i) { if (($i > threshold) || ($i < -threshold)) exit 5} }'], 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])
+
+AT_CLEANUP
Index: tests/integration/StructureOptimization/testsuite-integration-structureoptimization-water.at
===================================================================
--- tests/integration/StructureOptimization/testsuite-integration-structureoptimization-water.at	(revision e43a6df096d03e1e035e3899d6f975e3496b18d0)
+++ tests/integration/StructureOptimization/testsuite-integration-structureoptimization-water.at	(revision e43a6df096d03e1e035e3899d6f975e3496b18d0)
@@ -0,0 +1,92 @@
+#
+#    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 structure optimization simulation of water
+
+# perform test with PoolWorkers using molecuilder_poolworker
+AT_SETUP([Structure Optimization - water])
+AT_KEYWORDS([optimize-structure water])
+
+# check that ports are unique over all tests such that they may run in parallel
+WORKERPORT=12220
+CONTROLLERPORT=12221
+WORKERLISTENPORT=12222
+
+# 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.data"
+AT_CHECK([cp -f ${abs_top_srcdir}/tests/integration/StructureOptimization/pre/$molfile $molfile], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([chmod +rw $molfile], 0)
+AT_CHECK([../../molecuilder \
+	-i $molfile \
+	-o tremolo \
+	--set-tremolo-atomdata "Id type x=3 u=3 F=3 neighbors=2" \
+	--select-all-atoms \
+	--center-in-box "10,0,10,0,0,10" \
+	--set-random-number-distribution "uniform_real" \
+		--random-number-distribution-parameters "min=0;max=1;" \
+	--set-random-number-engine "lagged_fibonacci607" \
+		--random-number-engine-parameters "seed=5;" \
+	--random-perturbation 0.1 \
+	--set-boundary-conditions Wrap Wrap Wrap \
+	--update-molecules \
+	--set-parser-parameters mpqc \
+		--parser-parameters "theory=CLHF;basis=3-21G;" \
+	--optimize-structure \
+		--keep-bondgraph 1 \
+		--parse-state-files 0 \
+		--deltat 0.5 \
+		--steps 30 \
+		--order 1 \
+		--server-address 127.0.0.1 \
+		--server-port ${CONTROLLERPORT} \
+		--DoLongrange 0], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
+
+# check remaining force
+components=`grep "at step #30 are (.*,.*,.*)" stdout | sed -e "s#.*(\(.*\),\(.*\),\(.*\)).*#\1\t\2\t\3#"`
+echo "remaining components are ($components)"
+threshold="6e-4"
+AT_CHECK([echo "$components" | awk -v threshold="$threshold" -F"\t" '{ for (i=0;i<3;++i) { if (($i > threshold) || ($i < -threshold)) exit 5} }'], 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])
+
+AT_CLEANUP
Index: tests/integration/StructureOptimization/testsuite-integration-structureoptimization.at
===================================================================
--- tests/integration/StructureOptimization/testsuite-integration-structureoptimization.at	(revision e43a6df096d03e1e035e3899d6f975e3496b18d0)
+++ tests/integration/StructureOptimization/testsuite-integration-structureoptimization.at	(revision e43a6df096d03e1e035e3899d6f975e3496b18d0)
@@ -0,0 +1,27 @@
+#
+#    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/>.
+#
+AT_BANNER([MoleCuilder - structure optimization integration])
+
+# testing structure optimization simulation of water
+m4_include([StructureOptimization/testsuite-integration-structureoptimization-water.at])
+
+# testing structure optimization simulation of methane
+m4_include([StructureOptimization/testsuite-integration-structureoptimization-methane.at])
+
+# testing structure optimization simulation of ethane
+m4_include([StructureOptimization/testsuite-integration-structureoptimization-ethane.at])
Index: tests/integration/testsuite-integration.at
===================================================================
--- tests/integration/testsuite-integration.at	(revision c837db7379c954077d4efb8b85fa76ac56a84cda)
+++ tests/integration/testsuite-integration.at	(revision e43a6df096d03e1e035e3899d6f975e3496b18d0)
@@ -23,2 +23,5 @@
 # check integration of molecular dynamics
 m4_include([MolecularDynamics/testsuite-integration-moleculardynamics.at])
+
+# check integration of structure optimization
+m4_include([StructureOptimization/testsuite-integration-structureoptimization.at])
