Commit 6f066b21 authored by Carl Poelking's avatar Carl Poelking
Browse files

libAtoms init.

parent 0123a27c
import sys, os, os.path
baseDir = os.path.dirname(os.path.abspath(__file__))
commonDir = os.path.normpath(os.path.join(baseDir,"../../../../python-common/common/python"))
if not commonDir in sys.path:
sys.path.insert(0, commonDir)
package eu.nomad_lab.parsers
import eu.{ nomad_lab => lab }
import eu.nomad_lab.DefaultPythonInterpreter
import org.{ json4s => jn }
import scala.collection.breakOut
object LibAtomsParser extends SimpleExternalParserGenerator(
name = "LibAtomsParser",
parserInfo = jn.JObject(
("name" -> jn.JString("LibAtomsParser")) ::
("parserId" -> jn.JString("LibAtomsParser" + lab.LibAtomsVersionInfo.version)) ::
("versionInfo" -> jn.JObject(
("nomadCoreVersion" -> jn.JObject(lab.NomadCoreVersionInfo.toMap.map {
case (k, v) => k -> jn.JString(v.toString)
}(breakOut): List[(String, jn.JString)])) ::
(lab.LibAtomsVersionInfo.toMap.map {
case (key, value) =>
(key -> jn.JString(value.toString))
}(breakOut): List[(String, jn.JString)])
)) :: Nil
),
mainFileTypes = Seq("text/.*"),
mainFileRe = """ ???? """.r,
cmd = Seq(DefaultPythonInterpreter.pythonExe(), "${envDir}/parsers/lib-atoms/parser/parser-lib-atoms/libAtomsParser.py",
"${mainFilePath}"),
resList = Seq(
"parser-lib-atoms/libAtomsParser.py",
"parser-lib-atoms/libLibAtomsParser.py",
"parser-lib-atoms/libMomo.py",
"parser-lib-atoms/setup_paths.py",
"nomad_meta_info/public.nomadmetainfo.json",
"nomad_meta_info/common.nomadmetainfo.json",
"nomad_meta_info/meta_types.nomadmetainfo.json",
"nomad_meta_info/lib_atoms.nomadmetainfo.json"
) ++ DefaultPythonInterpreter.commonFiles(),
dirMap = Map(
"parser-lib-atoms" -> "parsers/lib-atoms/parser/parser-lib-atoms",
"nomad_meta_info" -> "nomad-meta-info/meta_info/nomad_meta_info"
) ++ DefaultPythonInterpreter.commonDirMapping()
)
package eu.nomad_lab.parsers
import org.specs2.mutable.Specification
object LibAtomsParserSpec extends Specification {
"LibAtomsParserTest" >> {
"test with json-events" >> {
ParserRun.parse(LibAtomsParser, "parsers/lib-atoms/test/lib-atoms-tungsten/tungsten_gap_6.xyz", "json-events") must_== ParseResult.ParseSuccess
}
"test with json" >> {
ParserRun.parse(LibAtomsParser, "parsers/lib-atoms/test/lib-atoms-tungsten/tungsten_gap_6.xyz", "json") must_== ParseResult.ParseSuccess
}
}
}
This diff is collapsed.
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