aiidateam / qe-tools

A set of useful tools for Quantum ESPRESSO
MIT License
29 stars 14 forks source link

Add consistency check in the ATOMIC_SPECIES card block #53

Closed elsapassaro closed 3 years ago

elsapassaro commented 3 years ago

Validate species names in the ATOMIC_SPECIES card block. This will check that the atom names and the species names parsed from the pseudopotential file names are the same up to an optional underscore and/or optional digits.

greschd commented 3 years ago

The test failure looks like something I should look into.

Edit: Fixed in #55

elsapassaro commented 3 years ago

Thanks @greschd, I've addressed your comments and added a test for the "failing" parsing.

Regarding the test for the case validate_species_names=False, I get the expected InputValidationError when I try to create the reference file with ./test_parsers.py --write-ref non_matching_species. One thing I can do is to create the reference json using the code of the print_test_comparison function. Or I could modify the function here to add a validate_species_names parameter.

greschd commented 3 years ago

One thing I can do is to create the reference json using the code of the print_test_comparison function. Or I could modify the function here to add a validate_species_names parameter.

I think it would be ok to either add a flag, or just hard-code validate_species_names=False in the print_test_comparison function. Up to you if you want to add that to this PR.

elsapassaro commented 3 years ago

I've just set validate_species_names=False here, since if the test is supposed to fail there's no need for creating the json comparison.

greschd commented 3 years ago

I've just set validate_species_names=False here, since if the test is supposed to fail there's no need for creating the json comparison.

Perfect, thanks again @asle85!