Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
708f5972
Commit
708f5972
authored
Jan 30, 2019
by
Markus Scheidgen
Browse files
Merged parser intergtion.
parent
e07ca8cd
Pipeline
#43018
passed with stages
in 17 minutes and 54 seconds
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
nomad/config.py
View file @
708f5972
...
...
@@ -20,6 +20,11 @@ This module is used to store all configuration values. It makes use of
import
os
import
logging
from
collections
import
namedtuple
import
warnings
warnings
.
filterwarnings
(
"ignore"
,
message
=
"numpy.dtype size changed"
)
warnings
.
filterwarnings
(
"ignore"
,
message
=
"numpy.ufunc size changed"
)
FilesConfig
=
namedtuple
(
'FilesConfig'
,
[
'uploads_bucket'
,
'raw_bucket'
,
'archive_bucket'
,
'staging_bucket'
,
'public_bucket'
])
...
...
nomad/normalizing/repository.py
View file @
708f5972
...
...
@@ -18,6 +18,8 @@ from nomad.parsing import BadContextURI
from
.normalizer
import
Normalizer
unavailable_label
=
'unavailable'
class
RepositoryNormalizer
(
Normalizer
):
"""
...
...
@@ -31,13 +33,16 @@ class RepositoryNormalizer(Normalizer):
'hyb'
:
'hybrid'
,
'mgga'
:
'meta-GGA'
,
'vdw'
:
'vdW'
,
'lda'
:
'LDA'
'lda'
:
'LDA'
,
}
""" https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-meta-info/wikis/metainfo/XC-functional """
version_re
=
re
.
compile
(
r
'(\d+(\.\d+(\.\d+)?)?)'
)
def
map_functional_name_to_xc_treatment
(
self
,
name
):
if
name
==
unavailable_label
:
return
name
return
RepositoryNormalizer
.
xc_treatments
.
get
(
name
[:
3
].
lower
(),
name
)
def
simplify_version
(
self
,
version
):
...
...
@@ -47,6 +52,12 @@ class RepositoryNormalizer(Normalizer):
else
:
return
match
.
group
(
0
)
def
get_optional_value
(
self
,
key
):
try
:
return
self
.
_backend
.
get_value
(
key
,
0
)
except
KeyError
:
return
unavailable_label
def
normalize
(
self
,
logger
=
None
)
->
None
:
super
().
normalize
(
logger
)
b
=
self
.
_backend
...
...
@@ -61,22 +72,25 @@ class RepositoryNormalizer(Normalizer):
b
.
openNonOverlappingSection
(
'section_repository_parserdata'
)
b
.
addValue
(
'repository_checksum'
,
b
.
get_value
(
'calc_hash'
,
0
))
b
.
addValue
(
'repository_chemical_formula'
,
b
.
get_value
(
'chemical_composition_bulk_reduced'
,
0
))
b
.
addValue
(
'repository_parser_id'
,
b
.
get_value
(
'parser_name'
,
0
))
atom_labels
=
b
.
get_value
(
'atom_labels'
,
0
)
b
.
addValue
(
'repository_atomic_elements'
,
list
(
set
(
atom_labels
)))
b
.
addValue
(
'repository_atomic_elements_count'
,
len
(
atom_labels
))
b
.
addValue
(
'repository_basis_set_type'
,
b
.
get_value
(
'program_basis_set_type'
,
0
))
b
.
addValue
(
'repository_crystal_system'
,
b
.
get_value
(
'crystal_system'
,
0
))
b
.
addValue
(
'repository_program_name'
,
b
.
get_value
(
'program_name'
,
0
))
b
.
addValue
(
'repository_code_version'
,
self
.
simplify_version
(
b
.
get_value
(
'program_version'
,
0
)))
b
.
addValue
(
'repository_spacegroup_nr'
,
b
.
get_value
(
'space_group_number'
,
0
))
b
.
addValue
(
'repository_parser_id'
,
b
.
get_value
(
'parser_name'
,
0
))
b
.
addValue
(
'repository_chemical_formula'
,
b
.
get_value
(
'chemical_composition_bulk_reduced'
,
0
))
atom_labels
=
b
.
get_value
(
'atom_labels'
,
0
)
b
.
addValue
(
'repository_atomic_elements'
,
list
(
set
(
atom_labels
)))
b
.
addValue
(
'repository_atomic_elements_count'
,
len
(
atom_labels
))
b
.
addValue
(
'repository_system_type'
,
b
.
get_value
(
'system_type'
,
0
))
b
.
addValue
(
'repository_crystal_system'
,
self
.
get_optional_value
(
'crystal_system'
))
b
.
addValue
(
'repository_spacegroup_nr'
,
self
.
get_optional_value
(
'space_group_number'
))
b
.
addValue
(
'repository_basis_set_type'
,
self
.
get_optional_value
(
'program_basis_set_type'
))
b
.
addValue
(
'repository_xc_treatment'
,
self
.
map_functional_name_to_xc_treatment
(
b
.
get_value
(
'XC_functional_name'
,
0
)))
self
.
map_functional_name_to_xc_treatment
(
self
.
get_
optional_
value
(
(
'XC_functional_name'
)
)))
b
.
closeNonOverlappingSection
(
'section_repository_parserdata'
)
if
repository_info_context
is
None
:
...
...
nomad/parsing/backend.py
View file @
708f5972
...
...
@@ -449,6 +449,9 @@ class LocalBackend(LegacyParserBackend):
if
g_index
!=
-
1
:
sections
=
[
section
for
section
in
sections
if
section
.
gIndex
==
g_index
]
if
len
(
sections
)
==
0
:
raise
KeyError
assert
len
(
sections
)
==
1
section
=
sections
[
0
]
...
...
nomad/patch.py
View file @
708f5972
...
...
@@ -12,14 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
systax.analysis.symmetryanalyzer
import
matid.symmetry.symmetryanalyzer
import
matid.utils.segfault_protect
# A patch for the segfault protection of systax (internally uses protection for spglib calls.)
# We basically disable the protection. The multiprocessing based original protection.
# somehow interfers with the celery work infrastructure and leads to a dea
k
lock. Its a TODO.
# somehow interfers with the celery work infrastructure and leads to a dea
d
lock. Its a TODO.
def
segfault_protect_patch
(
f
,
*
args
,
**
kwargs
):
return
f
(
*
args
,
**
kwargs
)
systax
.
analysis
.
symmetryanalyzer
.
segfault_protect
=
segfault_protect_patch
matid
.
symmetry
.
symmetryanalyzer
.
segfault_protect
=
segfault_protect_patch
matid
.
utils
.
segfault_protect
.
segfault_protect
=
segfault_protect_patch
tests/data/proc/examples_template.zip
View file @
708f5972
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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