From 67b8b7a75fe67d40dfcd3c82cb42fbab139ce2fb Mon Sep 17 00:00:00 2001 From: JosePizarro3 Date: Wed, 24 Apr 2024 10:30:49 +0200 Subject: [PATCH] Added run and workflow2 schemas to yaml Fix testing --- nomad.yaml | 8 +++++++- src/nomad_parser_magres/parser.py | 2 +- tests/test_parser.py | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/nomad.yaml b/nomad.yaml index 2c64878..72737f3 100644 --- a/nomad.yaml +++ b/nomad.yaml @@ -8,6 +8,12 @@ plugins: # to make all default plugins work. include: - 'parsers/magres' + - 'runschema' + - 'simulationworkflowschema' options: parsers/magres: - python_package: nomad_parser_magres \ No newline at end of file + python_package: nomad_parser_magres + runschema: + python_package: runschema + simulationworkflowschema: + python_package: simulationworkflowschema \ No newline at end of file diff --git a/src/nomad_parser_magres/parser.py b/src/nomad_parser_magres/parser.py index 8df36c5..f73313e 100644 --- a/src/nomad_parser_magres/parser.py +++ b/src/nomad_parser_magres/parser.py @@ -445,7 +445,7 @@ def parse(self, filepath, archive, logger): # Create Run with Program information sec_run = Run() - calculation_params = self.magres_file_parser.get('calculation') + calculation_params = self.magres_file_parser.get('calculation', {}) program_name = calculation_params.get('code', '') if program_name != 'CASTEP': self.logger.error( diff --git a/tests/test_parser.py b/tests/test_parser.py index 4894e08..b8fb828 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -18,6 +18,7 @@ import pytest import numpy as np +import os from nomad.datamodel import EntryArchive from nomad_parser_magres.parser import MagresParser @@ -35,11 +36,10 @@ def parser(): def test_single_point_ethanol(parser): archive = EntryArchive() parser.parse( - '/home/josepizarro/nomad-parser-magres/tests/data/ethanol_nmr.magres', + os.path.join(os.path.dirname(__file__), 'data/ethanol_nmr.magres'), archive, None, ) - # parser.parse('tests/data/magres/ethanol_nmr.magres', archive, None) sec_run = archive.run[-1] # Program testing