Structure flexibility is essential for the biological function of proteins. At the same time, many proteins need to discriminate ligands with subtle differences, with one example being ion selectivity. Investigating the mechanisms by which flexible proteins achieve such precise discrimination is crucial for advancing our understanding of their functions. In this work, we study transporter KCC4, which undergoes continuous conformation changes during ion transport and can realize K