Find pseudo family from pseudo

I am wanting to find what pseudo family a particular pseudo might have come from and I’m guessing the best way to do this would be through using the PK associated with the pseudo unless of course I’m missing where it’s linked to the pseudo family. How can I query for this? Thanks.

Hi,

pseudopotential families are simply groups in AiiDA, even if of a special type.
You can check all groups of all types with verdi group list --all that returns something like:

  PK  Label                                   Type string                User
----  --------------------------------------  -------------------------  ---------------
   4  PseudoDojo/0.4/PBE/FR/standard/upf      pseudo.family.pseudo_dojo  aiida@localhost
   8  PseudoDojo/0.4/PBE/FR/stringent/upf     pseudo.family.pseudo_dojo  aiida@localhost
  15  SSSP/1.1/PBE/efficiency                 pseudo.family.sssp         aiida@localhost
  16  SSSP/1.1/PBEsol/efficiency              pseudo.family.sssp         aiida@localhost
  13  calcs/PBE                               core                       aiida@localhost
  13  calcs/PBEsol                            core                       aiida@localhost
...

Here with the --all group you do not only see the core groups (the ones you generally create) but also groups of other types (e.g. those starting with pseudo.family.*).

If you know the PK (or the UUID, it works the same) of a pseudopotential node, you can just show all groups it belongs to from the command line with verdi node show <PK> --print-groups that shows e.g.:

Property     Value
-----------  ------------------------------------
type         UpfData
pk           332
uuid         55193f5e-5310-4b91-8b6c-d88ed6b8a745
label
description
ctime        2025-04-05 20:27:56.236837+00:00
mtime        2025-04-05 20:27:57.961204+00:00
#### GROUPS:
Node 332 belongs to the following groups:
  PK  Label                                Group type
----  -----------------------------------  -------------------------
   4  PseudoDojo/0.4/PBE/FR/standard/upf   pseudo.family.pseudo_dojo
   8  PseudoDojo/0.4/PBE/FR/stringent/upf  pseudo.family.pseudo_dojo

(so e.g. in this case, this pseudo is in 2 families, shown in the last 2 lines).

If you want to do it programmatically from python using the QueryBuilder, you just query for all groups the node is in, e.g. with

from aiida.orm import Node, Group
from aiida.orm.querybuilder import QueryBuilder

upf_pk = <PK> # Replace with PK
qb = QueryBuilder()
qb.append(Node, filters={'id': upf_pk}, tag='upf')
qb.append(Group, with_node='upf', filters={'type_string': {'like': 'pseudo.family.%'}}, tag='group', project='label')
# Get the list of group labels
pseudo_family_labels = qb.all(flat=True)
print(pseudo_family_labels)

returning

['PseudoDojo/0.4/PBE/FR/standard/upf', 'PseudoDojo/0.4/PBE/FR/stringent/upf']

This is also specifically filtering only for groups of the correct type, if you don’t care or you know the UPF is not in other groups, you can also skip the filtering of the group on the type_string and just replace the appropriate line above with

qb.append(Group, with_node='upf', tag='group', project='label')

Hope it helps!

Thanks Giovanni this helps out with what I’m needing. Much appreciated.