Molecular modeling and simulations enable extrapolation for the structure of bacterial potassium channels to the function of their mammalian homologues. Molecular dynamics simulations have revealed the concerted single-file motion of potassium ions and water molecules through the selectivity filter of K channels and the role of filter flexibility in ion permeation and in "fast gating." Principal components analysis of extended K channel simulations suggests that hinge-bending of pore-lining M2 (or S6) helices plays a key role in K channel gating. Based on these and other simulations, a molecular model for gating of inward rectifier K channel gating is presented.