Finite representation of an infinite molecular system : algorithms and applications