Assumed rotorYidx == beg in ligand::ligand(). Replaced beg by rotorYidx and end by childYidx