Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
parser-siesta
Commits
a073c234
Commit
a073c234
authored
Jul 11, 2016
by
Ask Hjorth Larsen
Browse files
fix a few issues with metadata sections and names
parent
b831cd00
Changes
1
Hide whitespace changes
Inline
Side-by-side
parser/parser-siesta/main.py
View file @
a073c234
...
...
@@ -74,10 +74,10 @@ def tokenize(lines):
return
np
.
array
([
line
.
split
()
for
line
in
lines
],
object
)
@
errprint
def
build_cell
(
backend
,
lines
):
cell
=
tokenize
(
lines
).
astype
(
float
)
backend
.
addArrayValues
(
'simulation_cell'
,
convert_unit
(
cell
,
'angstrom'
))
#
@errprint
#
def build_cell(backend, lines):
#
cell = tokenize(lines).astype(float)
#
backend.addArrayValues('simulation_cell', convert_unit(cell, 'angstrom'))
@
errprint
def
get_forces
(
backend
,
lines
):
...
...
@@ -94,7 +94,7 @@ def get_forces(backend, lines):
def
get_stress
(
backend
,
lines
):
stress
=
tokenize
(
lines
)[:,
1
:].
astype
(
float
)
assert
stress
.
shape
==
(
3
,
3
)
backend
.
addArrayValues
(
'
atom_
stress'
,
convert_unit
(
stress
,
'eV/angstrom**3'
))
backend
.
addArrayValues
(
'stress
_tensor
'
,
convert_unit
(
stress
,
'eV/angstrom**3'
))
@
errprint
def
get_dipole
(
backend
,
lines
):
...
...
@@ -233,7 +233,6 @@ class SiestaContext(object):
nkpts
=
int
(
tokens
[
0
])
data
=
np
.
array
(
tokens
[
1
:],
object
).
reshape
(
-
1
,
5
)
print
(
'data'
,
data
)
coords
=
data
[:,
1
:
4
].
astype
(
float
)
weights
=
data
[:,
4
].
astype
(
float
)
backend
.
addArrayValues
(
'eigenvalues_kpoints'
,
coords
)
...
...
@@ -257,12 +256,16 @@ infoFileDescription = SM(
name
=
'name&version'
,
required
=
True
),
SM
(
r
'reinit: System Label:\s*\S*'
,
name
=
'syslabel'
,
forwardMatch
=
True
,
adHoc
=
context
.
set_label
),
ArraySM
(
r
'siesta: Atomic coordinates \(Bohr\) and species'
,
r
'siesta:\s*\S+\s+\S+\s+\S+\s+\S+\s+\S+'
,
add_positions_and_labels
),
ArraySM
(
r
'siesta: Automatic unit cell vectors \(Ang\):'
,
r
'siesta:\s*\S+\s*\S+\s*\S+'
,
get_array
(
'simulation_cell'
,
float
,
1
,
4
,
unit
=
'angstrom'
)),
SM
(
r
''
,
weak
=
True
,
forwardMatch
=
True
,
name
=
'system section'
,
sections
=
[
'section_system'
],
subMatchers
=
[
ArraySM
(
r
'siesta: Atomic coordinates \(Bohr\) and species'
,
r
'siesta:\s*\S+\s+\S+\s+\S+\s+\S+\s+\S+'
,
add_positions_and_labels
),
ArraySM
(
r
'siesta: Automatic unit cell vectors \(Ang\):'
,
r
'siesta:\s*\S+\s*\S+\s*\S+'
,
get_array
(
'simulation_cell'
,
float
,
1
,
4
,
unit
=
'angstrom'
))
]),
SM
(
r
'\s*Single-point calculation|\s*Begin \S+ opt\.'
,
name
=
'singleconfig'
,
repeats
=
True
,
...
...
@@ -273,9 +276,9 @@ infoFileDescription = SM(
ArraySM
(
r
'outcoor: Atomic coordinates \(Ang\):'
,
r
'\s*\S+\s*\S+\s*\S+'
,
get_array
(
'atom_positions'
,
float
,
0
,
3
,
unit
=
'angstrom'
)),
ArraySM
(
r
'outcell: Unit cell vectors \(Ang\):'
,
r
'\s*\S+\s*\S+\s*\S+'
,
build_cell
),
#
ArraySM(r'outcell: Unit cell vectors \(Ang\):',
#
r'\s*\S+\s*\S+\s*\S+',
#
build_cell),
SM
(
r
'\s*scf:\s*iscf'
,
name
=
'scf'
,
required
=
True
),
SM
(
r
'SCF cycle converged after\s*%s\s*iterations'
%
integer
(
'number_of_scf_iterations'
),
name
=
'scf-iterations'
),
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment