Error in assigning pseudopotentials to the builder object

Dear all,

I am a new user of AiiDA, and was trying the example provided at 1. Quantum ESPRESSO — AiiDA Tutorials documentation

My issue is as follows:
After initializing the builder, attaching the structure element, and getting pseudos i.e.,

builder.structure = structure
pseudos = pseudo_family.get_pseudos(structure=structure)
pseudos

When I try to assign the pseudopotentials using

builder.pseudos = pseudos

The pseudopotentials are not being assigned.

Here is what I did:

In [12]: code = load_code(108)
...: builder=code.get_builder()
...: structure=load_node(109)
...: builder.structure=structure
...: pseudo_family = load_group('SSSP/1.3/PBE/efficiency')
In [13]: pseudos = pseudo_family.get_pseudos(structure=structure)
In [14]: builder.pseudos = pseudos
In [15]: pseudos
Out[15]: {'Si': <UpfData: uuid: d1e944a9-c320-41a2-b486-78f0ff7e759c (pk: 17)>}

In [16]: builder
Out[16]:
Process class: PwCalculation
Inputs:
code: qe-7.2@hpc2
metadata:
options:
stash: {}
monitors: {}
pseudos:
Si: ''
structure: Si

Suspecting this to be an issue with either the aiida-quantumespresso or the aiida-pseudo package, I have tried to reinstall both the packages from the latest version available at GitHub, but the issue still persists.

Further, the tests (using aiida-quantumespresso) related to PW also fail
================================= short test summary info ==================================
FAILED tests/calculations/test_pw.py::test_pw_validate_inputs_restart_base[scf]- TypeError: exceptions must be derived from Warning, not <class 'NoneType'>
FAILED tests/calculations/test_pw.py::test_pw_validate_inputs_restart_base[relax]- TypeError: exceptions must be derived from Warning, not <class 'NoneType'>
FAILED tests/calculations/test_pw.py::test_pw_validate_inputs_restart_base[vc-relax]- TypeError: exceptions must be derived from Warning, not <class 'NoneType'>
FAILED tests/workflows/protocols/pw/test_base.py::test_overrides_key_check[overrides0-None]- TypeError: exceptions must be derived from Warning, not <class 'NoneType'>
FAILED tests/workflows/protocols/pw/test_base.py::test_overrides_key_check[overrides1-None]- TypeError: exceptions must be derived from Warning, not <class 'NoneType'>
FAILED tests/workflows/protocols/pw/test_base.py::test_overrides_key_check[overrides2-None]- TypeError: exceptions must be derived from Warning, not <class 'NoneType'>
FAILED tests/workflows/protocols/pw/test_base.py::test_overrides_key_check[overrides3-None]- TypeError: exceptions must be derived from Warning, not <class 'NoneType'>
FAILED tests/workflows/protocols/pw/test_base.py::test_overrides_key_check[overrides4-None]- TypeError: exceptions must be derived from Warning, not <class 'NoneType'>
FAILED tests/workflows/protocols/pw/test_base.py::test_overrides_key_check[overrides5-None]- TypeError: exceptions must be derived from Warning, not <class 'NoneType'>
FAILED tests/workflows/protocols/pw/test_relax.py::test_overrides_key_check[overrides0-None]- TypeError: exceptions must be derived from Warning, not <class 'NoneType'>
FAILED tests/workflows/protocols/pw/test_relax.py::test_overrides_key_check[overrides1-None]- TypeError: exceptions must be derived from Warning, not <class 'NoneType'>
FAILED tests/workflows/protocols/pw/test_relax.py::test_overrides_key_check[overrides2-None]- TypeError: exceptions must be derived from Warning, not <class 'NoneType'>
============ 12 failed, 525 passed, 2 skipped, 43 warnings in 542.66s (0:09:02) ============

Could someone suggest how to fix this?

Welcome @ansonthms! I fear the issue is in the representation of the builder in IPython/Jupyter notebooks. Try just running

builder.pseudos

And you’ll probably get the same output as before.

More technically: the __repr_pretty__ method of the ProcessBuilder class uses a custom JSONEncoder to print the builder contents, that relies on the get_description method of the nodes. But we haven’t implemented that yet for the pseudo potential nodes in aiida-pseudo. I’ll open an issue to track this.

2 Likes

Be careful with aiida-quantumespresso here! We’re currently working on a new major release on main, so there might be breaking changes.

Thank you @mbercx for your response.

Yes, builder.pseudos does respond correctly, however, the when printing out of just builder, it is not assigned.

In [17]: builder.pseudos
Out[17]: {‘Si’: <UpfData: uuid: d1e944a9-c320-41a2-b486-78f0ff7e759c (pk: 17)>}

In [18]: builder
Out[18]:
Process class: PwCalculation
Inputs:
code: qe-7.2@hpc2
metadata:
options:
stash: {}
monitors: {}
pseudos:
Si: ‘’
structure: Si

As I explained, that’s just an issue with how the builder is printed. I assure you the pseudos are there. :slight_smile:

I’ll ping you when I have a fix, so you can try the new aiida-pseudo branch and give feedback. It’s 9:45 pm where I am though (AEST), so that’ll likely be for tomorrow.

Much appreciated. Thank you so much

1 Like

Example usage from aiida-quantumespresso:

from aiida import orm, load_profile 

load_profile()

from ase.build import bulk
from aiida_quantumespresso.calculations.pw import PwCalculation

structure = orm.StructureData(ase=bulk('Si', 'fcc', 5.43))
pseudo_family = orm.load_group('SSSP/1.3/PBEsol/efficiency')

builder = PwCalculation.get_builder()
builder.pseudos = pseudo_family.get_pseudos(structure=structure)
builder

returns

Process class: PwCalculation
Inputs:
metadata:
  options:
    stash: {}
    unstash: {}
monitors: {}
pseudos:
  Si: '<UpfData[Si] (pk: 72)>'

Note that I also adapt the __repr__, so

builder.pseudos

returns

{'Si': <UpfData[Si] (pk: 72)>}

Note: released in v1.8.0

3 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.