Skip to content

Commit 2f1ea4b

Browse files
committed
Added aflow parser, minor fix to metainfo
1 parent 932ad40 commit 2f1ea4b

File tree

10 files changed

+471
-84
lines changed

10 files changed

+471
-84
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,6 @@
207207
[submodule "dependencies/parsers/xps"]
208208
path = dependencies/parsers/xps
209209
url = https://github.com/nomad-coe/nomad-parser-xps.git
210+
[submodule "dependencies/parsers/aflow"]
211+
path = dependencies/parsers/aflow
212+
url = https://github.com/nomad-coe/nomad-parser-aflow.git

dependencies/parsers/aflow

Submodule aflow added at 012e25e

nomad/datamodel/metainfo/simulation/calculation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,7 @@ class BaseCalculation(MSection):
14721472
categories=[FastAccess])
14731473

14741474
n_references = Quantity(
1475-
type=np.dtype(np.float64),
1475+
type=np.dtype(np.int32),
14761476
shape=[],
14771477
description='''
14781478
Number of references to the current section calculation.

nomad/datamodel/metainfo/simulation/run.py

+26-38
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from nomad.datamodel.metainfo.simulation.method import Method
2525
from nomad.datamodel.metainfo.simulation.system import System
2626
from nomad.datamodel.metainfo.simulation.calculation import Calculation
27-
27+
from nomad.datamodel.metainfo.common import FastAccess
2828

2929
m_package = Package()
3030

@@ -175,41 +175,6 @@ class MessageRun(MSection):
175175
''')
176176

177177

178-
class RunReference(MSection):
179-
'''
180-
Section that describes the relationship between the current section to other run
181-
sections.
182-
183-
The kind of relationship between the the current section and the referenced section
184-
run is described by kind. The referenced section is given by value (typically used for
185-
a run section in the same archive) or external_url.
186-
'''
187-
188-
m_def = Section(validate=False)
189-
190-
external_url = Quantity(
191-
type=str,
192-
shape=[],
193-
description='''
194-
URL used to reference an externally stored run section.
195-
''')
196-
197-
kind = Quantity(
198-
type=str,
199-
shape=[],
200-
description='''
201-
Defines the kind of relationship between the referenced section run with the
202-
present section.
203-
''')
204-
205-
value = Quantity(
206-
type=Reference(SectionProxy('Run')),
207-
shape=[],
208-
description='''
209-
Value of the referenced section run.
210-
''')
211-
212-
213178
class Run(MSection):
214179
'''
215180
Every section run represents a single call of a program.
@@ -240,6 +205,31 @@ class Run(MSection):
240205
An optional calculation id, if one is found in the code input/output files.
241206
''')
242207

208+
starting_run_ref = Quantity(
209+
type=Reference(SectionProxy('Run')),
210+
shape=[],
211+
description='''
212+
Links the current section run to a section run containing the calculations from
213+
which the current section starts.
214+
''',
215+
categories=[FastAccess])
216+
217+
n_references = Quantity(
218+
type=np.dtype(np.int32),
219+
shape=[],
220+
description='''
221+
Number of references to the current section calculation.
222+
''')
223+
224+
runs_ref = Quantity(
225+
type=Reference(SectionProxy('Run')),
226+
shape=['n_references'],
227+
description='''
228+
Links the the current section to other run sections. Such a link is necessary for
229+
example for workflows that may contain a series of runs.
230+
''',
231+
categories=[FastAccess])
232+
243233
program = SubSection(sub_section=Program.m_def)
244234

245235
time_run = SubSection(sub_section=TimeRun.m_def)
@@ -252,7 +242,5 @@ class Run(MSection):
252242

253243
calculation = SubSection(sub_section=Calculation.m_def, repeats=True)
254244

255-
run_ref = SubSection(sub_section=RunReference.m_def, repeats=True)
256-
257245

258246
m_package.__init_metainfo__()

nomad/datamodel/metainfo/workflow.py

+26-41
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Reference, MEnum, derived)
77
from nomad.metainfo.search_extension import Search
88
from nomad.datamodel.metainfo.simulation.calculation import Calculation
9-
from nomad.datamodel.metainfo.simulation.run import RunReference
9+
from nomad.datamodel.metainfo.simulation.run import Run
1010
from .common import FastAccess
1111

