Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
parser-orca
Commits
83a4de4e
Commit
83a4de4e
authored
Feb 22, 2019
by
Daniel Speckhard
Browse files
Added Orca to Nomad-Faird framework.
parent
248e14fd
Changes
12
Show whitespace changes
Inline
Side-by-side
.gitignore
View file @
83a4de4e
...
...
@@ -9,6 +9,8 @@ syntax: glob
*.pyc
*.bk
*.swp
*.egg-info
.DS_Store
# logging files
...
...
orcaparser.egg-info/PKG-INFO
0 → 100644
View file @
83a4de4e
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
orcaparser.egg-info/SOURCES.txt
0 → 100644
View file @
83a4de4e
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
orcaparser.egg-info/dependency_links.txt
0 → 100644
View file @
83a4de4e
orcaparser.egg-info/requires.txt
0 → 100644
View file @
83a4de4e
nomadcore
orcaparser.egg-info/top_level.txt
0 → 100644
View file @
83a4de4e
orcaparser
orcaparser/__init__.py
0 → 100644
View file @
83a4de4e
# 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
parser/
parser-orca/orca_
parser.py
→
orca
parser/parser.py
View file @
83a4de4e
...
...
@@ -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
...
...
@@ -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
())
parser/
parser
-orca
/setup_paths.py
→
orca
parser/setup_paths.py
View file @
83a4de4e
File moved
setup.py
0 → 100644
View file @
83a4de4e
# 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
()
src/main/scala/eu/nomad_lab/parsers/OrcaParser.scala
deleted
100644 → 0
View file @
248e14fd
/*
* 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
)
)
src/test/scala/eu/nomad_lab/parsers/OrcaParserSpec.scala
deleted
100644 → 0
View file @
248e14fd
/*
* 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
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment