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

First version of the win2k parser

parent ef6f28f0
No related branches found
No related tags found
No related merge requests found
Showing
with 53574 additions and 0 deletions
# use glob syntax.
syntax: glob
*.ser
*.class
*~
*.bak
#*.off
*.old
*.pyc
*.bk
*.swp
.DS_Store
# logging files
detailed.log
# eclipse conf file
.settings
.classpath
.project
.manager
.scala_dependencies
# idea
.idea
*.iml
# building
target
build
null
tmp*
temp*
dist
test-output
build.log
# other scm
.svn
.CVS
.hg*
# switch to regexp syntax.
# syntax: regexp
# ^\.pc/
#SHITTY output not in target directory
build.log
#emacs TAGS
TAGS
lib/
env/
stages:
- test
testing:
stage: test
script:
- cd .. && rm -rf nomad-lab-base
- git clone --recursive git@gitlab.mpcdf.mpg.de:nomad-lab/nomad-lab-base.git
- cd nomad-lab-base
- git submodule foreach git checkout master
- git submodule foreach git pull
- sbt wien2k/test
- export PYTHONEXE=/labEnv/bin/python
- sbt wien2k/test
only:
- master
tags:
- test
- spec2
\ No newline at end of file
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)
from builtins import object
import setup_paths
from nomadcore.simple_parser import mainFunction
from nomadcore.simple_parser import SimpleMatcher as SM
from nomadcore.local_meta_info import loadJsonFile, InfoKindEl
import os, sys, json
class Wien2kContext(object):
"""context for wien2k parser"""
def __init__(self):
self.parser = None
def initialize_values(self):
"""allows to reset values if the same superContext is used to parse different files"""
pass
def startedParsing(self, path, parser):
"""called when parsing starts"""
self.parser = parser
# allows to reset values if the same superContext is used to parse different files
self.initialize_values()
def onClose_x_wien2k_header(self, backend, gIndex, section):
backend.addValue("program_version",
section["x_wien2k_version"][0] + " " +
section["x_wien2k_release_date"][0])
# description of the input
mainFileDescription = SM(
name = 'root',
weak = True,
startReStr = "",
subMatchers = [
SM(name = 'newRun',
startReStr = r"\s*:LABEL[0-9]+: using WIEN2k_(?:[0-9.]+) \(Release (?:[0-9/.]+)\) in ",
repeats = True,
required = True,
forwardMatch = True,
sections = ['section_run'],
subMatchers = [
SM(name = 'header',
startReStr = r"\s*:LABEL[0-9]+: using WIEN2k_(?P<x_wien2k_version>[0-9.]+) \(Release (?P<x_wien2k_release_date>[0-9/.]+)\) in ",
sections=["x_wien2k_header"],
fixedStartValues={'program_name': 'WIEN2k', 'program_basis_set_type': '(L)APW+lo' }
)
])
])
# loading metadata from nomad-meta-info/meta_info/nomad_meta_info/fhi_aims.nomadmetainfo.json
parserInfo = {
"name": "Wien2k"
}
metaInfoPath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),"../../../../nomad-meta-info/meta_info/nomad_meta_info/wien2k.nomadmetainfo.json"))
metaInfoEnv, warnings = loadJsonFile(filePath = metaInfoPath, dependencyLoader = None, extraArgsHandling = InfoKindEl.ADD_EXTRA_ARGS, uri = None)
if __name__ == "__main__":
superContext = Wien2kContext()
mainFunction(mainFileDescription, metaInfoEnv, parserInfo, superContext = superContext)
package eu.nomad_lab.parsers
import eu.nomad_lab
import eu.nomad_lab.DefaultPythonInterpreter
import org.{ json4s => jn }
import eu.{ nomad_lab => lab }
import scala.collection.breakOut
object Wien2kParser extends SimpleExternalParserGenerator(
name = "Wien2kParser",
parserInfo = jn.JObject(
("name" -> jn.JString("Wien2k")) ::
("parserId" -> jn.JString("Wien2k" + lab.Wien2kVersionInfo.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.Wien2kVersionInfo.toMap.map {
case (key, value) =>
(key -> jn.JString(value.toString))
}(breakOut): List[(String, jn.JString)])
)) :: Nil
),
mainFileTypes = Seq("text/.*"),
mainFileRe = """:LABEL[0-9]+: using WIEN2k_(?<version>[0-9.]+) \(Release (?<release>[0-9/.]+)\) in """.r,
cmd = Seq(DefaultPythonInterpreter.pythonExe(), "${envDir}/parsers/wien2k/parser/parser-wien2k/wien2k_parser.py",
"--uri", "${mainFileUri}", "${mainFilePath}"),
resList = Seq(
"parser-wien2k/wien2k_parser.py",
"parser-wien2k/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/wien2k.nomadmetainfo.json"
) ++ DefaultPythonInterpreter.commonFiles(),
dirMap = Map(
"parser-wien2k" -> "parsers/wien2k/parser/parser-wien2k",
"nomad_meta_info" -> "nomad-meta-info/meta_info/nomad_meta_info",
"python" -> "python-common/common/python/nomadcore"
) ++ DefaultPythonInterpreter.commonDirMapping(),
metaInfoEnv = Some(lab.meta.KnownMetaInfoEnvs.wien2k)
)
package eu.nomad_lab.parsers
import org.specs2.mutable.Specification
object Wien2kTests extends Specification {
"Wien2kParserTest" >> {
"test with json-events" >> {
ParserRun.parse(Wien2kParser, "parsers/wien2k/test/examples/ok/ok.scf", "json-events") must_== ParseResult.ParseSuccess
}
"test with json" >> {
ParserRun.parse(Wien2kParser, "parsers/wien2k/test/examples/ok/ok.scf", "json") must_== ParseResult.ParseSuccess
}
}
}
sample files to test the parser
TOT 19 (5:LDA, 13:PBE, 11:WC, 19:PBEsol, 28:mBJ, 29:revTPSS, 46:HTBS)
NR2V IFFT (R2V)
120 120 200 2.00 1 min IFFT-parameters, enhancement factor, iprint
WFFIL EF=-.204956810975 (WFFIL, WFPRI, ENFIL, SUPWF)
7.00 10 4 (R-MT*K-MAX; MAX L IN WF, V-NMT
-.4050839945 2 0 global e-param with N other choices, napw
0 -1.175 0.000 CONT 1
1 -0.643 0.000 CONT 1
-.4050839945 2 0 global e-param with N other choices, napw
0 -1.280 0.000 CONT 1
1 -0.736 0.000 CONT 1
-.4050839945 2 0 global e-param with N other choices, napw
0 -1.275 0.000 CONT 1
1 -0.729 0.000 CONT 1
-.4050839945 2 0 global e-param with N other choices, napw
0 -1.272 0.000 CONT 1
1 -0.724 0.000 CONT 1
-.4050839945 2 0 global e-param with N other choices, napw
0 -1.271 0.000 CONT 1
1 -0.722 0.000 CONT 1
-.4050839945 2 0 global e-param with N other choices, napw
0 -1.266 0.000 CONT 1
1 -0.713 0.000 CONT 1
-.4050839945 2 0 global e-param with N other choices, napw
0 -1.276 0.000 CONT 1
1 -0.728 0.000 CONT 1
-.4050839945 2 0 global e-param with N other choices, napw
0 -1.266 0.000 CONT 1
1 -0.718 0.000 CONT 1
-.4050839945 2 0 global e-param with N other choices, napw
0 -1.271 0.000 CONT 1
1 -0.722 0.000 CONT 1
-.4050839945 2 0 global e-param with N other choices, napw
0 -1.271 0.000 CONT 1
1 -0.722 0.000 CONT 1
-.4050839945 2 0 global e-param with N other choices, napw
0 -1.263 0.000 CONT 1
1 -0.716 0.000 CONT 1
-.4050839945 2 0 global e-param with N other choices, napw
0 -1.266 0.000 CONT 1
1 -0.715 0.000 CONT 1
-.4050839945 2 0 global e-param with N other choices, napw
0 -1.259 0.000 CONT 1
1 -0.706 0.000 CONT 1
K-VECTORS FROM UNIT:4 -9.0 2.5 198 red emin/emax/nband
TOT (TOT,FOR,QTL,EFG,FERMI)
-12.0 196.0 0.50 0.05 EMIN, NE, ESEPERMIN, ESEPER0
TETRA 0.000 (GAUSS,ROOT,TEMP,TETRA,ALL eval)
0 0 1 0 2 0 2 2 3 0 3 2 4 0 4 2 4 4 5 0 5 2 5 4 6 0 6 2 6 4 6 6
0 0 1 1 -1 1 2 0 2 2 -2 2 3 1 -3 1 3 3 -3 3 4 0 4 2 -4 2 4 4 -4 4 5 1 -5 1 5 3 -5 3 5 5 -5 5 6 0 6 2 -6 2 6 4 -6 4 6 6 -6 6
0 0 1 1 -1 1 2 0 2 2 -2 2 3 1 -3 1 3 3 -3 3 4 0 4 2 -4 2 4 4 -4 4 5 1 -5 1 5 3 -5 3 5 5 -5 5 6 0 6 2 -6 2 6 4 -6 4 6 6 -6 6
0 0 1 1 -1 1 2 0 2 2 -2 2 3 1 -3 1 3 3 -3 3 4 0 4 2 -4 2 4 4 -4 4 5 1 -5 1 5 3 -5 3 5 5 -5 5 6 0 6 2 -6 2 6 4 -6 4 6 6 -6 6
0 0 1 0 2 0 2 2 3 0 3 2 4 0 4 2 4 4 5 0 5 2 5 4 6 0 6 2 6 4 6 6
0 0 1 0 2 0 2 2 3 0 3 2 4 0 4 2 4 4 5 0 5 2 5 4 6 0 6 2 6 4 6 6
0 0 1 0 2 0 2 2 3 0 3 2 4 0 4 2 4 4 5 0 5 2 5 4 6 0 6 2 6 4 6 6
0 0 1 0 2 0 2 2 3 0 3 2 4 0 4 2 4 4 5 0 5 2 5 4 6 0 6 2 6 4 6 6
0 0 1 0 2 0 2 2 3 0 3 2 4 0 4 2 4 4 5 0 5 2 5 4 6 0 6 2 6 4 6 6
0 0 1 0 2 0 2 2 3 0 3 2 4 0 4 2 4 4 5 0 5 2 5 4 6 0 6 2 6 4 6 6
0 0 1 0 2 0 2 2 3 0 3 2 4 0 4 2 4 4 5 0 5 2 5 4 6 0 6 2 6 4 6 6
0 0 1 1 -1 1 2 0 2 2 -2 2 3 1 -3 1 3 3 -3 3 4 0 4 2 -4 2 4 4 -4 4 5 1 -5 1 5 3 -5 3 5 5 -5 5 6 0 6 2 -6 2 6 4 -6 4 6 6 -6 6
0 0 2 0 3 3 4 0 5 3 6 0 6 6
16.00 GMAX
NOFILE FILE/NOFILE write recprlist
Graphite C K edge of first atom.
ELNES # We broaden case.elnes .
1 1 0 # We use spectrum 1 out of 1
0.000000000 1.000000000 0.000000000 # split energy, weights of spectra
0.8676271836E-01 0.8676271836E-01 # core hole lifetime of two edges
1 0.000000000 # select linearly energy dependent valence broadening; edge offset
0.5000000000 # default spectrometer broadening - Gaussian FWHM
1 0.00 0 NUMBER OF ORBITALS (EXCLUDING SPIN), SHIFT, IPRINT
1,-1,2 ( N,KAPPA,OCCUP)
1 0.00 0 NUMBER OF ORBITALS (EXCLUDING SPIN), SHIFT, IPRINT
1,-1,2 ( N,KAPPA,OCCUP)
1 0.00 0 NUMBER OF ORBITALS (EXCLUDING SPIN), SHIFT, IPRINT
1,-1,2 ( N,KAPPA,OCCUP)
1 0.00 0 NUMBER OF ORBITALS (EXCLUDING SPIN), SHIFT, IPRINT
1,-1,2 ( N,KAPPA,OCCUP)
1 0.00 0 NUMBER OF ORBITALS (EXCLUDING SPIN), SHIFT, IPRINT
1,-1,2 ( N,KAPPA,OCCUP)
1 0.00 0 NUMBER OF ORBITALS (EXCLUDING SPIN), SHIFT, IPRINT
1,-1,2 ( N,KAPPA,OCCUP)
1 0.00 0 NUMBER OF ORBITALS (EXCLUDING SPIN), SHIFT, IPRINT
1,-1,2 ( N,KAPPA,OCCUP)
1 0.00 0 NUMBER OF ORBITALS (EXCLUDING SPIN), SHIFT, IPRINT
1,-1,2 ( N,KAPPA,OCCUP)
1 0.00 0 NUMBER OF ORBITALS (EXCLUDING SPIN), SHIFT, IPRINT
1,-1,2 ( N,KAPPA,OCCUP)
1 0.00 0 NUMBER OF ORBITALS (EXCLUDING SPIN), SHIFT, IPRINT
1,-1,2 ( N,KAPPA,OCCUP)
1 0.00 0 NUMBER OF ORBITALS (EXCLUDING SPIN), SHIFT, IPRINT
1,-1,2 ( N,KAPPA,OCCUP)
1 0.00 0 NUMBER OF ORBITALS (EXCLUDING SPIN), SHIFT, IPRINT
1,-1,2 ( N,KAPPA,OCCUP)
1 0.00 0 NUMBER OF ORBITALS (EXCLUDING SPIN), SHIFT, IPRINT
1,-1,2 ( N,KAPPA,OCCUP)
0
MSR1 0.0 YES (BROYD/PRATT, extra charge (+1 for additional e), norm)
0.20 mixing FACTOR for BROYD/PRATT scheme
1.00 1.00 PW and CLM-scaling factors
9999 8 idum, HISTORY
-.23076923076923076923 3.73846153846153846153
1
13 99 1 0
4 0 1 2 3
Title
-0.50 0.002 3.500 0.003 # EMIN, DE, EMAX, Gauss-broadening(>de)
13 N 0.000 # NUMBER OF DOS-CASES specified below, G/L/B broadening (Ry)
1 3 At1P # atom, case=column in qtl-header, labe
2 3 At2P
3 3 At3P
4 3 At4P
5 3 At5P
6 3 At6P
7 3 At7P
8 3 At8P
9 3 At9P
10 3 At10P
11 3 At11P
12 3 At12P
13 3 At13P
This diff is collapsed.
graphene
H LATTICE,NONEQUIV.ATOMS: 13 187 P-6m2
RELA
23.239030 23.239030 37.794538 90.000000 90.000000120.000000
ATOM -1: X=0.59987104 Y=0.40012896 Z=0.00000000
MULT= 3 ISPLIT= 8
-1: X=0.59987104 Y=0.19974208 Z=0.00000000
-1: X=0.80025792 Y=0.40012896 Z=0.00000000
C 1 NPT= 781 R0=0.00010000 RMT= 1.32 Z: 6.
LOCAL ROT MATRIX: 0.0000000 0.8660254 0.5000000
0.0000000 0.5000000-0.8660254
-1.0000000 0.0000000 0.0000000
ATOM -2: X=0.86544201 Y=0.33289950 Z=0.00000000
MULT= 6 ISPLIT= 8
-2: X=0.66710050 Y=0.53254251 Z=0.00000000
-2: X=0.46745749 Y=0.13455799 Z=0.00000000
-2: X=0.66710050 Y=0.13455799 Z=0.00000000
-2: X=0.46745749 Y=0.33289950 Z=0.00000000
-2: X=0.86544201 Y=0.53254251 Z=0.00000000
C 2 NPT= 781 R0=0.00010000 RMT= 1.32 Z: 6.
LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000
0.0000000 1.0000000 0.0000000
0.0000000 0.0000000 1.0000000
ATOM -3: X=0.00020325 Y=0.40034148 Z=0.00000000
MULT= 6 ISPLIT= 8
-3: X=0.59965852 Y=0.59986177 Z=0.00000000
-3: X=0.40013823 Y=0.99979675 Z=0.00000000
-3: X=0.59965852 Y=0.99979675 Z=0.00000000
-3: X=0.40013823 Y=0.40034148 Z=0.00000000
-3: X=0.00020325 Y=0.59986177 Z=0.00000000
C 3 NPT= 781 R0=0.00010000 RMT= 1.32 Z: 6.
LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000
0.0000000 1.0000000 0.0000000
0.0000000 0.0000000 1.0000000
ATOM -4: X=0.06654808 Y=0.33316015 Z=0.00000000
MULT= 6 ISPLIT= 8
-4: X=0.66683985 Y=0.73338793 Z=0.00000000
-4: X=0.26661207 Y=0.93345192 Z=0.00000000
-4: X=0.66683985 Y=0.93345192 Z=0.00000000
-4: X=0.26661207 Y=0.33316015 Z=0.00000000
-4: X=0.06654808 Y=0.73338793 Z=0.00000000
C 4 NPT= 781 R0=0.00010000 RMT= 1.32 Z: 6.
LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000
0.0000000 1.0000000 0.0000000
0.0000000 0.0000000 1.0000000
ATOM -5: X=0.20002391 Y=0.40004782 Z=0.00000000
MULT= 3 ISPLIT= 8
-5: X=0.59995218 Y=0.79997609 Z=0.00000000
-5: X=0.20002391 Y=0.79997609 Z=0.00000000
C 5 NPT= 781 R0=0.00010000 RMT= 1.32 Z: 6.
LOCAL ROT MATRIX: 0.0000000 0.8660254 0.5000000
0.0000000-0.5000000 0.8660254
1.0000000 0.0000000 0.0000000
ATOM -6: X=0.80016271 Y=0.60032543 Z=0.00000000
MULT= 3 ISPLIT= 8
-6: X=0.39967457 Y=0.19983728 Z=0.00000000
-6: X=0.80016272 Y=0.19983729 Z=0.00000000
C 6 NPT= 781 R0=0.00010000 RMT= 1.32 Z: 6.
LOCAL ROT MATRIX: 0.0000000 0.8660254 0.5000000
0.0000000-0.5000000 0.8660254
1.0000000 0.0000000 0.0000000
ATOM -7: X=0.06661061 Y=0.53330531 Z=0.00000000
MULT= 3 ISPLIT= 8
-7: X=0.46669469 Y=0.53330530 Z=0.00000000
-7: X=0.46669470 Y=0.93338939 Z=0.00000000
C 7 NPT= 781 R0=0.00010000 RMT= 1.32 Z: 6.
LOCAL ROT MATRIX: 0.0000000 0.0000000 1.0000000
0.0000000 1.0000000 0.0000000
-1.0000000 0.0000000 0.0000000
ATOM -8: X=0.86659078 Y=0.73318156 Z=0.00000000
MULT= 3 ISPLIT= 8
-8: X=0.26681844 Y=0.13340922 Z=0.00000000
-8: X=0.86659078 Y=0.13340922 Z=0.00000000
C 8 NPT= 781 R0=0.00010000 RMT= 1.32 Z: 6.
LOCAL ROT MATRIX: 0.0000000 0.8660254 0.5000000
0.0000000-0.5000000 0.8660254
1.0000000 0.0000000 0.0000000
ATOM -9: X=0.20003553 Y=0.60001777 Z=0.00000000
MULT= 3 ISPLIT= 8
-9: X=0.39998223 Y=0.60001776 Z=0.00000000
-9: X=0.39998224 Y=0.79996447 Z=0.00000000
C 9 NPT= 781 R0=0.00010000 RMT= 1.32 Z: 6.
LOCAL ROT MATRIX: 0.0000000 0.0000000 1.0000000
0.0000000 1.0000000 0.0000000
-1.0000000 0.0000000 0.0000000
ATOM -10: X=0.26666892 Y=0.53333785 Z=0.00000000
MULT= 3 ISPLIT= 8
-10: X=0.46666215 Y=0.73333107 Z=0.00000000
-10: X=0.26666893 Y=0.73333108 Z=0.00000000
C 10 NPT= 781 R0=0.00010000 RMT= 1.32 Z: 6.
LOCAL ROT MATRIX: 0.0000000 0.8660254 0.5000000
0.0000000-0.5000000 0.8660254
1.0000000 0.0000000 0.0000000
ATOM -11: X=0.86666941 Y=0.93333471 Z=0.00000000
MULT= 3 ISPLIT= 8
-11: X=0.06666529 Y=0.93333470 Z=0.00000000
-11: X=0.06666530 Y=0.13333059 Z=0.00000000
C 11 NPT= 781 R0=0.00010000 RMT= 1.32 Z: 6.
LOCAL ROT MATRIX: 0.0000000 0.0000000 1.0000000
0.0000000 1.0000000 0.0000000
-1.0000000 0.0000000 0.0000000
ATOM -12: X=0.79998126 Y=0.80006772 Z=0.00000000
MULT= 6 ISPLIT= 8
-12: X=0.19993228 Y=0.99991354 Z=0.00000000
-12: X=0.00008646 Y=0.20001874 Z=0.00000000
-12: X=0.19993228 Y=0.20001874 Z=0.00000000
-12: X=0.00008646 Y=0.80006772 Z=0.00000000
-12: X=0.79998126 Y=0.99991354 Z=0.00000000
C 12 NPT= 781 R0=0.00010000 RMT= 1.32 Z: 6.
LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000
0.0000000 1.0000000 0.0000000
0.0000000 0.0000000 1.0000000
ATOM -13: X=0.00000000 Y=0.00000000 Z=0.00000000
MULT= 1 ISPLIT= 4
C 13 NPT= 781 R0=0.00010000 RMT= 1.32 Z: 6.
LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000
0.0000000 1.0000000 0.0000000
0.0000000 0.0000000 1.0000000
12 NUMBER OF SYMMETRY OPERATIONS
1 0 0 0.00000000
0 1 0 0.00000000
0 0 1 0.00000000
1
0-1 0 0.00000000
1-1 0 0.00000000
0 0 1 0.00000000
2
-1 1 0 0.00000000
-1 0 0 0.00000000
0 0 1 0.00000000
3
1 0 0 0.00000000
0 1 0 0.00000000
0 0-1 0.00000000
4
0-1 0 0.00000000
1-1 0 0.00000000
0 0-1 0.00000000
5
-1 1 0 0.00000000
-1 0 0 0.00000000
0 0-1 0.00000000
6
0-1 0 0.00000000
-1 0 0 0.00000000
0 0 1 0.00000000
7
-1 1 0 0.00000000
0 1 0 0.00000000
0 0 1 0.00000000
8
1 0 0 0.00000000
1-1 0 0.00000000
0 0 1 0.00000000
9
0-1 0 0.00000000
-1 0 0 0.00000000
0 0-1 0.00000000
10
-1 1 0 0.00000000
0 1 0 0.00000000
0 0-1 0.00000000
11
1 0 0 0.00000000
1-1 0 0.00000000
0 0-1 0.00000000
12
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment