Binding of flexible ligands to macromolecules