# # MoleCuilder - creates and alters molecular systems # Copyright (C) 2014 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 . # ### naphthalene AT_SETUP([Calculations - naphthalene]) AT_KEYWORDS([Calculations naphthalene pdb]) # check that ports are unique over all tests such that they may run in parallel WORKERPORT=3080 CONTROLLERPORT=3081 WORKERLISTENPORT=3082 # start service in background ${AUTOTEST_PATH}/molecuilder_server --workerport $WORKERPORT --controllerport $CONTROLLERPORT & 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_mpqc +v 5 ++server 127.0.0.1:${WORKERPORT} ++hostname 127.0.0.1 ++listen $WORKERLISTENPORT & worker_pid=$! AT_CHECK([sleep 2], 0, [ignore], [ignore], [kill $worker_pid $server_pid]) AT_CHECK([kill -s 0 $worker_pid], 0, [ignore], [ignore], [kill $worker_pid $server_pid]) MOL=naphthalene DISTANCE="2." FILENAME="BondFragment" ENERGY="-381.9499338" file=${MOL}.pdb AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/Fragmentations/Fragmenting/${MOL}/pre/$file $file], 0) AT_CHECK([chmod u+w $file], 0) AT_CHECK([../../molecuilder \ -i $file \ --select-molecule-by-id 0 \ --select-molecules-atoms \ --correct-bonddegree \ --fragment-molecule $FILENAME \ --order 3 \ --distance $DISTANCE \ --fragment-automation --server-address 127.0.0.1 --server-port $CONTROLLERPORT --DoLongrange 0 \ --analyse-fragment-results \ --fragment-prefix $FILENAME], 0, [stdout], [stderr], [kill $worker_pid $server_pid]) AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}' >energy_stdout], 0, [stdout], [stderr], [kill $worker_pid $server_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 $worker_pid $server_pid]) # shutdown controller socket AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $worker_pid $server_pid]) AT_CHECK([${AUTOTEST_PATH}/molecuilder_controller --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [stdout], [ignore], [kill $worker_pid $server_pid]) # check that worker is truly down AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $worker_pid $server_pid]) AT_CHECK([kill $worker_pid], 1, [ignore], [ignore], [kill $server_pid]) # check that server is truly down AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid]) AT_CHECK([kill $server_pid], 1, [ignore], [ignore]) # check calculated energy AT_CHECK([cat energy_stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0, [stdout], [stderr]) AT_CLEANUP