-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XspectraCrystalWorkChain
: Enable Symmetry Data Inputs
#1028
XspectraCrystalWorkChain
: Enable Symmetry Data Inputs
#1028
Conversation
Hi @superstar54, not sure what the issue with the docs is. If you could take a look at it (or ask someone who would know more about it), that would be much appreciated. As always, I'm available to make changes as requested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @PNOGillespie for the PR. I added a few minor suggestions.
Changes requested for PR aiidateam#1028: * Small refactor of input validation code to condense checks into fewer lines. * Re-arranged checks to ensure that `site_index` validation occurs *after* `required_keys` are checked. Previous behaviour would not indicate which entry/entries were missing the `site_index` * Fixed a small formatting error in the error message for mismatch in absorbing elements.
Hi @superstar54, thanks for the review. I've committed your suggestions, as well as a couple of other things which I noticed on taking a second look at the input validation steps. let me know if you need anything else. |
Hi @superstar54, let me know if there are any other changes that you think are necessary for this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @PNOGillespie , please fix the failed test, and then we can merge.
Hi @superstar54. Looking at the output from the failed test, it seems to be a more general issue with the GitHub workflow - I see exactly the same thing in the recent PR by @yakutovicha (#1029). Unfortunately, I don't know what the problem is. When I compile the docs in my docker container, everything runs fine, but here it returns a few errors:
Do we know anyone who might be able to diagnose and fix the problem? |
Hi @mbercx , Could you please help check why the docs failed? |
help=( | ||
'Input namespace to define equivalent sites and spacegroup number for the system. If defined, will ' | ||
+ 'skip symmetry analysis and structure standardization. Use *only* if symmetry data are known' | ||
+ 'for certain. Requires ``spacegroup_number`` (Int) and ``equivalent_sites_data`` (Dict) to be' | ||
+ 'defined separately. All keys in `equivalent_sites_data` must be formatted as "site_<site_index>".' | ||
+ 'See docstring of `get_xspectra_structures` for more information about inputs.' | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure the +
signs are superfluous since all strings are encapsulated by ()
help=( | |
'Input namespace to define equivalent sites and spacegroup number for the system. If defined, will ' | |
+ 'skip symmetry analysis and structure standardization. Use *only* if symmetry data are known' | |
+ 'for certain. Requires ``spacegroup_number`` (Int) and ``equivalent_sites_data`` (Dict) to be' | |
+ 'defined separately. All keys in `equivalent_sites_data` must be formatted as "site_<site_index>".' | |
+ 'See docstring of `get_xspectra_structures` for more information about inputs.' | |
) | |
) | |
help=( | |
'Input namespace to define equivalent sites and spacegroup number for the system. If defined, will ' | |
'skip symmetry analysis and structure standardization. Use *only* if symmetry data are known ' | |
'for certain. Requires ``spacegroup_number`` (Int) and ``equivalent_sites_data`` (Dict) to be ' | |
'defined separately. All keys in `equivalent_sites_data` must be formatted as "site_<site_index>". ' | |
'See docstring of `get_xspectra_structures` for more information about inputs.' | |
) | |
) |
raise ValidationError( | ||
f'Input spacegroup number ({spacegroup_number}) outside of valid range (1-230).' | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice that the rest of the validator also raises exceptions, but the proper usage of a port validator is to return a string in case of a problem. So all raise ValidationError
should simply be replaced by return
.
Changes requested for PR aiidateam#1028 (2) Corrects error handling behaviour for `validate_inputs` to use `return` rather than `raise`. Also fixes minor formatting errors in `symmetry_data` `help` entry and removes unnecessary uses of `+`.
Hi @superstar54 and @sphuber, thanks to both of you for the feedback. I've added @sphuber's proposed changes (as well as fixing a little formatting whoopsy that I spotted in the Let me know if any other changes are needed. |
Adds an input namespace for the `XspectraCrystalWorkChain` which allows the user to define the spacegroup and equivalent sites data for the incoming structure, thus instructing the WorkChain to generate structures and run calculations for only the sites specified. Changes: * Adds the `symmetry_data` input namespace to `XspectraCrystalWorkChain`, which the `WorkChain` will use to generate structures and set the list of polarisation vectors to calculate. * Adds input validation steps for the symmetry data to check for required information and for entries which may cause a crash, though does not check for issues beyond this in order to maximise flexibility of use. * Fixes an oversight in `get_xspectra_structures` where the `supercell` entry was not returned to the outputs when external symmetry data were provided by the user.
Changes requested for PR aiidateam#1028: * Small refactor of input validation code to condense checks into fewer lines. * Re-arranged checks to ensure that `site_index` validation occurs *after* `required_keys` are checked. Previous behaviour would not indicate which entry/entries were missing the `site_index` * Fixed a small formatting error in the error message for mismatch in absorbing elements.
Co-authored-by: Xing Wang <[email protected]>
Changes requested for PR aiidateam#1028 (2) Corrects error handling behaviour for `validate_inputs` to use `return` rather than `raise`. Also fixes minor formatting errors in `symmetry_data` `help` entry and removes unnecessary uses of `+`.
e741275
to
28d10f5
Compare
Thanks @PNOGillespie |
Adds an input namespace for the `XspectraCrystalWorkChain` which allows the user to define the spacegroup and equivalent sites data for the incoming structure, thus instructing the WorkChain to generate structures and run calculations for only the sites specified. Changes: * Adds the `symmetry_data` input namespace to `XspectraCrystalWorkChain`, which the `WorkChain` will use to generate structures and set the list of polarisation vectors to calculate. * Adds input validation steps for the symmetry data to check for required information and for entries which may cause a crash, though does not check for issues beyond this in order to maximise flexibility of use. * Fixes an oversight in `get_xspectra_structures` where the `supercell` entry was not returned to the outputs when external symmetry data were provided by the user.
Overview
In this PR we add an input namespace for the
XspectraCrystalWorkChain
which allows the user to define the spacegroup and equivalent sites data for the incoming structure, thus instructing the WorkChain to generate structures and run calculations for only the sites specified. The newsymmetry_data
input requires entries for the system's spacegroup number (Int) and equivalent sites data (Dict). The former must simply be a valid spacegroup number (1-230) while the latter must contain an entry for each site (in the formatsite_<index>_<element>
), where the minimal data required are thekind_name
,element
,site_index
, andmultiplicity
.In order to not be too restrictive on the user and make it easier to use external packages to build input symmetry data, we limit input validation to simple checks which ensure that the required data are present and that the data provided won't cause an obvious crash. Thus beyond the minimum required information, any extra data provided in the entries of the
equivalent_sites_data
node will be kept in case they may be needed by the user outside of theWorkChain
(e.g. the list of symmetrically equivalent sites, which theWorkChain
doesn't need).Changes
symmetry_data
input namespace toXspectraCrystalWorkChain
, which theWorkChain
will use to generate structures and set the list of polarisation vectors to calculate.get_xspectra_structures
where thesupercell
entry was not returned to the outputs when external symmetry data were provided by the user.