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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nomad-lab
parser-vasp
Commits
05e5f608
Commit
05e5f608
authored
6 years ago
by
Markus Scheidgen
Browse files
Options
Downloads
Patches
Plain Diff
Added minimar OUTCAR parser that can be used in absence of .xml to create repository meta data.
parent
3670915d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
vaspparser/__init__.py
+1
-0
1 addition, 0 deletions
vaspparser/__init__.py
vaspparser/parser_outcar.py
+92
-0
92 additions, 0 deletions
vaspparser/parser_outcar.py
with
93 additions
and
0 deletions
vaspparser/__init__.py
+
1
−
0
View file @
05e5f608
...
@@ -20,6 +20,7 @@ import nomadcore.baseclasses
...
@@ -20,6 +20,7 @@ import nomadcore.baseclasses
from
vaspparser.parser_vasprun
import
parserInfo
from
vaspparser.parser_vasprun
import
parserInfo
from
vaspparser.parser_vasprun
import
VasprunContext
,
XmlParser
,
parserInfo
from
vaspparser.parser_vasprun
import
VasprunContext
,
XmlParser
,
parserInfo
from
vaspparser.parser_outcar
import
VaspOutcarParser
class
VASPRunParser
:
class
VASPRunParser
:
...
...
This diff is collapsed.
Click to expand it.
vaspparser/parser_outcar.py
0 → 100644
+
92
−
0
View file @
05e5f608
# Copyright 2019-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
numpy
as
np
from
ase.io
import
read
as
ase_read
from
nomadcore.simple_parser
import
SimpleMatcher
from
nomadcore.baseclasses
import
ParserInterface
,
MainHierarchicalParser
from
nomad.parsing
import
LocalBackend
"""
A very basic VASP OUTCAR parser. It is only used to get nomad repository
metadata in absence of the VASP .xml file.
"""
class
VaspOutcarParser
(
ParserInterface
):
def
get_metainfo_filename
(
self
):
return
'
vasp.nomadmetainfo.json
'
def
get_parser_info
(
self
):
return
{
'
name
'
:
'
vaspoutcar_parser
'
,
'
version
'
:
'
1.0.0
'
}
def
setup_version
(
self
):
self
.
setup_main_parser
(
None
)
def
setup_main_parser
(
self
,
_
):
self
.
main_parser
=
MainParser
(
self
.
parser_context
)
class
MainParser
(
MainHierarchicalParser
):
def
__init__
(
self
,
parser_context
,
*
args
,
**
kwargs
):
super
().
__init__
(
parser_context
,
*
args
,
**
kwargs
)
self
.
lattice_vectors
=
[]
self
.
root_matcher
=
SimpleMatcher
(
name
=
'
root
'
,
startReStr
=
r
'
vasp.
'
,
weak
=
True
,
sections
=
[
'
section_run
'
,
'
section_system
'
,
'
section_method
'
],
subMatchers
=
[
SimpleMatcher
(
r
'
\svasp.(?P<program_version>\d+.\d+.\d+)\s.*
'
)
]
)
def
parse
(
self
,
mainfile
,
*
args
,
**
kwargs
):
self
.
ase
=
ase_read
(
mainfile
,
format
=
'
vasp-out
'
)
super
().
parse
(
mainfile
,
*
args
,
**
kwargs
)
def
add_lattice_vector
(
self
,
backend
,
data
):
self
.
lattice_vectors
.
append
(
list
(
float
(
x
.
strip
())
for
x
in
data
[
1
].
split
(
'
,
'
)))
def
onClose_section_method
(
self
,
backend
,
*
args
,
**
kwargs
):
backend
.
openNonOverlappingSection
(
'
section_XC_functionals
'
)
backend
.
addValue
(
'
XC_functional_name
'
,
'
GGA_X_PBE
'
)
backend
.
closeNonOverlappingSection
(
'
section_XC_functionals
'
)
backend
.
addValue
(
'
electronic_structure_method
'
,
'
DFT
'
)
def
onClose_section_system
(
self
,
backend
,
*
args
,
**
kwargs
):
backend
.
addArrayValues
(
'
atom_labels
'
,
np
.
array
(
self
.
ase
.
get_chemical_symbols
()))
backend
.
addArrayValues
(
'
atom_positions
'
,
self
.
ase
.
get_positions
())
backend
.
addArrayValues
(
'
lattice_vectors
'
,
self
.
ase
.
get_cell
())
backend
.
addArrayValues
(
'
configuration_periodic_dimensions
'
,
self
.
ase
.
get_pbc
())
def
onClose_section_run
(
self
,
backend
,
*
args
,
**
kwargs
):
backend
.
addValue
(
'
program_name
'
,
'
vasp
'
)
backend
.
addValue
(
'
program_basis_set_type
'
,
'
plane waves
'
)
if
__name__
==
"
__main__
"
:
parser
=
VaspOutcarParser
(
backend
=
LocalBackend
)
parser
.
parse
(
sys
.
argv
[
1
])
print
(
parser
.
parser_context
.
super_backend
)
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
register
or
sign in
to comment