Commit 00160f06 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added more parsers to NOMAD

parent b7ce9292
# 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='tinkerparser',
version='0.1',
description='NOMAD parser implementation for TINKER.',
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 TinkerParser extends SimpleExternalParserGenerator(
name = "TinkerParser",
parserInfo = jn.JObject(
("name" -> jn.JString("TinkerParser")) ::
("parserId" -> jn.JString("TinkerParser" + lab.TinkerVersionInfo.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.TinkerVersionInfo.toMap.map {
case (key, value) =>
(key -> jn.JString(value.toString))
}(breakOut): List[(String, jn.JString)])
)) :: Nil
),
mainFileTypes = Seq("text/.*"),
mainFileRe = """\s*#+\s*TINKER\s*---\s*Software\s*Tools\s*for\s*Molecular\s*Design\s*#+\s*""".r,
cmd = Seq(DefaultPythonInterpreter.pythonExe(), "${envDir}/parsers/tinker/parser/parser-tinker/TINKERParser.py",
"${mainFilePath}"),
resList = Seq(
"parser-tinker/TINKERParser.py",
"parser-tinker/TINKERDictionary.py",
"parser-tinker/TINKERCommon.py",
"parser-tinker/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/tinker.nomadmetainfo.json"
) ++ DefaultPythonInterpreter.commonFiles(),
dirMap = Map(
"parser-tinker" -> "parsers/tinker/parser/parser-tinker",
"nomad_meta_info" -> "nomad-meta-info/meta_info/nomad_meta_info",
"python" -> "python-common/common/python/nomadcore"
) ++ DefaultPythonInterpreter.commonDirMapping(),
metaInfoEnv = Some(lab.meta.KnownMetaInfoEnvs.tinker)
)
/*
* 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 TinkerParserTests extends Specification {
"TinkerParserTest" >> {
"[Anion in Water (xyz sequence of outputs with 643 atoms)] test with json-events" >> {
ParserRun.parse(TinkerParser, "parsers/tinker/test/examples/anion/anion.log", "json-events") must_== ParseResult.ParseSuccess
}
"[Anion in Water (xyz sequence of outputs with 643 atoms)] test with json" >> {
ParserRun.parse(TinkerParser, "parsers/tinker/test/examples/anion/anion.log", "json") must_== ParseResult.ParseSuccess
}
"[Ice (.arc trajectory with 3024 atoms)] test with json-events" >> {
ParserRun.parse(TinkerParser, "parsers/tinker/test/examples/ice/ice.log", "json-events") must_== ParseResult.ParseSuccess
}
"[Ice (.arc trajectory with 3024 atoms)] test with json" >> {
ParserRun.parse(TinkerParser, "parsers/tinker/test/examples/ice/ice.log", "json") must_== ParseResult.ParseSuccess
}
}
}
Metadata-Version: 1.0
Name: tinkerparser
Version: 0.1
Summary: NOMAD parser implementation for TINKER.
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: APACHE 2.0
Description: UNKNOWN
Platform: UNKNOWN
README.md
setup.py
./tinkerparser/TINKERCommon.py
./tinkerparser/TINKERDictionary.py
./tinkerparser/TINKERParser.py
./tinkerparser/__init__.py
./tinkerparser.egg-info/PKG-INFO
./tinkerparser.egg-info/SOURCES.txt
./tinkerparser.egg-info/dependency_links.txt
./tinkerparser.egg-info/requires.txt
./tinkerparser.egg-info/top_level.txt
\ No newline at end of file
from .TINKERParser import TINKERParserInterface as TINKERParser
\ No newline at end of file
import sys
from nomad.metainfo import Environment
from nomad.metainfo.legacy import LegacyMetainfoEnvironment
import tinkerparser.metainfo.tinker
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['tinkerparser.metainfo.tinker'].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.
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