1212

@@ -1141,40 +1141,6 @@ class SinglePoint(MSection):
11411141
''')
11421142

11431143

1144-
class WorkflowReference(MSection):
1145-
'''
1146-
Section that provides a link between a section to a section workflow. Such a link is
1147-
necessary for example between an Debye model that uses a the poisson ratio calculated
1148-
from an elastic workflow. The relationship should be described by kind and the
1149-
referred section workflow is given by value. An external url can also be provided in
1150-
place of value.
1151-
'''
1152-
1153-
m_def = Section(validate=False)
1154-
1155-
kind = Quantity(
1156-
type=str,
1157-
shape=[],
1158-
description='''
1159-
Defines the relationship between the referenced section workflow and the present
1160-
section.
1161-
''')
1162-
1163-
external_url = Quantity(
1164-
type=str,
1165-
shape=[],
1166-
description='''
1167-
URL used to reference an externally stored section workflow.
1168-
''')
1169-
1170-
value = Quantity(
1171-
type=Reference(SectionProxy('Workflow')),
1172-
shape=[],
1173-
description='''
1174-
Value of the referenced section wofklow.
1175-
''')
1176-
1177-
11781144
class Workflow(MSection):
11791145
'''
11801146
Section containing the results of a workflow.
@@ -1224,6 +1190,31 @@ class Workflow(MSection):
12241190
simulation.
12251191
''')
12261192

1193+
run_ref = Quantity(
1194+
type=Reference(Run.m_def),
1195+
shape=[],
1196+
description='''
1197+
Links the section workflow to the section run that contains the calculations.
1198+
''',
1199+
categories=[FastAccess])
1200+
1201+
n_references = Quantity(
1202+
type=np.dtype(np.int32),
1203+
shape=[],
1204+
description='''
1205+
Number of references to the current section workflow.
1206+
''')
1207+
1208+
workflows_ref = Quantity(
1209+
type=Reference(SectionProxy('Workflow')),
1210+
shape=['n_references'],
1211+
description='''
1212+
Links the the current section to other workflow sections. Such a link is necessary
1213+
for example between an Debye model that uses a the poisson ratio calculated
1214+
from an elastic workflow.
1215+
''',
1216+
categories=[FastAccess])
1217+
12271218
single_point = SubSection(
12281219
sub_section=SinglePoint.m_def,
12291220
# TODO determine if there is a need for this to be a repeating section
@@ -1280,9 +1271,3 @@ class Workflow(MSection):
12801271
thermodynamics = SubSection(
12811272
sub_section=Thermodynamics.m_def,
12821273
repeats=False)
1283-
1284-
workflow_ref = SubSection(
1285-
sub_section=WorkflowReference.m_def, repeats=True)
1286-
1287-
run_ref = SubSection(
1288-
sub_section=RunReference.m_def, repeats=True)

nomad/normalizing/workflow.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def set_thermo_property(name):
383383
values.append(quantity.magnitude if hasattr(quantity, 'magnitude') else quantity)
384384
except Exception:
385385
pass
386-
unit = quantity.unit if hasattr(quantity, 'unit') else 1.0
386+
unit = quantity.units if hasattr(quantity, 'units') else 1.0
387387
setattr(self.section, name, np.array(values) * unit)
388388

389389
if not self.section.temperature:

nomad/parsing/parsers.py

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
from openkimparser import OpenKIMParser
7373
from xpsparser import XPSParser
7474
from eelsdbparser import EELSDBParser
75+
from aflowparser import AFLOWParser
7576
# TODO
7677
# from mpesparser import MPESParser
7778
# from aptfimparser import APTFIMParser
@@ -216,6 +217,7 @@ def match_parser(mainfile_path: str, strict=True) -> Parser:
216217
# APTFIMParser(),
217218
EELSDBParser(),
218219
XPSParser(),
220+
AFLOWParser(),
219221
ArchiveParser()
220222
]
221223

0 commit comments

Comments
 (0)