# Prepare receptor structures (note: very brittle!)
prepare_receptor.bat -r protein-01.mol2 -U ignore -o p01_receptor.pdbqt
prepare_receptor.bat -r protein-02.mol2 -U ignore -o p02_receptor.pdbqt
prepare_receptor.bat -r protein-03.mol2 -U ignore -o p03_receptor.pdbqt
prepare_receptor.bat -r protein-04.mol2 -U ignore -o p04_receptor.pdbqt
prepare_receptor.bat -r protein-05.mol2 -U ignore -o p05_receptor.pdbqt

# Make the bounding box based on the known poses
surflex-dock-v5190-win64.exe bbox KnownPoses.mol2 2.0 10.0 0 known

# Make the test and reference ligand files (all separate)
surflex-tools-v5190-win64.exe splitmols Test-random.mol2 testlig
surflex-tools-v5190-win64.exe splitmols TestRefClean.mol2 gold

ls testlig*mol2 | awk '{print "./RunPrepLigand " $1 }' | sed s/testlig-// | sed s/.mol2// > RunAllPrepLigand

source RunAllPrepLigand

rm testlig-fix-*.mol2

ls testlig*.pdbqt | sed s/testlig-// | sed s/.pdbqt// | awk '{print "./RunDock 01 " $1 }' > RunAllDock01
ls testlig*.pdbqt | sed s/testlig-// | sed s/.pdbqt// | awk '{print "./RunDock 02 " $1 }' > RunAllDock02
ls testlig*.pdbqt | sed s/testlig-// | sed s/.pdbqt// | awk '{print "./RunDock 03 " $1 }' > RunAllDock03
ls testlig*.pdbqt | sed s/testlig-// | sed s/.pdbqt// | awk '{print "./RunDock 04 " $1 }' > RunAllDock04
ls testlig*.pdbqt | sed s/testlig-// | sed s/.pdbqt// | awk '{print "./RunDock 05 " $1 }' > RunAllDock05

# Now figure out which proteins gave us something reasonable and construct a script to run all dockings for legal proteins
ls p0[1-5]_receptor.pdbqt | sed s/p0/0/ | sed s/_receptor.pdbqt// | awk '{print "source RunAllDock" $1}' > RunAllProteinDocking

# Now make a list of the test molecule names
ls testlig*.pdbqt | sed s/testlig-// | sed s/.pdbqt// | awk '{print $1 }' > TestNames
