Commit 83a4de4e authored by Daniel Speckhard's avatar Daniel Speckhard
Browse files

Added Orca to Nomad-Faird framework.

parent 248e14fd
......@@ -9,6 +9,8 @@ syntax: glob
*.pyc
*.bk
*.swp
*.egg-info
.DS_Store
# logging files
......
Metadata-Version: 1.0
Name: orcaparser
Version: 0.1
Summary: NOMAD parser implementation for Orca.
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: APACHE 2.0
Description: UNKNOWN
Platform: UNKNOWN
README.md
setup.py
./orcaparser/__init__.py
./orcaparser/parser.py
./orcaparser/setup_paths.py
./orcaparser.egg-info/PKG-INFO
./orcaparser.egg-info/SOURCES.txt
./orcaparser.egg-info/dependency_links.txt
./orcaparser.egg-info/requires.txt
./orcaparser.egg-info/top_level.txt
\ No newline at end of file
# Copyright 2015-2018 Lauri Himanen, Fawzi Mohamed, Ankit Kariryaa
#
# 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.
from orcaparser.parser import OrcaParser
# Copyright 2016-2018 Sebastian Alarcon Villaseca, Sebastián Alarcón Villaseca, Fawzi Mohamed, Micael Oliveira, Ankit Kariryaa, Danio Brambila
#
#
# 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.
......@@ -14,7 +14,6 @@
# -*- coding: utf-8 -*
from builtins import object
import setup_paths
import numpy as np
from nomadcore.simple_parser import SimpleMatcher, mainFunction
from nomadcore.local_meta_info import loadJsonFile, InfoKindEl
......@@ -88,7 +87,7 @@ class OrcaContext(object):
#***************************************
# Local functionals
#***************************************
# HFS: Hartree-Fock Slater
# HFS: Hartree-Fock Slater
"HF": ["HF_X"],
"HFS": ["HF_X"],
# XAlpha: The famous old Slater Xa theory
......@@ -151,7 +150,7 @@ class OrcaContext(object):
"TPSS": ["LDA_X", "MGGA_X_TPSS", "LDA_C_PW", "MGGA_C_TPSS"],
# TPSSh: The hybrid version of TPSS (10% HF exchange)
"TPSSh": ["HYB_MGGA_XC_TPSSH"],
# TPSS0: A 25% exchange version of TPSSh that yields improved energetics
# TPSS0: A 25% exchange version of TPSSh that yields improved energetics
# compared to TPSSh but is otherwise not well tested
# "TPSS0": ["HYB_MGGA_XC_TPSSH"],
# M06L: The Minnesota M06-L meta-GGA functional
......@@ -285,7 +284,7 @@ def build_OrcaMainFileSimpleMatcher():
which allows nice formating of nested SimpleMatchers in python.
Returns:
SimpleMatcher that parses main file of ORCA.
SimpleMatcher that parses main file of ORCA.
"""
#
# a) SimpleMatcher for header and ORCA version:
......@@ -333,7 +332,7 @@ def buildSinglePointSubMatchers():
subMatchers = [
SM(r"\s+(?P<x_orca_atom_labels>[a-zA-Z]+)\s+(?P<x_orca_atom_positions_x__angstrom>[-+0-9.]+)\s+(?P<x_orca_atom_positions_y__angstrom>[-+0-9.]+)\s+(?P<x_orca_atom_positions_z__angstrom>[-+0-9.]+)", repeats = True)
]
),
),
# Get basis set information:
SM(name = 'Basis set information',
startReStr = r"BASIS SET INFORMATION\s*",
......@@ -349,7 +348,7 @@ def buildSinglePointSubMatchers():
SM(r"\s*Group\s+[0-9]+\s+Type\s+(?P<x_orca_basis_set_atom_labels>[a-zA-Z]+)\s+:\s+(?P<x_orca_auxiliary_basis_set>[0-9a-z]+)\s+contracted\s+to\s+(?P<x_orca_auxiliary_basis_set_contracted>[0-9a-z]+)\s+pattern\s+\{[0-9/]+\}", repeats = True)
]
)
]
]
),
# Basis set statistics and startup info:
SM(name = 'Basis set statistics and startup info',
......@@ -544,7 +543,7 @@ def buildGeoOptMatcher():
#
# c) SimpleMatcher for geometry optimization:
# *******************************************
#
#
return SM(name = 'Geometry optimization',
startReStr = r"\s*\* Geometry Optimization Run \*\s*",
sections = ["section_sampling_method"],
......@@ -570,7 +569,7 @@ def buildGeoOptMatcher():
sections = ["x_orca_final_geometry"],
subMatchers = [
SM(r"\s+(?P<x_orca_atom_labels_geo_opt>[a-zA-Z]+)\s+(?P<x_orca_atom_positions_x_geo_opt__angstrom>[-+0-9.]+)\s+(?P<x_orca_atom_positions_y_geo_opt__angstrom>[-+0-9.]+)\s+(?P<x_orca_atom_positions_z_geo_opt__angstrom>[-+0-9.]+)", repeats = True)
]
]
),
# *** FINAL ENERGY EVALUATION AT THE STATIONARY POINT ***
#
......@@ -586,7 +585,7 @@ def buildMp2Matcher():
#
# d) Post-processing calculations:
# ********************************
#
#
# MP2 Calculation (post-proc):
return SM(name = 'mp2',
startReStr = r"\s*ORCA MP2 CALCULATION\s*",
......@@ -711,8 +710,29 @@ parserInfo = {
"version": "1.0"
}
metaInfoPath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),"../../../../nomad-meta-info/meta_info/nomad_meta_info/orca.nomadmetainfo.json"))
import nomad_meta_info
metaInfoPath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(nomad_meta_info.__file__)), "orca.nomadmetainfo.json"))
metaInfoEnv, warnings = loadJsonFile(filePath = metaInfoPath, dependencyLoader = None, extraArgsHandling = InfoKindEl.ADD_EXTRA_ARGS, uri = None)
class OrcaParser():
""" A proper class envolop for running this parser from within python. """
def __init__(self, backend, **kwargs):
self.backend_factory = backend
def parse(self, mainfile):
from unittest.mock import patch
logging.info('orca parser started')
logging.getLogger('nomadcore').setLevel(logging.WARNING)
backend = self.backend_factory(metaInfoEnv)
with patch.object(sys, 'argv', ['<exe>', '--uri', 'nmd://uri', mainfile]):
mainFunction(
mainFileDescription,
metaInfoEnv,
parserInfo,
superContext=OrcaContext(),
superBackend=backend)
return backend
if __name__ == "__main__":
mainFunction(mainFileDescription, metaInfoEnv, parserInfo, superContext=OrcaContext())
# Copyright 2015-2018 Lorenzo Pardini
#
# 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.
from setuptools import setup, find_packages
def main():
setup(
name='orcaparser',
version='0.1',
description='NOMAD parser implementation for Orca.',
license='APACHE 2.0',
package_dir={'': './'},
packages=find_packages(),
install_requires=[
'nomadcore'
],
)
if __name__ == '__main__':
main()
/*
* Copyright 2016-2018 Sebastian Alarcon Villaseca, Sebastián Alarcón Villaseca, Fawzi Mohamed, Micael Oliveira, Ankit Kariryaa, Danio Brambila
*
* 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 => lab }
import eu.nomad_lab.DefaultPythonInterpreter
import org.{ json4s => jn }
import scala.collection.breakOut
object OrcaParser extends SimpleExternalParserGenerator(
name = "OrcaParser",
parserInfo = jn.JObject(
("name" -> jn.JString("OrcaParser")) ::
("parserId" -> jn.JString("OrcaParser" + lab.OrcaVersionInfo.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.OrcaVersionInfo.toMap.map {
case (key, value) =>
(key -> jn.JString(value.toString))
}(breakOut): List[(String, jn.JString)])
)) :: Nil
),
mainFileTypes = Seq("text/.*"),
mainFileRe = """\s+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**\s*
\s+\* O R C A \*\s*
\s+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**\s*
\s*
\s*--- An Ab Initio, DFT and Semiempirical electronic structure package ---\s*
""".r,
cmd = Seq(DefaultPythonInterpreter.pythonExe(), "${envDir}/parsers/orca/parser/parser-orca/orca_parser.py",
"--uri", "${mainFileUri}", "${mainFilePath}"),
resList = Seq(
"parser-orca/orca_parser.py",
"parser-orca/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/orca.nomadmetainfo.json"
) ++ DefaultPythonInterpreter.commonFiles(),
dirMap = Map(
"parser-orca" -> "parsers/orca/parser/parser-orca",
"nomad_meta_info" -> "nomad-meta-info/meta_info/nomad_meta_info"
) ++ DefaultPythonInterpreter.commonDirMapping(),
metaInfoEnv = Some(lab.meta.KnownMetaInfoEnvs.orca)
)
/*
* Copyright 2016-2018 Sebastian Alarcon Villaseca, Sebastián Alarcón Villaseca, Fawzi Mohamed, Micael Oliveira, Ankit Kariryaa, Danio Brambila
*
* 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 OrcaParserSpec extends Specification {
"OrcaParserTest" >> {
"test with json-events" >> {
ParserRun.parse(OrcaParser, "parsers/orca/test/examples/output_files/orca3.2706823.out", "json-events") must_== ParseResult.ParseSuccess
}
"test with json" >> {
ParserRun.parse(OrcaParser, "parsers/orca/test/examples/output_files/orca3.2706823.out", "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