Commit 7645b295 authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Fixed issue with selecting representative scc.

parent 5608c54b
Pipeline #74140 passed with stages
in 33 minutes and 27 seconds
...@@ -260,7 +260,7 @@ class EncyclopediaNormalizer(Normalizer): ...@@ -260,7 +260,7 @@ class EncyclopediaNormalizer(Normalizer):
try: try:
representative_scc_idx = self.section_run.m_cache["representative_scc_idx"] representative_scc_idx = self.section_run.m_cache["representative_scc_idx"]
representative_scc = self.section_run.section_single_configuration_calculation[representative_scc_idx] representative_scc = self.section_run.section_single_configuration_calculation[representative_scc_idx]
except (KeyError, IndexError): except Exception:
representative_scc = None representative_scc = None
representative_scc_idx = None representative_scc_idx = None
......
...@@ -116,7 +116,7 @@ class PropertiesNormalizer(): ...@@ -116,7 +116,7 @@ class PropertiesNormalizer():
try: try:
resolved_section = None resolved_section = None
frame_sequences = self.backend.entry_archive.section_run[0].section_frame_sequence frame_sequences = self.backend.entry_archive.section_run[0].section_frame_sequence
for frame_sequence in frame_sequences: for frame_sequence in reversed(frame_sequences):
thermodynamical_props = frame_sequence.section_thermodynamical_properties thermodynamical_props = frame_sequence.section_thermodynamical_properties
for thermodynamical_prop in thermodynamical_props: for thermodynamical_prop in thermodynamical_props:
if resolved_section is None: if resolved_section is None:
...@@ -171,7 +171,7 @@ class PropertiesNormalizer(): ...@@ -171,7 +171,7 @@ class PropertiesNormalizer():
return return
representative_phonon_dos = None representative_phonon_dos = None
for dos in doses: for dos in reversed(doses):
kind = dos.dos_kind kind = dos.dos_kind
energies = dos.dos_energies energies = dos.dos_energies
values = dos.dos_values values = dos.dos_values
......
...@@ -93,7 +93,6 @@ class SystemBasedNormalizer(Normalizer, metaclass=ABCMeta): ...@@ -93,7 +93,6 @@ class SystemBasedNormalizer(Normalizer, metaclass=ABCMeta):
entry. The selection depends on the type of calculation. entry. The selection depends on the type of calculation.
''' '''
system = None system = None
scc_idx = None
scc = None scc = None
# Try to find a frame sequence, only first found is considered # Try to find a frame sequence, only first found is considered
...@@ -104,41 +103,36 @@ class SystemBasedNormalizer(Normalizer, metaclass=ABCMeta): ...@@ -104,41 +103,36 @@ class SystemBasedNormalizer(Normalizer, metaclass=ABCMeta):
sampling_method = sec_sampling_method.sampling_method sampling_method = sec_sampling_method.sampling_method
frames = frame_seq.frame_sequence_local_frames_ref frames = frame_seq.frame_sequence_local_frames_ref
if sampling_method == "molecular_dynamics": if sampling_method == "molecular_dynamics":
scc = frames[0] iscc = frames[0]
scc_idx = scc.m_parent_index
else: else:
scc = frames[-1] iscc = frames[-1]
scc_idx = scc.m_parent_index system = iscc.single_configuration_calculation_to_system_ref
system = scc.single_configuration_calculation_to_system_ref if system is not None:
if system is None: scc = iscc
frame_seqs = []
except Exception: except Exception:
frame_seqs = [] pass
# If no frame sequences detected, try to find valid scc by looping all # If no frame sequences detected, try to find valid scc by looping all
# available in reverse order until a valid one is found. # available in reverse order until a valid one is found.
if len(frame_seqs) == 0: if system is None:
try: try:
sccs = self.section_run.section_single_configuration_calculation sccs = self.section_run.section_single_configuration_calculation
for scc in reversed(sccs): for iscc in reversed(sccs):
idx = scc.m_parent_index isys = iscc.single_configuration_calculation_to_system_ref
isys = scc.single_configuration_calculation_to_system_ref
if isys is not None: if isys is not None:
scc_idx = idx
system = isys system = isys
scc = iscc
break break
if system is None:
sccs = []
except Exception: except Exception:
sccs = [] pass
# If no sccs exist, try to find systems # If no sccs exist, try to find systems
if len(sccs) == 0: if system is None:
try: try:
systems = self.section_run.section_system systems = self.section_run.section_system
system = systems[-1] system = systems[-1]
except Exception: except Exception:
sccs = [] system = None
if system is None: if system is None:
self.logger.error('no "representative" section system found') self.logger.error('no "representative" section system found')
...@@ -148,7 +142,7 @@ class SystemBasedNormalizer(Normalizer, metaclass=ABCMeta): ...@@ -148,7 +142,7 @@ class SystemBasedNormalizer(Normalizer, metaclass=ABCMeta):
) )
if scc is not None: if scc is not None:
self.section_run.m_cache["representative_scc_idx"] = scc_idx self.section_run.m_cache["representative_scc_idx"] = scc.m_parent_index
if system is not None: if system is not None:
self.section_run.m_cache["representative_system_idx"] = system.m_parent_index self.section_run.m_cache["representative_system_idx"] = system.m_parent_index
......
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