Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
parser-vasp
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This project is archived. Its data is
read-only
.
Show more breadcrumbs
nomad-lab
parser-vasp
Commits
8c2e56b0
Commit
8c2e56b0
authored
Jul 30, 2020
by
Markus Scheidgen
Browse files
Options
Downloads
Patches
Plain Diff
Switched to FairdiParser with archive not backend.
parent
2c8b7763
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
vaspparser/__init__.py
+6
-5
6 additions, 5 deletions
vaspparser/__init__.py
vaspparser/__main__.py
+21
-0
21 additions, 0 deletions
vaspparser/__main__.py
vaspparser/parser_vasprun.py
+2
-2
2 additions, 2 deletions
vaspparser/parser_vasprun.py
with
29 additions
and
7 deletions
vaspparser/__init__.py
+
6
−
5
View file @
8c2e56b0
...
...
@@ -18,13 +18,15 @@ import gzip
import
bz2
import
lzma
from
nomad.datamodel
import
EntryArchive
from
.metainfo
import
m_env
from
vaspparser.parser_vasprun
import
VasprunContext
,
XmlParser
,
parser_info
from
nomad.parsing.parser
import
Matching
Parser
from
nomad.parsing.parser
import
Fairdi
Parser
from
vaspparser.parser_outcar
import
VaspOutcarParser
class
VASPParser
(
Matching
Parser
):
class
VASPParser
(
Fairdi
Parser
):
def
__init__
(
self
):
super
().
__init__
(
name
=
'
parsers/vasp
'
,
code_name
=
'
VASP
'
,
code_homepage
=
'
https://www.vasp.at/
'
,
...
...
@@ -38,7 +40,7 @@ class VASPParser(MatchingParser):
supported_compressions
=
[
'
gz
'
,
'
bz2
'
,
'
xz
'
]
)
def
run
(
self
,
filepath
,
logger
=
None
):
def
parse
(
self
,
filepath
,
archive
,
logger
=
None
):
self
.
_metainfo_env
=
m_env
super_context
=
VasprunContext
(
logger
=
logger
)
...
...
@@ -53,5 +55,4 @@ class VASPParser(MatchingParser):
elif
filepath
.
endswith
(
'
.xz
'
):
open_file
=
lzma
.
open
parser
.
parse
(
os
.
path
.
abspath
(
filepath
),
open_file
(
filepath
,
'
rt
'
))
return
parser
.
root_section
parser
.
parse
(
os
.
path
.
abspath
(
filepath
),
open_file
(
filepath
,
'
rt
'
),
archive
)
This diff is collapsed.
Click to expand it.
vaspparser/__main__.py
0 → 100644
+
21
−
0
View file @
8c2e56b0
# Copyright 2016-2018 Markus Scheidgen
# 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
json
from
vaspparser
import
VASPParser
if
__name__
==
"
__main__
"
:
archive
=
VASPParser
.
main
(
sys
.
argv
[
1
])
json
.
dump
(
archive
.
m_to_dict
(),
sys
.
stdout
,
indent
=
2
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
vaspparser/parser_vasprun.py
+
2
−
2
View file @
8c2e56b0
...
...
@@ -954,13 +954,13 @@ class XmlParser(object):
self
.
tagSections
=
{}
self
.
metainfo_env
=
metainfo_env
def
parse
(
self
,
main_file_uri
,
f_in
):
def
parse
(
self
,
main_file_uri
,
f_in
,
archive
):
if
self
.
path
:
raise
Exception
(
"
Parse of %s called with non empty path, parse already in progress?
"
%
main_file_uri
)
self
.
main_file_uri
=
main_file_uri
self
.
f_in
=
f_in
self
.
root_section
=
msection_run
(
)
self
.
root_section
=
archive
.
m_create
(
msection_run
)
self
.
super_context
.
parser
=
self
# there are invalid characters like esc in the files, we do not want to crash on them
xml_parser
=
MyXMLParser
()
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment