Self-consistent particle simulation of ion channels