Skip to content
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

Element symbols are now used when generating an ase atom. #1571

Merged

Conversation

JPBergsma
Copy link
Contributor

@JPBergsma JPBergsma commented Mar 25, 2023

A quick fix for the issue brought up in PR #1570
Previously, the species name was used for the element symbol when generating ase atoms. Now element symbols are used correctly.

@codecov
Copy link

codecov bot commented Mar 25, 2023

Codecov Report

Merging #1571 (6f75b8a) into master (d779725) will decrease coverage by 0.06%.
The diff coverage is 88.70%.

@@            Coverage Diff             @@
##           master    #1571      +/-   ##
==========================================
- Coverage   91.09%   91.04%   -0.06%     
==========================================
  Files          74       74              
  Lines        4538     4578      +40     
==========================================
+ Hits         4134     4168      +34     
- Misses        404      410       +6     
Flag Coverage Δ
project 91.04% <88.70%> (-0.06%) ⬇️
validator 90.93% <88.70%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
optimade/server/middleware.py 95.33% <ø> (+0.63%) ⬆️
optimade/server/query_params.py 98.27% <ø> (ø)
optimade/server/entry_collections/mongo.py 95.31% <50.00%> (-1.47%) ⬇️
optimade/server/entry_collections/elasticsearch.py 95.55% <85.71%> (-1.98%) ⬇️
...made/server/entry_collections/entry_collections.py 95.88% <90.00%> (-1.96%) ⬇️
optimade/__init__.py 100.00% <100.00%> (ø)
optimade/adapters/structures/ase.py 98.63% <100.00%> (ø)
optimade/server/entry_collections/__init__.py 100.00% <100.00%> (ø)
optimade/server/routers/utils.py 95.93% <100.00%> (-0.04%) ⬇️
optimade/validator/utils.py 94.59% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@JPBergsma JPBergsma merged commit a057328 into Materials-Consortia:master Mar 25, 2023
12 checks passed
@@ -87,7 +87,9 @@ def get_ase_atoms(optimade_structure: OptimadeStructure) -> Atoms:
if current_species.mass:
mass = current_species.mass[0]
Copy link
Member

@ml-evs ml-evs Mar 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could probably do with an additional check for partial/multiple occupancy here, e.g.,

Suggested change
mass = current_species.mass[0]
mass = current_species.mass[0]
if len(current_species.chemical_symbols) != 1:
raise RuntimeError

Copy link
Contributor Author

@JPBergsma JPBergsma Mar 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle, the disorder flag should be set in the structure_features when more than 1 element is present in a species.chemical_symbols.
And we already check for this. Do you want me to make an additional check for the fields that could potentially have more than 1 value ? i.e. mass and chemical symbols ?

PS. I do not think it is possible to generate a StructureResource object which has multiple entries for chemical_symblos or mass without also setting disorder. So I do not think this test is necessary.

@JPBergsma JPBergsma deleted the JPBergsma_fix_atom_symbol_ase branch March 27, 2023 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants