Skip to content

Commit

Permalink
Improve guard on pseudo group checking in xps
Browse files Browse the repository at this point in the history
  • Loading branch information
edan-bainglass committed Nov 14, 2024
1 parent 96e2cc2 commit c66af47
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/aiidalab_qe/plugins/xps/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,19 @@ def _update_correction_energies(self):
# TODO What if the group does not exist? Should we proceed? Can this happen?

def _update_pseudos(self):
if self._pseudo_group_exists():
if not self._pseudo_group_exists():
self._install_pseudos()

def _pseudo_group_exists(self, _=None):
qb = QueryBuilder()
qb.append(
Group,
filters={"label": self.pseudo_group},
groups = (
QueryBuilder()
.append(
Group,
filters={"label": self.pseudo_group},
)
.all(flat=True)
)
return len(qb.all()) == 0
return len(groups) and [len(group.nodes) for group in groups]

def _install_pseudos(self):
import os
Expand Down

0 comments on commit c66af47

Please sign in to comment.