Fixed bug in counting of atoms (writelmp)