Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
parser-octopus
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-octopus
Commits
4cfdba76
Commit
4cfdba76
authored
9 years ago
by
Ask Hjorth Larsen
Browse files
Options
Downloads
Patches
Plain Diff
probably fix errors
parent
13e8d841
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
parser/parser-octopus/octopus_logfile_parser.py
+3
-2
3 additions, 2 deletions
parser/parser-octopus/octopus_logfile_parser.py
parser/parser-octopus/parser_octopus.py
+14
-12
14 additions, 12 deletions
parser/parser-octopus/parser_octopus.py
with
17 additions
and
14 deletions
parser/parser-octopus/octopus_logfile_parser.py
+
3
−
2
View file @
4cfdba76
...
...
@@ -32,8 +32,9 @@ def parse_logfile(meta_info_env, pew, fname):
# XXX this is just a hack until we decide to do more
maxlines
=
100
with
open
(
fname
)
as
fd
:
for
i
in
range
(
maxlines
):
line
=
next
(
fd
)
for
i
,
line
in
enumerate
(
fd
):
if
i
>
maxlines
:
break
if
line
.
startswith
(
'
Version
'
):
version
=
line
.
split
()[
-
1
]
pew
.
addValue
(
'
program_version
'
,
version
)
...
...
This diff is collapsed.
Click to expand it.
parser/parser-octopus/parser_octopus.py
+
14
−
12
View file @
4cfdba76
...
...
@@ -106,8 +106,9 @@ def read_input_file(path):
def
is_octopus_logfile
(
fname
):
fd
=
open
(
fname
)
for
lineno
in
range
(
20
):
line
=
next
(
fd
)
for
n
,
line
in
enumerate
(
fd
):
if
n
>
20
:
break
if
'
|0) ~ (0) |
'
in
line
:
# Eyes from Octopus logo
return
True
return
False
...
...
@@ -210,6 +211,13 @@ def register_octopus_keywords(pew, category, kwargs):
def
parse
(
fname
,
fd
):
# Look for files before we create some of our own files for logging etc.:
staticdirname
,
_basefname
=
os
.
path
.
split
(
fname
)
dirname
,
_static
=
os
.
path
.
split
(
staticdirname
)
inp_path
=
os
.
path
.
join
(
dirname
,
'
inp
'
)
parser_log_path
=
os
.
path
.
join
(
dirname
,
'
exec
'
,
'
parser.log
'
)
logfile
=
find_octopus_logfile
(
dirname
)
# fname refers to the static/info file.
pew
=
JsonParseEventsWriterBackend
(
metaInfoEnv
)
pew
.
startedParsingSession
(
fname
,
parser_info
)
...
...
@@ -227,11 +235,6 @@ def parse(fname, fd):
pew
.
addValue
(
'
program_name
'
,
'
Octopus
'
)
print
(
file
=
fd
)
staticdirname
,
_basefname
=
os
.
path
.
split
(
fname
)
dirname
,
_static
=
os
.
path
.
split
(
staticdirname
)
inp_path
=
os
.
path
.
join
(
dirname
,
'
inp
'
)
parser_log_path
=
os
.
path
.
join
(
dirname
,
'
exec
'
,
'
parser.log
'
)
print
(
'
Read Octopus keywords from input file %s
'
%
inp_path
,
file
=
fd
)
kwargs
=
read_input_file
(
inp_path
)
...
...
@@ -263,13 +266,12 @@ def parse(fname, fd):
nspins
=
calc
.
get_number_of_spins
()
nkpts
=
len
(
calc
.
get_k_point_weights
())
logfile
=
find_octopus_logfile
(
dirname
)
if
logfile
is
None
:
print
(
'
No stdout logfile found
'
,
file
=
fd
)
else
:
print
(
'
Found stdout logfile %s
'
%
logfile
,
file
=
fd
)
#
print('Parse logfile
using SimpleMatcher'
, file=fd)
#
parse_logfile(metaInfoEnv, pew, logfile)
print
(
'
Parse logfile
%s
'
%
logfile
,
file
=
fd
)
parse_logfile
(
metaInfoEnv
,
pew
,
logfile
)
print
(
'
Add parsed values
'
,
file
=
fd
)
with
open_section
(
'
section_system
'
):
...
...
@@ -289,8 +291,8 @@ def parse(fname, fd):
np
.
array
(
atoms
.
pbc
))
with
open_section
(
'
section_single_configuration_calculation
'
):
#
print('Parse info file
using SimpleMatcher'
, file=fd)
#
parse_infofile(metaInfoEnv, pew, fname)
print
(
'
Parse info file
%s
'
%
fname
,
file
=
fd
)
parse_infofile
(
metaInfoEnv
,
pew
,
fname
)
with
open_section
(
'
section_method
'
):
pew
.
addValue
(
'
number_of_spin_channels
'
,
nspins
)
...
...
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