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
5877fe2e
Commit
5877fe2e
authored
4 years ago
by
temok-mx
Browse files
Options
Downloads
Patches
Plain Diff
Fermi energy: fixed bug on unopened section_single_configuration_calculation
parent
e358af6a
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
octopusparser/aseoct.py
+10
-15
10 additions, 15 deletions
octopusparser/aseoct.py
octopusparser/parser_octopus.py
+7
-18
7 additions, 18 deletions
octopusparser/parser_octopus.py
with
17 additions
and
33 deletions
octopusparser/aseoct.py
+
10
−
15
View file @
5877fe2e
...
@@ -310,7 +310,6 @@ def read_static_info_kpoints(fd):
...
@@ -310,7 +310,6 @@ def read_static_info_kpoints(fd):
return
dict
(
ibz_k_points
=
ibz_k_points
,
k_point_weights
=
k_point_weights
)
return
dict
(
ibz_k_points
=
ibz_k_points
,
k_point_weights
=
k_point_weights
)
#def read_static_info_eigenvalues(fd, energy_unit):
def
read_static_info_eigenvalues_efermi
(
fd
,
energy_unit
):
def
read_static_info_eigenvalues_efermi
(
fd
,
energy_unit
):
'''
'''
Parse eigenvalues and Fermi Energy from `static/info`
Parse eigenvalues and Fermi Energy from `static/info`
...
@@ -318,6 +317,13 @@ def read_static_info_eigenvalues_efermi(fd, energy_unit):
...
@@ -318,6 +317,13 @@ def read_static_info_eigenvalues_efermi(fd, energy_unit):
energy_unit: string
energy_unit: string
Returns: dictionary
Returns: dictionary
'''
'''
# we had to allow this function to handle both
# eigenvalues and Fermi energies because the later
# comes in the output file immediately after the last
# eigenvalue, hence the "fermi line" is consumed by the
# line checkers that look for eigenvalues.
values_sknx
=
{}
values_sknx
=
{}
nbands
=
0
nbands
=
0
...
@@ -383,7 +389,6 @@ def read_static_info(fd):
...
@@ -383,7 +389,6 @@ def read_static_info(fd):
elif
line
.
startswith
(
'
Eigenvalues [
'
):
elif
line
.
startswith
(
'
Eigenvalues [
'
):
unit
=
get_energy_unit
(
line
)
unit
=
get_energy_unit
(
line
)
results
.
update
(
read_static_info_eigenvalues_efermi
(
fd
,
unit
))
results
.
update
(
read_static_info_eigenvalues_efermi
(
fd
,
unit
))
## print('I found:', results['efermi'])
elif
line
.
startswith
(
'
Energy [
'
):
elif
line
.
startswith
(
'
Energy [
'
):
unit
=
get_energy_unit
(
line
)
unit
=
get_energy_unit
(
line
)
results
.
update
(
read_static_info_energy
(
fd
,
unit
))
results
.
update
(
read_static_info_energy
(
fd
,
unit
))
...
@@ -424,18 +429,6 @@ def read_static_info(fd):
...
@@ -424,18 +429,6 @@ def read_static_info(fd):
tokens
=
line
.
split
()[
-
3
:]
tokens
=
line
.
split
()[
-
3
:]
forces
.
append
([
float
(
f
)
for
f
in
tokens
])
forces
.
append
([
float
(
f
)
for
f
in
tokens
])
results
[
'
forces
'
]
=
np
.
array
(
forces
)
*
forceunit
results
[
'
forces
'
]
=
np
.
array
(
forces
)
*
forceunit
elif
line
.
startswith
(
'
Fermi
'
):
# this check is 'one line too late'
# hence we capture Fermi energy from
# `read_static_info_eigenvalues()`
# print('Point 1', line)
tokens
=
line
.
split
()
unit
=
{
'
eV
'
:
eV
,
'
H
'
:
Hartree
}[
tokens
[
-
1
]]
eFermi
=
float
(
tokens
[
-
2
])
*
unit
results
[
'
efermi
'
]
=
eFermi
# print("helloo, eFermi:", eFermi, unit)
# print('####1', line)
if
'
ibz_k_points
'
not
in
results
:
if
'
ibz_k_points
'
not
in
results
:
results
[
'
ibz_k_points
'
]
=
np
.
zeros
((
1
,
3
))
results
[
'
ibz_k_points
'
]
=
np
.
zeros
((
1
,
3
))
...
@@ -454,7 +447,6 @@ def read_static_info(fd):
...
@@ -454,7 +447,6 @@ def read_static_info(fd):
results
[
'
efermi
'
]
=
eFermi
results
[
'
efermi
'
]
=
eFermi
# print('eFermi estimate', eFermi) # this produces bad estimate
# print('eFermi estimate', eFermi) # this produces bad estimate
# ----
# ----
#print('finish', results['efermi'])
return
results
return
results
...
@@ -490,6 +482,9 @@ class Octopus(FileIOCalculator):
...
@@ -490,6 +482,9 @@ class Octopus(FileIOCalculator):
def
get_fermi_level
(
self
):
def
get_fermi_level
(
self
):
return
self
.
results
[
'
efermi
'
]
return
self
.
results
[
'
efermi
'
]
def
get_fermi_energy
(
self
):
return
self
.
results
[
'
efermi
'
]
def
get_dipole_moment
(
self
,
atoms
=
None
):
def
get_dipole_moment
(
self
,
atoms
=
None
):
if
'
dipole
'
not
in
self
.
results
:
if
'
dipole
'
not
in
self
.
results
:
msg
=
(
'
Dipole moment not calculated.
\n
'
msg
=
(
'
Dipole moment not calculated.
\n
'
...
...
This diff is collapsed.
Click to expand it.
octopusparser/parser_octopus.py
+
7
−
18
View file @
5877fe2e
...
@@ -67,20 +67,6 @@ def parse_infofile(meta_info_env, pew, fname):
...
@@ -67,20 +67,6 @@ def parse_infofile(meta_info_env, pew, fname):
iterations
=
int
(
line
.
split
()[
-
2
])
iterations
=
int
(
line
.
split
()[
-
2
])
pew
.
addValue
(
'
x_octopus_info_scf_converged_iterations
'
,
pew
.
addValue
(
'
x_octopus_info_scf_converged_iterations
'
,
iterations
)
iterations
)
# - - - -
if
line
.
startswith
(
'
Fermi
'
):
# print('\tLINE:', line)
#pew.addValue('energy_reference_fermi', fermiref)
break
# ############
# CHAT WITH MARKUS
for
line
in
fd
:
# Jump down to Fermi FIXME as in FIRST BLOCK
# beware of units
# 'Fermi energy': 'energy_reference_fermi'
if
line
.
startswith
(
'
Fermi
'
):
#octunit = line.strip().split()[-1].strip('[]:')
#nomadunit = {'eV': 'eV', 'H': 'hartree'}[octunit] # keep it
break
for
line
in
fd
:
# Jump down to energies:
for
line
in
fd
:
# Jump down to energies:
if
line
.
startswith
(
'
Energy [
'
):
if
line
.
startswith
(
'
Energy [
'
):
...
@@ -109,10 +95,6 @@ def parse_infofile(meta_info_env, pew, fname):
...
@@ -109,10 +95,6 @@ def parse_infofile(meta_info_env, pew, fname):
if
tokens
[
0
]
in
names
:
if
tokens
[
0
]
in
names
:
pew
.
addValue
(
names
[
tokens
[
0
]],
pew
.
addValue
(
names
[
tokens
[
0
]],
convert_unit
(
float
(
tokens
[
2
]),
nomadunit
))
convert_unit
(
float
(
tokens
[
2
]),
nomadunit
))
if
tokens
[
0
]
==
'
Fermi energy
'
:
pass
# print(tokens)
# print('#', line)
def
parse_logfile
(
meta_info_env
,
pew
,
fname
):
def
parse_logfile
(
meta_info_env
,
pew
,
fname
):
...
@@ -451,6 +433,10 @@ def parse_without_class(fname, backend, parser_info):
...
@@ -451,6 +433,10 @@ def parse_without_class(fname, backend, parser_info):
nspins
=
calc
.
get_number_of_spins
()
nspins
=
calc
.
get_number_of_spins
()
nkpts
=
len
(
calc
.
get_k_point_weights
())
nkpts
=
len
(
calc
.
get_k_point_weights
())
#fermi_energy = calc.get_fermi_level()
#print('I can see: ', fermi_energy)
#pew.addArrayValues('energy_reference_fermi', [fermi_energy, fermi_energy])
if
logfile
is
None
:
if
logfile
is
None
:
# print('No stdout logfile found', file=fd)
# print('No stdout logfile found', file=fd)
logging
.
debug
(
'
No stdout logfile found
'
)
logging
.
debug
(
'
No stdout logfile found
'
)
...
@@ -541,6 +527,9 @@ def parse_without_class(fname, backend, parser_info):
...
@@ -541,6 +527,9 @@ def parse_without_class(fname, backend, parser_info):
# np.array(atoms.pbc))
# np.array(atoms.pbc))
with
open_section
(
'
section_single_configuration_calculation
'
):
with
open_section
(
'
section_single_configuration_calculation
'
):
fermi_energy
=
calc
.
get_fermi_level
()
pew
.
addArrayValues
(
'
energy_reference_fermi
'
,
[
fermi_energy
,
fermi_energy
])
pew
.
addValue
(
'
single_configuration_calculation_to_system_ref
'
,
pew
.
addValue
(
'
single_configuration_calculation_to_system_ref
'
,
system_gid
)
system_gid
)
# print('Parse info file %s' % fname) #, file=fd)
# print('Parse info file %s' % fname) #, file=fd)
...
...
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