Implementing ghost atoms and cells