#!/bin/bash

rm -rf finished
rm -rf archive

count=1

n=`cat $@ | wc -l`

while [ ! -d finished ]
do

head -$count $@ | tail -1 > test.smi

./build_database_ligand.sh test.smi -H 7.4 --no-db --no-mol2 --save-table --single

o=$(($n-$count+1))

tail -$o $@ > $@-resubmit

count=$(($count+1))

done

rm $@-fails

cat archive/REAL3*/input.ism >> $@-fails
