For the third atom P3, the algorithm picks the protein atom that is farthest from P1 and P2, but no more than half the box size away from them and where the dihedral angle P3-P2-P1-L1 passes the same checks as above. The same protein atoms are used for restraining both ligands if selected atoms pass the above checks in both systems. If the protein atoms selected for one protein-ligand complex are not suitable for the other protein-ligand complex, the algorithm selects different protein atoms for the second system. Ligand atoms, on the other hand, are selected independently for each ligand.