Skip to content
Snippets Groups Projects
Commit bc6bdbc3 authored by Mohamed, Fawzi Roberto (fawzi)'s avatar Mohamed, Fawzi Roberto (fawzi)
Browse files

adding main file uri

parent 9a6d0b96
Branches
Tags
No related merge requests found
...@@ -30,7 +30,9 @@ import eu.nomad_lab.h5.H5EagerScanner ...@@ -30,7 +30,9 @@ import eu.nomad_lab.h5.H5EagerScanner
import eu.nomad_lab.h5.SectionH5 import eu.nomad_lab.h5.SectionH5
import eu.nomad_lab.parsers.ExternalParserWrapper import eu.nomad_lab.parsers.ExternalParserWrapper
import eu.nomad_lab.JsonUtils import eu.nomad_lab.JsonUtils
import eu.nomad_lab.H5Lib
import scala.collection.mutable.StringBuilder import scala.collection.mutable.StringBuilder
import util.control.NonFatal
object RepoTagsNormalizer extends ExternalNormalizerGenerator( object RepoTagsNormalizer extends ExternalNormalizerGenerator(
name = "RepoTagsNormalizer", name = "RepoTagsNormalizer",
...@@ -99,6 +101,19 @@ object RepoTagsNormalizer extends ExternalNormalizerGenerator( ...@@ -99,6 +101,19 @@ object RepoTagsNormalizer extends ExternalNormalizerGenerator(
val nEnergyEvaluations = singleConfSections.lengthL val nEnergyEvaluations = singleConfSections.lengthL
var lastGeometry: Option[SectionH5] = None var lastGeometry: Option[SectionH5] = None
var lastEnergy: Option[Double] = None var lastEnergy: Option[Double] = None
val cGroup = c.calculationGroup
val mainFileUris: Seq[String] = try {
val mainFileAttr: Long = H5Lib.attributeOpen(
cGroup,
attributeName = "mainFileUri", attributeType = "C"
)
val mainFiles: Array[String] = H5Lib.attributeReadStr(mainFileAttr)
H5Lib.attributeClose(mainFileAttr)
mainFiles.toSeq
} catch {
case NonFatal(e) =>
Seq()
}
if (nEnergyEvaluations > 0) { if (nEnergyEvaluations > 0) {
val lastEnergyEval: SectionH5 = singleConfSections(nEnergyEvaluations - 1) val lastEnergyEval: SectionH5 = singleConfSections(nEnergyEvaluations - 1)
lastGeometry = lastEnergyEval.maybeValue("single_configuration_calculation_to_system_ref").map(_.longValue) match { lastGeometry = lastEnergyEval.maybeValue("single_configuration_calculation_to_system_ref").map(_.longValue) match {
...@@ -118,6 +133,7 @@ object RepoTagsNormalizer extends ExternalNormalizerGenerator( ...@@ -118,6 +133,7 @@ object RepoTagsNormalizer extends ExternalNormalizerGenerator(
"electronic_structure_method": ${JsonUtils.normalizedStr(jn.JArray(electronicStructureMethods.map(jn.JString(_))(breakOut)))}, "electronic_structure_method": ${JsonUtils.normalizedStr(jn.JArray(electronicStructureMethods.map(jn.JString(_))(breakOut)))},
"section_single_confguration_calculation.length": ${nEnergyEvaluations}, "section_single_confguration_calculation.length": ${nEnergyEvaluations},
"energy_total.last": ${lastEnergy.getOrElse("null")}, "energy_total.last": ${lastEnergy.getOrElse("null")},
"main_file_uri": ${JsonUtils.normalizedStr(jn.JArray(mainFileUris.map(jn.JString(_))(breakOut)))},
"section_system.last": """) "section_system.last": """)
lastGeometry match { lastGeometry match {
case None => "null" case None => "null"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment