finished fix for cases when natoms > 99999