changed n_atoms to exclude Ports