Sciren Staff Lv 1
Here's an example of how to find a floating ligand. It finds the first ligand in a puzzle, which should cover small molecule design puzzles for now.
In the example, PST is a table used to the store the ligand segment and other "puzzle state" info. Some recipes might have plain global variables LIGAND and AtomsInLigand, not stored in a table.
function HasLigand ()
local segCnt = structure.GetCount ()
local HASLIGAND = false
for ii = 1, structure.GetCount () do
if structure.GetSecondaryStructure ( ii ) == "M" then
PST.LIGAND = ii
PST.AtomsInLigand = structure.GetAtomCount(PST.LIGAND)
HASLIGAND = true
break
end
end
return HASLIGAND
end