diff --git a/nomad/metainfo/encyclopedia.py b/nomad/metainfo/encyclopedia.py index ffe297d16d4f7588fc74d385e4e4aa84bb00c4f2..74de781fe4623a525a7c16af6b18db86899e7ea7 100644 --- a/nomad/metainfo/encyclopedia.py +++ b/nomad/metainfo/encyclopedia.py @@ -235,8 +235,8 @@ class Material(MSection): a_flask=dict(skip_none=True), a_elastic=dict(type=InnerDoc), description=""" - Section for storing the data that links an Encyclopedia entry into a - specific material. + Contains an overview of the type of material that was detected in this + entry. """ ) material_type = Quantity( @@ -294,11 +294,12 @@ class Method(MSection): a_flask=dict(skip_none=True), a_elastic=dict(type=InnerDoc), description=""" - Section for storing Encyclopedia-specific method information. + Contains an overview of the methodology that was detected in this + entry. """ ) method_type = Quantity( - type=MEnum("DFT", "GW", "unavailable", DFTU="DFT+U", ), + type=MEnum("DFT", "GW", "unavailable", DFTU="DFT+U"), description=""" Generic name for the used methodology. """ @@ -309,18 +310,6 @@ class Method(MSection): Basic type of the used basis set. """ ) - code_name = Quantity( - type=str, - description=""" - Name of the code used to perform the calculation. - """ - ) - code_version = Quantity( - type=str, - description=""" - Version of the code used for the calculation. - """ - ) core_electron_treatment = Quantity( type=MEnum("full all electron", "all electron frozen core", "pseudopotential", "unavailable"), description=""" @@ -397,7 +386,8 @@ class Calculation(MSection): a_flask=dict(skip_none=True), a_elastic=dict(type=InnerDoc), description=""" - Section for storing Encyclopedia-specific calculation information. + Contains an overview of the type of calculation that was detected in + this entry. """ ) calculation_type = Quantity( @@ -616,8 +606,8 @@ class Properties(MSection): a_flask=dict(skip_none=True), a_elastic=dict(type=InnerDoc), description=""" - Section for storing all calculation-specific physical quantities that - are used by the NOMAD Encyclopedia. + Contains derived physical properties that are specific to the NOMAD + Encyclopedia. """ ) atomic_density = Quantity( @@ -631,14 +621,13 @@ class Properties(MSection): type=float, unit=units.kg / units.m**3, description=""" - Mass density of the material based on the structural information. + Mass density of the material. """ ) energies = Quantity( type=str, description=""" - Code dependent energy values in the JSON format, corrected to be per - formula unit. + Code dependent energy values, corrected to be per formula unit. """ ) electronic_band_structure = SubSection(sub_section=ElectronicBandStructure.m_def, repeats=False) diff --git a/nomad/normalizing/encyclopedia.py b/nomad/normalizing/encyclopedia.py index 75a1a99eb5d9ef81cfdc222d78cf78359b94d803..e851cf302a50242b6f7dba67a1d57448b30aa402 100644 --- a/nomad/normalizing/encyclopedia.py +++ b/nomad/normalizing/encyclopedia.py @@ -1031,12 +1031,6 @@ class MethodNormalizer(): self.backend = backend self.logger = logger - def code_name(self, method: Method) -> None: - method.code_name = self.backend["program_name"] - - def code_version(self, method: Method) -> None: - method.code_version = self.backend["program_version"] - def method_hash(self, method: Method, settings_basis_set: RestrictedDict, repr_method: Section): method_dict = RestrictedDict( mandatory_keys=[ @@ -1045,7 +1039,7 @@ class MethodNormalizer(): ], forbidden_values=[None] ) - method_dict['program_name'] = method.code_name + method_dict['program_name'] = self.backend["program_name"] # The subclasses may define their own method properties that are to be # included here. @@ -1108,8 +1102,8 @@ class MethodNormalizer(): param_dict['upload_id'] = self.backend["section_entry_info"][0]["upload_id"] # The same code and functional type is required - param_dict['program_name'] = method.code_name - param_dict['program_version'] = method.code_version + param_dict['program_name'] = self.backend["program_name"] + param_dict['program_version'] = self.backend["program_version"] # Get a string representation of the geometry. It is included as the # geometry should remain the same during parameter variation. By simply @@ -1163,36 +1157,9 @@ class MethodDFTNormalizer(MethodNormalizer): """A base class that is used for processing method related information in the Encylopedia. """ - def basis_set_type(self, method: Method) -> None: - """Type of basis set used by the code""" - basis_set_type = config.services.unavailable_value - archive_basis_set = self.backend["program_basis_set_type"] - # TODO: this translation should not be necessary if parsers did their - # work correctly (using the metainfo doc as reference) until then we - # keep this mapping. - basis_set_type_ambiguity = { - "numeric AOs": "Numeric AOs", - "gaussians": "Gaussians", - "plane waves": "Plane waves", - "plane_waves": "Plane waves", - "real-space grid": "Real-space grid" - } - if archive_basis_set in basis_set_type_ambiguity: - self.logger.info( - "Basis set type '{}' does not correspond to valid options in " - "metainfo documentation and was corrected." - .format(basis_set_type) - ) - archive_basis_set = basis_set_type_ambiguity[archive_basis_set] - - if archive_basis_set is not None: - basis_set_type = archive_basis_set - - method.basis_set_type = basis_set_type - def core_electron_treatment(self, method: Method) -> None: treatment = config.services.unavailable_value - code_name = method.code_name + code_name = self.backend["program_name"] if code_name is not None: core_electron_treatments = { 'VASP': 'pseudopotential', @@ -1267,22 +1234,6 @@ class MethodDFTNormalizer(MethodNormalizer): short_name = self.create_xc_functional_shortname(long_name) method.functional_type = short_name - def smearing_kind(self, method: Method, representative_method: Section) -> None: - try: - smearing_kind = representative_method['smearing_kind'] - except KeyError: - pass - else: - method.smearing_kind = smearing_kind - - def smearing_parameter(self, method: Method, representative_method) -> None: - try: - smearing_width = representative_method['smearing_width'] - except KeyError: - pass - else: - method.smearing_parameter = smearing_width - def method_hash_dict(self, method: Method, settings_basis_set: RestrictedDict, repr_method: Section) -> RestrictedDict: # Extend by DFT settings. hash_dict = RestrictedDict( @@ -1293,7 +1244,7 @@ class MethodDFTNormalizer(MethodNormalizer): ), optional_keys=( "smearing_kind", - "smearing_parameter", + "smearing_width", "number_of_eigenvalues_kpoints", ), forbidden_values=[None] @@ -1309,11 +1260,13 @@ class MethodDFTNormalizer(MethodNormalizer): # _reducible_ k-point-mesh: # - grid dimensions (e.g. [ 4, 4, 8 ]) # - or list of reducible k-points - if method.smearing_kind is not None: - hash_dict['smearing_kind'] = method.smearing_kind - if method.smearing_parameter is not None: - smearing_parameter = '%.4f' % (method.smearing_parameter * J_to_Ry) - hash_dict['smearing_parameter'] = smearing_parameter + smearing_kind = repr_method.get('smearing_kind') + if smearing_kind is not None: + hash_dict['smearing_kind'] = smearing_kind + smearing_width = repr_method.get('smearing_width') + if smearing_width is not None: + smearing_width = '%.4f' % (smearing_width * J_to_Ry) + hash_dict['smearing_width'] = smearing_width try: scc = self.backend[s_scc][-1] eigenvalues = scc['eigenvalues'] @@ -1427,14 +1380,9 @@ class MethodDFTNormalizer(MethodNormalizer): settings_basis_set = get_basis_set_settings(context, self.backend, self.logger) # Fill metainfo - self.basis_set_type(method) - self.code_name(method) - self.code_version(method) self.core_electron_treatment(method) self.functional_long_name(method, repr_method) self.functional_type(method) - self.smearing_kind(method, repr_method) - self.smearing_parameter(method, repr_method) self.method_hash(method, settings_basis_set, repr_method) self.group_eos_hash(method, material, repr_method) self.group_parametervariation_hash(method, settings_basis_set, repr_system, repr_method) @@ -1470,8 +1418,6 @@ class MethodGWNormalizer(MethodDFTNormalizer): method = sec_enc.method # Fill metainfo - self.code_name(method) - self.code_version(method) self.functional_type(method) self.gw_type(method, context.representative_method) self.gw_starting_point(method, repr_method) diff --git a/tests/normalizing/test_encyclopedia.py b/tests/normalizing/test_encyclopedia.py index 6a8533369e7318df3cd18671497f97c40f66b083..44b04673bd2239894ee6205525785cfa7518d335 100644 --- a/tests/normalizing/test_encyclopedia.py +++ b/tests/normalizing/test_encyclopedia.py @@ -461,18 +461,13 @@ def test_2d_structure_structure_at_cell_boundary(): def test_method_dft_metainfo(single_point): enc = single_point.get_mi2_section(Encyclopedia.m_def) - assert enc.method.basis_set_type == "Numeric AOs" assert enc.method.core_electron_treatment == "full all electron" - assert enc.method.code_name == "FHI-aims" - assert enc.method.code_version == "010314" assert enc.method.functional_long_name == "GGA_C_PBE+GGA_X_PBE" assert enc.method.functional_type == "GGA" def test_method_gw_metainfo(gw): enc = gw.get_mi2_section(Encyclopedia.m_def) - assert enc.method.code_name == "FHI-aims" - assert enc.method.code_version == "180607" assert enc.method.gw_type == "G0W0" assert enc.method.gw_starting_point == "GGA_C_PBE+0.75*GGA_X_PBE+0.25*HF_X"