Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
f5f6b644
Commit
f5f6b644
authored
Jan 12, 2021
by
Markus Scheidgen
Browse files
Fixed handling for nperiodic_dimensions = 0.
#461
parent
0b0c4750
Changes
2
Hide whitespace changes
Inline
Side-by-side
nomad/app_fastapi/optimade/elasticsearch.py
View file @
f5f6b644
...
...
@@ -140,10 +140,7 @@ class ElasticsearchStructureCollection(EntryCollection):
def
include
(
key
):
return
response_fields
is
None
or
(
key
in
response_fields
)
or
not
key
.
startswith
(
'_'
)
attrs
=
{
key
:
value
for
key
,
value
in
entry
.
dft
.
optimade
.
m_to_dict
().
items
()
if
include
(
key
)}
attrs
=
entry
.
dft
.
optimade
.
m_to_dict
()
if
include
(
'immutable_id'
):
attrs
[
'immutable_id'
]
=
calc_id
...
...
@@ -165,6 +162,8 @@ class ElasticsearchStructureCollection(EntryCollection):
elif
isinstance
(
dimension_types
,
list
):
attrs
[
'nperiodic_dimensions'
]
=
sum
(
dimension_types
)
attrs
=
{
key
:
value
for
key
,
value
in
attrs
.
items
()
if
include
(
key
)}
if
response_fields
is
not
None
:
for
request_field
in
response_fields
:
if
not
request_field
.
startswith
(
'_nmd_'
):
...
...
nomad/normalizing/optimade.py
View file @
f5f6b644
...
...
@@ -51,7 +51,9 @@ def transform_to_v1(entry: EntryMetadata) -> EntryMetadata:
optimade
.
chemical_formula_hill
=
optimade_chemical_formula_hill
(
optimade
.
chemical_formula_hill
)
optimade
.
chemical_formula_descriptive
=
optimade
.
chemical_formula_hill
dimension_types
=
optimade
.
dimension_types
if
isinstance
(
dimension_types
,
int
):
if
dimension_types
is
None
:
optimade
.
dimension_types
=
[
0
,
0
,
0
]
elif
isinstance
(
dimension_types
,
int
):
optimade
.
dimension_types
=
[
1
]
*
dimension_types
+
[
0
]
*
(
3
-
dimension_types
)
return
entry
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment