Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
parser-wien2k
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
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-wien2k
Commits
d58ac9b6
Commit
d58ac9b6
authored
5 years ago
by
Lauri Himanen
Browse files
Options
Downloads
Patches
Plain Diff
Added exception handling.
parent
4719cca1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wien2kparser/parser_wien2k.py
+14
-10
14 additions, 10 deletions
wien2kparser/parser_wien2k.py
with
14 additions
and
10 deletions
wien2kparser/parser_wien2k.py
+
14
−
10
View file @
d58ac9b6
...
@@ -14,7 +14,7 @@ import wien2kparser.wien2k_parser_in1c as wien2k_parser_in1c
...
@@ -14,7 +14,7 @@ import wien2kparser.wien2k_parser_in1c as wien2k_parser_in1c
import
wien2kparser.wien2k_parser_in2c
as
wien2k_parser_in2c
import
wien2kparser.wien2k_parser_in2c
as
wien2k_parser_in2c
import
wien2kparser.wien2k_parser_in1
as
wien2k_parser_in1
import
wien2kparser.wien2k_parser_in1
as
wien2k_parser_in1
import
wien2kparser.wien2k_parser_in2
as
wien2k_parser_in2
import
wien2kparser.wien2k_parser_in2
as
wien2k_parser_in2
import
logging
as
_logging
import
logging
from
nomad.parsing.legacy
import
CoESimpleMatcherParser
from
nomad.parsing.legacy
import
CoESimpleMatcherParser
...
@@ -190,15 +190,19 @@ class Wien2kContext(object):
...
@@ -190,15 +190,19 @@ class Wien2kContext(object):
if
os
.
path
.
exists
(
fName
):
if
os
.
path
.
exists
(
fName
):
# ASE does not support reading file object for WIEN2k structure files.
# ASE does not support reading file object for WIEN2k structure files.
atoms
=
ase
.
io
.
read
(
fName
,
format
=
"
struct
"
)
try
:
pos
=
atoms
.
get_positions
()
*
1E-10
atoms
=
ase
.
io
.
read
(
fName
,
format
=
"
struct
"
)
symbols
=
atoms
.
get_chemical_symbols
()
except
Exception
:
cell
=
atoms
.
get_cell
()
*
1E-10
logging
.
error
(
"
Could not read/parse the WIEN2k structure file.
"
)
pbc
=
atoms
.
get_pbc
()
else
:
backend
.
addArrayValues
(
'
lattice_vectors
'
,
cell
)
pos
=
atoms
.
get_positions
()
*
1E-10
backend
.
addArrayValues
(
"
configuration_periodic_dimensions
"
,
pbc
)
symbols
=
atoms
.
get_chemical_symbols
()
backend
.
addValue
(
"
atom_labels
"
,
symbols
)
cell
=
atoms
.
get_cell
()
*
1E-10
backend
.
addArrayValues
(
'
atom_positions
'
,
pos
)
pbc
=
atoms
.
get_pbc
()
backend
.
addArrayValues
(
'
lattice_vectors
'
,
cell
)
backend
.
addArrayValues
(
"
configuration_periodic_dimensions
"
,
pbc
)
backend
.
addValue
(
"
atom_labels
"
,
symbols
)
backend
.
addArrayValues
(
'
atom_positions
'
,
pos
)
with
open
(
fName
,
"
r
"
)
as
fin
:
with
open
(
fName
,
"
r
"
)
as
fin
:
structSuperContext
=
wien2k_parser_struct
.
Wien2kStructContext
()
structSuperContext
=
wien2k_parser_struct
.
Wien2kStructContext
()
...
...
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