Commit 3ce1eaaf authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

JSON encode MSection values for nomad specific optimade properties. #450

parent 55424fde
Pipeline #89633 passed with stages
in 28 minutes and 13 seconds
......@@ -30,7 +30,7 @@ import numpy as np
from nomad import config, datamodel, files
from import RFC3339DateTime
from nomad.normalizing.optimade import optimade_chemical_formula_reduced
from nomad.metainfo import Datetime, MEnum
from nomad.metainfo import Datetime, MEnum, MSection
from nomad.datamodel import EntryMetadata
from nomad.datamodel.dft import DFTMetadata
from nomad.datamodel.optimade import OptimadeEntry
......@@ -320,9 +320,14 @@ class EntryDataObject:
if request_field.startswith('_nmd_dft_'):
attrs[request_field] = getattr(calc.dft, request_field[9:])
response_value = getattr(calc.dft, request_field[9:])
attrs[request_field] = getattr(calc, request_field[5:])
response_value = getattr(calc, request_field[5:])
if isinstance(response_value, MSection):
response_value = response_value.m_to_dict()
attrs[request_field] = response_value
except AttributeError:
# if unknown properties where provided, we will ignore them
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment