adding main file uri

parent 9a6d0b96
......@@ -30,7 +30,9 @@ import eu.nomad_lab.h5.H5EagerScanner
import eu.nomad_lab.h5.SectionH5
import eu.nomad_lab.parsers.ExternalParserWrapper
import eu.nomad_lab.JsonUtils
import eu.nomad_lab.H5Lib
import scala.collection.mutable.StringBuilder
import util.control.NonFatal
object RepoTagsNormalizer extends ExternalNormalizerGenerator(
name = "RepoTagsNormalizer",
......@@ -99,6 +101,19 @@ object RepoTagsNormalizer extends ExternalNormalizerGenerator(
val nEnergyEvaluations = singleConfSections.lengthL
var lastGeometry: Option[SectionH5] = 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) {
val lastEnergyEval: SectionH5 = singleConfSections(nEnergyEvaluations - 1)
lastGeometry = lastEnergyEval.maybeValue("single_configuration_calculation_to_system_ref").map(_.longValue) match {
......@@ -118,6 +133,7 @@ object RepoTagsNormalizer extends ExternalNormalizerGenerator(
"electronic_structure_method": ${JsonUtils.normalizedStr(jn.JArray(electronicStructureMethods.map(jn.JString(_))(breakOut)))},
"section_single_confguration_calculation.length": ${nEnergyEvaluations},
"energy_total.last": ${lastEnergy.getOrElse("null")},
"main_file_uri": ${JsonUtils.normalizedStr(jn.JArray(mainFileUris.map(jn.JString(_))(breakOut)))},
"section_system.last": """)
lastGeometry match {
case None => "null"
......
Markdown is supported
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