diff --git a/nomad/metainfo/encyclopedia.py b/nomad/metainfo/encyclopedia.py index b6a06b42e3e5a0b3c18a62100fe6b5e683cb0615..a73946a9b714e552339a4bdf01f38769fcbdad3a 100644 --- a/nomad/metainfo/encyclopedia.py +++ b/nomad/metainfo/encyclopedia.py @@ -50,6 +50,31 @@ class Material(MSection): Position of each atom, given in relative coordinates. """ ) + bravais_lattice = Quantity( + type=str, + description=""" + The Bravais lattice type in the Pearson notation, where the first + lowercase letter indicates the crystal system, and the second uppercase + letter indicates the lattice type. + + Crystal system letters: + + a = Triclinic + m = Monoclinic + o = Orthorhombic + t = Tetragonal + h = Hexagonal and Trigonal + c = Cubic + + Lattice type letters: + + P = Primitive + S (A, B, C) = One side/face centred + I = Body centered + R = Rhombohedral centring + F = All faces centred + """ + ) class Calculation(MSection): diff --git a/nomad/normalizing/encyclopedia.py b/nomad/normalizing/encyclopedia.py index d8b2a9d643b8ec57e438043c8f8d1dd709c2c3c8..adf002ecbee9cd792a6fefd2f78d5bae72513260 100644 --- a/nomad/normalizing/encyclopedia.py +++ b/nomad/normalizing/encyclopedia.py @@ -75,8 +75,9 @@ class EncyclopediaNormalizer(Normalizer): pass # NOTE: System normalizer - def get_bravais_lattice(self) -> None: - pass + def get_bravais_lattice(self, material: Material, section_system: Dict) -> None: + bravais_lattice = section_system["section_symmetry"][0]["bravais_lattice"] + material.bravais_lattice = bravais_lattice # NOTE: Band structure normalizer def get_brillouin_zone(self) -> None: @@ -502,6 +503,7 @@ class EncyclopediaNormalizer(Normalizer): self.get_number_of_atoms(material, std_atoms) self.get_atom_labels(material, std_atoms) self.get_atomic_density(calculation, repr_atoms) + self.get_bravais_lattice(material, system) # Put the encyclopedia section into backend self._backend.add_mi2_section(sec_enc) diff --git a/nomad/normalizing/normalizer.py b/nomad/normalizing/normalizer.py index ebe77065e80fd6778500f0ae1589f1f55853724a..f59d7245284443b3aa7afcf8c70104f23bc21f09 100644 --- a/nomad/normalizing/normalizer.py +++ b/nomad/normalizing/normalizer.py @@ -112,7 +112,7 @@ class SystemBasedNormalizer(Normalizer, metaclass=ABCMeta): else: sequences.append(frames) - # If no frames exist, consider all existing sccs + # If no frame_sequences exist, consider all existing sccs if len(sequences) == 0: try: sccs = self._backend.get_sections(s_scc) @@ -132,9 +132,15 @@ class SystemBasedNormalizer(Normalizer, metaclass=ABCMeta): indices = [0, -2, -1] else: break - for scc_idx in [seq[idx] for idx in indices]: - system_idx = sccs[scc_idx][r_scc_to_system] - systems.append(system_idx) + for idx in indices: + scc_idx = seq[idx] + scc = sccs[scc_idx] + try: + system_idx = scc[r_scc_to_system] + except KeyError: + self.logger.info("section_single_configuration_calculation is missing a reference into a system.") + else: + systems.append(system_idx) if len(systems) == 0: self.logger.error('no "representative" section system found') diff --git a/tests/normalizing/test_encyclopedia.py b/tests/normalizing/test_encyclopedia.py index fd12cae5c51e9aa000457454e7ff8eab4b4107c8..e4b9c1f462257e1dc7c03817a868949ca99df7b7 100644 --- a/tests/normalizing/test_encyclopedia.py +++ b/tests/normalizing/test_encyclopedia.py @@ -54,3 +54,4 @@ def test_bulk_information(geometry_optimization: Encyclopedia): assert go.material.number_of_atoms == 4 assert go.material.atom_labels == ["Na", "Na", "Na", "Na"] assert go.calculation.atomic_density == pytest.approx(4.0e+30, rel=0.000001, abs=None) + assert go.material.bravais_lattice == "cF"