Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
ce4d927f
Commit
ce4d927f
authored
Oct 01, 2020
by
Markus Scheidgen
Browse files
Avoid empty section_workflow.
parent
913f82c8
Pipeline
#83348
passed with stages
in 22 minutes and 20 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nomad/normalizing/workflow.py
View file @
ce4d927f
...
...
@@ -15,6 +15,7 @@
import
numpy
as
np
from
nomad.normalizing.normalizer
import
Normalizer
from
nomad.datamodel
import
EntryArchive
from
nomad.datamodel.metainfo.public
import
Workflow
,
GeometryOptimization
,
Phonon
,
Elastic
,
\
MolecularDynamics
...
...
@@ -344,10 +345,6 @@ class WorkflowNormalizer(Normalizer):
if
self
.
section_run
is
None
:
return
workflow
=
self
.
entry_archive
.
section_workflow
if
not
workflow
:
workflow
=
self
.
entry_archive
.
m_create
(
Workflow
)
workflow_type
=
None
if
self
.
entry_archive
.
section_workflow
:
workflow_type
=
self
.
entry_archive
.
section_workflow
.
workflow_type
...
...
@@ -358,6 +355,10 @@ class WorkflowNormalizer(Normalizer):
if
not
workflow_type
:
return
workflow
=
self
.
entry_archive
.
section_workflow
if
not
workflow
:
workflow
=
self
.
entry_archive
.
m_create
(
Workflow
)
workflow
.
workflow_type
=
workflow_type
if
workflow
.
workflow_type
==
'geometry_optimization'
:
...
...
@@ -371,3 +372,7 @@ class WorkflowNormalizer(Normalizer):
elif
workflow
.
workflow_type
==
'molecular_dynamics'
:
MolecularDynamicsNormalizer
(
self
.
entry_archive
).
normalize
()
# remove the section workflow again, if the parser/normalizer could not produce a result
if
workflow
.
calculation_result_ref
is
None
:
self
.
entry_archive
.
m_remove_sub_section
(
EntryArchive
.
section_workflow
,
-
1
)
tests/normalizing/test_workflow.py
View file @
ce4d927f
...
...
@@ -27,6 +27,12 @@ def workflow_archive():
return
_archive
def
test_no_workflow
(
workflow_archive
):
vasp_archive
=
workflow_archive
(
'parsers/vaspoutcar'
,
'tests/data/parsers/vasp_outcar/OUTCAR'
)
assert
vasp_archive
.
section_workflow
is
None
def
test_geometry_optimization_workflow
(
workflow_archive
):
vasp_archive
=
workflow_archive
(
'parsers/vasp'
,
'tests/data/normalizers/workflow/vasp/vasprun.xml'
)
...
...
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