[edecba] | 1 | ### fragment the molecule and check the number of configs
|
---|
| 2 |
|
---|
| 3 | AT_SETUP([Fragmentation - Automation: MoleCuilder Action])
|
---|
| 4 | AT_KEYWORDS([fragmentation automation molecuilder server worker])
|
---|
| 5 |
|
---|
| 6 | # check that ports are unique over all tests such that they may run in parallel
|
---|
| 7 | WORKERPORT=1065
|
---|
| 8 | CONTROLLERPORT=1066
|
---|
| 9 | WORKERLISTENPORT=1067
|
---|
| 10 |
|
---|
| 11 | # create job files for stand-in mpqc
|
---|
| 12 | i=0
|
---|
[004d5c] | 13 | while test -e ${abs_top_srcdir}/tests/JobMarket/pre/BondFragment`printf %02d $i`.out; do
|
---|
[edecba] | 14 | nr=`printf %02d $i`
|
---|
| 15 | echo "Creating Job${nr}.in"
|
---|
[004d5c] | 16 | echo "${abs_top_srcdir}/tests/JobMarket/pre/BondFragment${nr}.out" >Job${nr}.in
|
---|
[edecba] | 17 | ((i+=1))
|
---|
| 18 | done
|
---|
| 19 |
|
---|
| 20 | # start service in background
|
---|
| 21 | ${AUTOTEST_PATH}/Server --workerport $WORKERPORT --controllerport $CONTROLLERPORT &
|
---|
| 22 | server_pid=$!
|
---|
| 23 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
|
---|
| 24 |
|
---|
| 25 | # enlist a worker to work on jobs
|
---|
| 26 | ${AUTOTEST_PATH}/PoolWorker -v 5 --signal 2 --server 127.0.0.1:${WORKERPORT} --hostname 127.0.0.1 --listen $WORKERLISTENPORT &
|
---|
| 27 | worker_pid=$!
|
---|
| 28 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
| 29 |
|
---|
| 30 | # use molecuilder to add jobs, wait for their completion and obtain results
|
---|
[004d5c] | 31 | AT_CHECK([../../molecuilder -v 3 --fragment-automation --fragment-executable "../../mpqc" --fragment-path "${abs_top_srcdir}/tests/JobMarket/pre/" --fragment-jobs Job??.in --server-address 127.0.0.1 --server-port $CONTROLLERPORT], 0, [stdout], [ignore])
|
---|
[edecba] | 32 | AT_CHECK([fgrep "There are 7 fragments" stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
| 33 | AT_CHECK([fgrep "There are 23 atoms" stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
| 34 | AT_CHECK([fgrep "Resulting energy is -279.837" stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
| 35 | AT_CHECK([fgrep "Resulting forces are" stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
| 36 |
|
---|
| 37 | # removeall to remove workers, then shutdown for server itself
|
---|
| 38 | AT_CHECK([${AUTOTEST_PATH}/Controller --server 127.0.0.1:$CONTROLLERPORT --command removeall], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
|
---|
| 39 | AT_CHECK([${AUTOTEST_PATH}/Controller --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
|
---|
| 40 |
|
---|
| 41 | # check that server is truely down
|
---|
| 42 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
| 43 | AT_CHECK([kill $server_pid $worker_pid], 1, [ignore], [ignore])
|
---|
| 44 |
|
---|
| 45 | AT_CLEANUP
|
---|