The flattening phase transition in systems of trapped ions