Commit 1494b76d authored by Markus Scheidgen's avatar Markus Scheidgen

Added more parsers to NOMAD

parent 354d933b
......@@ -10,9 +10,7 @@ syntax: glob
*.bk
*.swp
.DS_Store
# logging files
detailed.log
*.annotate
# eclipse conf file
.settings
......@@ -52,3 +50,5 @@ TAGS
lib/
env/
*.egg-info
\ No newline at end of file
from .GROMOSParser import GromacsParserInterface as GromosParser
\ No newline at end of file
import sys
from nomad.metainfo import Environment
from nomad.metainfo.legacy import LegacyMetainfoEnvironment
import gromosparser.metainfo.gromos
import nomad.datamodel.metainfo.common
import nomad.datamodel.metainfo.public
import nomad.datamodel.metainfo.general
m_env = LegacyMetainfoEnvironment()
m_env.m_add_sub_section(Environment.packages, sys.modules['gromosparser.metainfo.gromos'].m_package) # type: ignore
m_env.m_add_sub_section(Environment.packages, sys.modules['nomad.datamodel.metainfo.common'].m_package) # type: ignore
m_env.m_add_sub_section(Environment.packages, sys.modules['nomad.datamodel.metainfo.public'].m_package) # type: ignore
m_env.m_add_sub_section(Environment.packages, sys.modules['nomad.datamodel.metainfo.general'].m_package) # type: ignore
This diff is collapsed.
# Copyright 2018-2018 Berk Onat
#
# Copyright 2015-2018 Berk Onat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import os
import os.path
basedir = os.path.dirname(os.path.abspath(__file__))
commondir = os.path.normpath(os.path.join(basedir,"../../../../python-common/common/python"))
from setuptools import setup, find_packages
if not commondir in sys.path:
sys.path.insert(0, commondir)
def main():
setup(
name='gromossparser',
version='0.1',
description='NOMAD parser implementation for Gromos.',
license='APACHE 2.0',
package_dir={'': './'},
packages=find_packages(),
install_requires=[
'nomadcore',
'nomad'
],
)
if __name__ == '__main__':
main()
/*
* Copyright 2018-2018 Berk Onat
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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 GromosParser extends SimpleExternalParserGenerator(
name = "GromosParser",
parserInfo = jn.JObject(
("name" -> jn.JString("GromosParser")) ::
("parserId" -> jn.JString("GromosParser" + lab.GromosVersionInfo.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.GromosVersionInfo.toMap.map {
case (key, value) =>
(key -> jn.JString(value.toString))
}(breakOut): List[(String, jn.JString)])
)) :: Nil
),
mainFileTypes = Seq("text/.*"),
mainFileRe = """^MD\+\+\s*\s*""".r,
cmd = Seq(DefaultPythonInterpreter.pythonExe(), "${envDir}/parsers/gromos/parser/parser-gromos/GROMOSParser.py",
"${mainFilePath}"),
resList = Seq(
"parser-gromos/GROMOSParser.py",
"parser-gromos/GROMOSDictionary.py",
"parser-gromos/GROMOSCommon.py",
"parser-gromos/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/gromos.nomadmetainfo.json"
) ++ DefaultPythonInterpreter.commonFiles(),
dirMap = Map(
"parser-gromos" -> "parsers/gromos/parser/parser-gromos",
"nomad_meta_info" -> "nomad-meta-info/meta_info/nomad_meta_info",
"python" -> "python-common/common/python/nomadcore"
) ++ DefaultPythonInterpreter.commonDirMapping(),
metaInfoEnv = Some(lab.meta.KnownMetaInfoEnvs.gromos)
)
/*
* Copyright 2018-2018 Berk Onat
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.nomad_lab.parsers
import org.specs2.mutable.Specification
object GromosParserTests extends Specification {
"GromosParserTest_1" >> {
"[Peptide in Water with 2792 atoms] test with json-events" >> {
ParserRun.parse(GromosParser, "parsers/gromos/test/examples/eq/eq_peptide_1.omd", "json-events") must_== ParseResult.ParseSuccess
}
}
"GromosParserTest_2" >> {
"[Peptide in Water with 2792 atoms] test with json" >> {
ParserRun.parse(GromosParser, "parsers/gromos/test/examples/eq/eq_peptide_1.omd", "json") must_== ParseResult.ParseSuccess
}
}
}
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