siesta-project / aiida_siesta_plugin

Source code for the AiiDA-Siesta package (plugin and workflows). See wiki
Other
6 stars 11 forks source link

about the example_bandgap.py #127

Open zc994646659 opened 1 month ago

zc994646659 commented 1 month ago

Hello developer,

my aiida-core is 2.5.1.post0, aiida-siesta is 2.0.0

I've configured my computer and code, and I want to run runaiida example_bandgap.py siesta@shuguang. However, it seems to be reporting a pseudopotential issue:

ValueError: Error occurred validating port 'inputs.pseudos.Si': Invalid type <class 'aiida.orm.nodes.data.data.Data'> for dynamic port value: expected (<class 'aiida_pseudo.data.pseudo.psf.PsfData'>, <class 'aiida_pseudo.data.pseudo.psml.PsmlData'>) I've already read the ../00_readme and configured:

aiida-pseudo list Label Type string Count


psf_family pseudo.family 7 PseudoDojo/0.4/PBE/SR/standard/psml pseudo.family.pseudo_dojo 72

So, how can I resolve this error?

bosonie commented 1 month ago

Hello @zc994646659 . Are we talking about the example in aiida_siesta_plugin/aiida_siesta/examples/workflows ??? I just tried myself runaiida example_bandgap.py siesta_basic@localhost on my computer and it works fine. That particular example, does not use pseudo families for the pseudopotentials, but it retrieves the pseudo from the folder aiida_siesta_plugin/aiida_siesta/examples/fixtures/sample_psf, so there shouldn't be any difficulty there.

The only difference between your environment and mine is that I have aiida-core==2.5.1. You are using a development branch and it is impossible for me to have your exact version of aiida-core unless you send me info on the last commit of the aiida-core development. In any case, it is highly recommended to always use a stable version of aiida-core, unless you are testing new features. In conclusion, my suggestion is to pip install aiida-core==2.5.1 and try to run the example again. In case this does not work, we will investigate further.

zc994646659 commented 1 month ago

Hello @bosonie ,

I have updated the following:

aiida-core 2.5.1 aiida-optimize 1.0.2 aiida-pseudo 1.5.0 aiida-siesta 2.0.0

However, it still shows a problem. When I run runaiida example_bandgap.py siesta@shuguang, it outputs:

/opt/conda/lib/python3.10/site-packages/aiida_siesta/calculations/siesta.py:136: AiidaDeprecationWarning: KpointsData.get_attribute is deprecated, use KpointsData.base.attributes.get instead. (this will be removed in v3) mesh = value.get_attribute("mesh", None) Submitted workchain; ID=99 For information about this workchain type: verdi process show 99

When I run verdi process show 99, I get:

state Excepted <ValueError: Error occurred validating port 'inputs.pseudos.Si': Invalid type <class 'aiida.orm.nodes.data.data.Data'> for dynamic port value: expected (<class 'aiida_pseudo.data.pseudo.psf.PsfData'>, <class 'aiida_pseudo.data.pseudo.psml.PsmlData'>)>

Is there something wrong with my configuration or something I overlooked? I just want to run a simple example, but I encountered this issue. I appreciate your quick feedback.

zhouchao

bosonie commented 1 month ago

Hello, let's try a bit of debugging. This is the code that generates the pseudos. Please open verdi shell and run it MAKING SURE you are in the folder aiida_siesta_plugin/aiida_siesta/examples/workflows

import os.path as op
from aiida_pseudo.data.pseudo.psf import PsfData
pseudos_dict = {}
raw_pseudos = [("Si.psf", ['Si'])]
for fname, kinds in raw_pseudos:
    absname = op.realpath(op.join("../fixtures/sample_psf", fname))
    pseudo = PsfData.get_or_create(absname)
    if not pseudo.is_stored:
        print(f"\nCreated the pseudo for {kinds}")
    else:
        print(f"\nUsing the pseudo for {kinds} from DB: {pseudo.pk}")
    for j in kinds:
        pseudos_dict[j]=pseudo

What is the result? In the pseudos_dict there should be a pseudo for Si, that is of type PsfData. I suspect instead you might see a pseudo of type Data. Once that is confirmed, can you please run the same code above, replacing the raw_pseudos = [("Si.psf", ['Si'])] with raw_pseudos = [("H.psf", ['H'])]? What is the result now? Thanks.

zc994646659 commented 1 month ago

Thanks @bosonie , It seems there are no issues. I followed your instructions and ran the code in verdi shell. The output was:

Using the pseudo for ['Si'] from DB: 4 After changing to H, it output:

Using the pseudo for ['H'] from DB: 6

Everything seems fine. Could it be a configuration issue with my machine?
Thanks!

zc994646659 commented 1 month ago

@bosonie My outputs appear normal, but the code is still not running as expected, which is quite frustrating. It is unclear where the problem lies. Could the issue be with the configuration submitted to the remote server?

bosonie commented 1 month ago

Actually, this is not what I was expecting... Can you please tell me the content of the pseudos_dict variable after running the code I wrote the other day.. I believe your pseudos are not set up correctly.... Your pseudos should be instances of PsfData.

bosonie commented 4 weeks ago

@zc994646659 in any case, for sure you can solve the problem deleting all the psf pseudo you set up and running the code again. The code is created to automatically deal with the pseudos, there is no need to do anything in advance for the case you want to run. Other examples use pseudo families, but this is not what we are talking about here.