Commit 6a9d0e7e authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Try to add code_name, even with failed processing.

parent 359b74c5
...@@ -63,7 +63,7 @@ import magic ...@@ -63,7 +63,7 @@ import magic
import gzip import gzip
import bz2 import bz2
from nomad import files from nomad import files, config
from nomad.parsing.backend import AbstractParserBackend, LocalBackend, LegacyLocalBackend, JSONStreamWriter, BadContextURI, WrongContextState from nomad.parsing.backend import AbstractParserBackend, LocalBackend, LegacyLocalBackend, JSONStreamWriter, BadContextURI, WrongContextState
from nomad.parsing.parser import Parser, LegacyParser, VaspOutcarParser from nomad.parsing.parser import Parser, LegacyParser, VaspOutcarParser
...@@ -111,13 +111,13 @@ parsers = [ ...@@ -111,13 +111,13 @@ parsers = [
TemplateParser(), TemplateParser(),
ChaosParser(), ChaosParser(),
LegacyParser( LegacyParser(
name='parsers/phonopy', name='parsers/phonopy', code_name='Phonopy',
parser_class_name='phonopyparser.PhonopyParserWrapper', parser_class_name='phonopyparser.PhonopyParserWrapper',
# mainfile_contents_re=r'', # Empty regex since this code calls other DFT codes. # mainfile_contents_re=r'', # Empty regex since this code calls other DFT codes.
mainfile_name_re=(r'.*/phonopy-FHI-aims-displacement-0*1/control.in$') mainfile_name_re=(r'.*/phonopy-FHI-aims-displacement-0*1/control.in$')
), ),
LegacyParser( LegacyParser(
name='parsers/vasp', name='parsers/vasp', code_name='VASP',
parser_class_name='vaspparser.VASPRunParserInterface', parser_class_name='vaspparser.VASPRunParserInterface',
mainfile_mime_re=r'(application/xml)|(text/.*)', mainfile_mime_re=r'(application/xml)|(text/.*)',
mainfile_contents_re=( mainfile_contents_re=(
...@@ -129,13 +129,13 @@ parsers = [ ...@@ -129,13 +129,13 @@ parsers = [
supported_compressions=['gz', 'bz2'] supported_compressions=['gz', 'bz2']
), ),
VaspOutcarParser( VaspOutcarParser(
name='parsers/vasp', name='parsers/vasp-outcar', code_name='VASP',
parser_class_name='vaspparser.VaspOutcarParser', parser_class_name='vaspparser.VaspOutcarParser',
mainfile_name_re=r'(.*/)?OUTCAR(\.[^\.]*)?', mainfile_name_re=r'(.*/)?OUTCAR(\.[^\.]*)?',
mainfile_contents_re=(r'^\svasp\.') mainfile_contents_re=(r'^\svasp\.')
), ),
LegacyParser( LegacyParser(
name='parsers/exciting', name='parsers/exciting', code_name='exciting',
parser_class_name='excitingparser.ExcitingParser', parser_class_name='excitingparser.ExcitingParser',
mainfile_name_re=r'^.*/INFO\.OUT?', mainfile_name_re=r'^.*/INFO\.OUT?',
mainfile_contents_re=( mainfile_contents_re=(
...@@ -144,7 +144,7 @@ parsers = [ ...@@ -144,7 +144,7 @@ parsers = [
r'\s*\|\s*version hash id:\s*\S*\s*=') r'\s*\|\s*version hash id:\s*\S*\s*=')
), ),
LegacyParser( LegacyParser(
name='parsers/fhi-aims', name='parsers/fhi-aims', code_name='FHI-aims',
parser_class_name='fhiaimsparser.FHIaimsParser', parser_class_name='fhiaimsparser.FHIaimsParser',
mainfile_contents_re=( mainfile_contents_re=(
r'^(.*\n)*' r'^(.*\n)*'
...@@ -153,7 +153,7 @@ parsers = [ ...@@ -153,7 +153,7 @@ parsers = [
mainfile_name_re=r'^.(?!.*phonopy-FHI-aims-displacement)' mainfile_name_re=r'^.(?!.*phonopy-FHI-aims-displacement)'
), ),
LegacyParser( LegacyParser(
name='parsers/cp2k', name='parsers/cp2k', code_name='CP2K',
parser_class_name='cp2kparser.CP2KParser', parser_class_name='cp2kparser.CP2KParser',
mainfile_contents_re=( mainfile_contents_re=(
r'\*\*\*\* \*\*\*\* \*\*\*\*\*\* \*\* PROGRAM STARTED AT\s.*\n' r'\*\*\*\* \*\*\*\* \*\*\*\*\*\* \*\* PROGRAM STARTED AT\s.*\n'
...@@ -164,7 +164,7 @@ parsers = [ ...@@ -164,7 +164,7 @@ parsers = [
) )
), ),
LegacyParser( LegacyParser(
name='parsers/crystal', name='parsers/crystal', code_name='Crystal',
parser_class_name='crystalparser.CrystalParser', parser_class_name='crystalparser.CrystalParser',
mainfile_contents_re=( mainfile_contents_re=(
r'\s*[\*]{22,}' # Looks for '*' 22 times or more in a row. r'\s*[\*]{22,}' # Looks for '*' 22 times or more in a row.
...@@ -177,7 +177,7 @@ parsers = [ ...@@ -177,7 +177,7 @@ parsers = [
# when searching through the first 500 bytes of main files. We decided # when searching through the first 500 bytes of main files. We decided
# to use only a portion of the regex to avoid that issue. # to use only a portion of the regex to avoid that issue.
LegacyParser( LegacyParser(
name='parsers/cpmd', name='parsers/cpmd', code_name='CPMD',
parser_class_name='cpmdparser.CPMDParser', parser_class_name='cpmdparser.CPMDParser',
mainfile_contents_re=( mainfile_contents_re=(
# r'\s+\*\*\*\*\*\* \*\*\*\*\*\* \*\*\*\* \*\*\*\* \*\*\*\*\*\*\s*' # r'\s+\*\*\*\*\*\* \*\*\*\*\*\* \*\*\*\* \*\*\*\* \*\*\*\*\*\*\s*'
...@@ -191,7 +191,7 @@ parsers = [ ...@@ -191,7 +191,7 @@ parsers = [
) )
), ),
LegacyParser( LegacyParser(
name='parsers/nwchem', name='parsers/nwchem', code_name='NWChem',
parser_class_name='nwchemparser.NWChemParser', parser_class_name='nwchemparser.NWChemParser',
mainfile_contents_re=( mainfile_contents_re=(
r'\s+Northwest Computational Chemistry Package \(NWChem\) \d+\.\d+' r'\s+Northwest Computational Chemistry Package \(NWChem\) \d+\.\d+'
...@@ -202,7 +202,7 @@ parsers = [ ...@@ -202,7 +202,7 @@ parsers = [
) )
), ),
LegacyParser( LegacyParser(
name='parsers/bigdft', name='parsers/bigdft', code_name='BigDFT',
parser_class_name='bigdftparser.BigDFTParser', parser_class_name='bigdftparser.BigDFTParser',
mainfile_contents_re=( mainfile_contents_re=(
# r'__________________________________ A fast and precise DFT wavelet code\s*' # r'__________________________________ A fast and precise DFT wavelet code\s*'
...@@ -233,16 +233,16 @@ parsers = [ ...@@ -233,16 +233,16 @@ parsers = [
) )
), ),
LegacyParser( LegacyParser(
name='parsers/wien2k', name='parsers/wien2k', code_name='WIEN2k',
parser_class_name='wien2kparser.Wien2kParser', parser_class_name='wien2kparser.Wien2kParser',
mainfile_contents_re=r':LABEL\d+: using WIEN2k_\d+\.\d+' mainfile_contents_re=r':LABEL\d+: using WIEN2k_\d+\.\d+'
), ),
LegacyParser( LegacyParser(
name='parsers/band', name='parsers/band', code_name=config.services.not_processed_value,
parser_class_name='bandparser.BANDParser', parser_class_name='bandparser.BANDParser',
mainfile_contents_re=r' +\* +Amsterdam Density Functional +\(ADF\)'), mainfile_contents_re=r' +\* +Amsterdam Density Functional +\(ADF\)'),
LegacyParser( LegacyParser(
name='parsers/gaussian', name='parsers/gaussian', code_name='Gaussian',
parser_class_name='gaussianparser.GaussianParser', parser_class_name='gaussianparser.GaussianParser',
# This previous file matching string was too far down the line. # This previous file matching string was too far down the line.
# r'\s*Cite this work as:' # r'\s*Cite this work as:'
...@@ -252,7 +252,7 @@ parsers = [ ...@@ -252,7 +252,7 @@ parsers = [
# r'\s*([0-9][0-9]?\-[A-Z][a-z][a-z]\-[0-9]+)') # r'\s*([0-9][0-9]?\-[A-Z][a-z][a-z]\-[0-9]+)')
mainfile_contents_re=r'Gaussian, Inc'), mainfile_contents_re=r'Gaussian, Inc'),
LegacyParser( LegacyParser(
name='parsers/quantumespresso', name='parsers/quantumespresso', code_name='Quantum Espresso',
parser_class_name='quantumespressoparser.QuantumEspressoParserPWSCF', parser_class_name='quantumespressoparser.QuantumEspressoParserPWSCF',
mainfile_contents_re=( mainfile_contents_re=(
r'^\s*Program (\S+)\s+v\.(\S+)(?:\s+\(svn\s+rev\.\s+' r'^\s*Program (\S+)\s+v\.(\S+)(?:\s+\(svn\s+rev\.\s+'
...@@ -260,12 +260,12 @@ parsers = [ ...@@ -260,12 +260,12 @@ parsers = [
r'(?:\s*\n?)*This program is part of the open-source Quantum') r'(?:\s*\n?)*This program is part of the open-source Quantum')
), ),
LegacyParser( LegacyParser(
name='parsers/abinit', name='parsers/abinit', code_name='ABINIT',
parser_class_name='abinitparser.AbinitParser', parser_class_name='abinitparser.AbinitParser',
mainfile_contents_re=(r'^\n\.Version\s*[0-9.]*\s*of ABINIT\s*') mainfile_contents_re=(r'^\n\.Version\s*[0-9.]*\s*of ABINIT\s*')
), ),
LegacyParser( LegacyParser(
name='parsers/orca', name='parsers/orca', code_name='ORCA',
parser_class_name='orcaparser.OrcaParser', parser_class_name='orcaparser.OrcaParser',
mainfile_contents_re=( mainfile_contents_re=(
r'\s+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**\s*' r'\s+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**\s*'
...@@ -275,42 +275,42 @@ parsers = [ ...@@ -275,42 +275,42 @@ parsers = [
r'\s*--- An Ab Initio, DFT and Semiempirical electronic structure package ---\s*') r'\s*--- An Ab Initio, DFT and Semiempirical electronic structure package ---\s*')
), ),
LegacyParser( LegacyParser(
name='parsers/castep', name='parsers/castep', code_name='CASTEP',
parser_class_name='castepparser.CastepParser', parser_class_name='castepparser.CastepParser',
mainfile_contents_re=(r'\s\|\s*CCC\s*AA\s*SSS\s*TTTTT\s*EEEEE\s*PPPP\s*\|\s*') mainfile_contents_re=(r'\s\|\s*CCC\s*AA\s*SSS\s*TTTTT\s*EEEEE\s*PPPP\s*\|\s*')
), ),
LegacyParser( LegacyParser(
name='parsers/dl-poly', name='parsers/dl-poly', code_name='DL_POLY',
parser_class_name='dlpolyparser.DlPolyParserWrapper', parser_class_name='dlpolyparser.DlPolyParserWrapper',
mainfile_contents_re=(r'\*\* DL_POLY \*\*') mainfile_contents_re=(r'\*\* DL_POLY \*\*')
), ),
LegacyParser( LegacyParser(
name='parsers/lib-atoms', name='parsers/lib-atoms', code_name='libAtoms',
parser_class_name='libatomsparser.LibAtomsParserWrapper', parser_class_name='libatomsparser.LibAtomsParserWrapper',
mainfile_contents_re=(r'\s*<GAP_params\s') mainfile_contents_re=(r'\s*<GAP_params\s')
), ),
LegacyParser( LegacyParser(
name='parsers/octopus', name='parsers/octopus', code_name='Octopus',
parser_class_name='octopusparser.OctopusParserWrapper', parser_class_name='octopusparser.OctopusParserWrapper',
mainfile_contents_re=(r'\|0\) ~ \(0\) \|') mainfile_contents_re=(r'\|0\) ~ \(0\) \|')
# We decided to use the octopus eyes instead of # We decided to use the octopus eyes instead of
# r'\*{32} Grid \*{32}Simulation Box:' since it was so far down in the file. # r'\*{32} Grid \*{32}Simulation Box:' since it was so far down in the file.
), ),
LegacyParser( LegacyParser(
name='parsers/gpaw', name='parsers/gpaw', code_name='GPAW',
parser_class_name='gpawparser.GPAWParserWrapper', parser_class_name='gpawparser.GPAWParserWrapper',
mainfile_name_re=(r'^.*\.gpw$'), mainfile_name_re=(r'^.*\.gpw$'),
mainfile_mime_re=r'application/x-tar' mainfile_mime_re=r'application/x-tar'
), ),
LegacyParser( LegacyParser(
name='parsers/gpaw2', name='parsers/gpaw2', code_name='GPAW',
parser_class_name='gpawparser.GPAWParser2Wrapper', parser_class_name='gpawparser.GPAWParser2Wrapper',
# mainfile_contents_re=r'', # We can't read .gpw2 to match AFFormatGPAW' # mainfile_contents_re=r'', # We can't read .gpw2 to match AFFormatGPAW'
mainfile_name_re=(r'^.*\.gpw2$'), mainfile_name_re=(r'^.*\.gpw2$'),
mainfile_mime_re=r'application/x-tar' mainfile_mime_re=r'application/x-tar'
), ),
LegacyParser( LegacyParser(
name='parsers/atk', name='parsers/atk', code_name='ATK',
parser_class_name='atkparser.ATKParserWrapper', parser_class_name='atkparser.ATKParserWrapper',
# mainfile_contents_re=r'', # We can't read .gpw as txt - of UlmGPAW|AFFormatGPAW' # mainfile_contents_re=r'', # We can't read .gpw as txt - of UlmGPAW|AFFormatGPAW'
mainfile_name_re=r'^.*\.nc', mainfile_name_re=r'^.*\.nc',
...@@ -318,7 +318,7 @@ parsers = [ ...@@ -318,7 +318,7 @@ parsers = [
mainfile_mime_re=r'application/octet-stream' mainfile_mime_re=r'application/octet-stream'
), ),
LegacyParser( LegacyParser(
name='parsers/gulp', name='parsers/gulp', code_name='gulp',
parser_class_name='gulpparser.GULPParser', parser_class_name='gulpparser.GULPParser',
mainfile_contents_re=( mainfile_contents_re=(
r'\s*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*' r'\s*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*'
...@@ -326,13 +326,13 @@ parsers = [ ...@@ -326,13 +326,13 @@ parsers = [
r'\s*\*\s*GENERAL UTILITY LATTICE PROGRAM\s*\*\s*') r'\s*\*\s*GENERAL UTILITY LATTICE PROGRAM\s*\*\s*')
), ),
LegacyParser( LegacyParser(
name='parsers/siesta', name='parsers/siesta', code_name='Siesta',
parser_class_name='siestaparser.SiestaParser', parser_class_name='siestaparser.SiestaParser',
mainfile_contents_re=( mainfile_contents_re=(
r'(Siesta Version: siesta-|SIESTA [0-9]\.[0-9]\.[0-9])') r'(Siesta Version: siesta-|SIESTA [0-9]\.[0-9]\.[0-9])')
), ),
LegacyParser( LegacyParser(
name='parsers/elk', name='parsers/elk', code_name='elk',
parser_class_name='elkparser.ElkParser', parser_class_name='elkparser.ElkParser',
mainfile_contents_re=( mainfile_contents_re=(
r'\s*\+-----------+\+\s*' r'\s*\+-----------+\+\s*'
...@@ -340,12 +340,12 @@ parsers = [ ...@@ -340,12 +340,12 @@ parsers = [
r'\s*\+----------+\+\s*') r'\s*\+----------+\+\s*')
), ),
LegacyParser( LegacyParser(
name='parsers/elastic', name='parsers/elastic', code_name='elastic',
parser_class_name='elasticparser.ElasticParser', parser_class_name='elasticparser.ElasticParser',
mainfile_contents_re=r'\s*Order of elastic constants\s*=\s*[0-9]+\s*' mainfile_contents_re=r'\s*Order of elastic constants\s*=\s*[0-9]+\s*'
), ),
LegacyParser( LegacyParser(
name='parsers/gamess', name='parsers/gamess', code_name='GAMESS',
parser_class_name='gamessparser.GamessParser', parser_class_name='gamessparser.GamessParser',
mainfile_contents_re=( mainfile_contents_re=(
r'\s*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**\s*' r'\s*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**\s*'
...@@ -353,7 +353,7 @@ parsers = [ ...@@ -353,7 +353,7 @@ parsers = [
r'\s*\*\s*FROM IOWA STATE UNIVERSITY\s*\*\s*') r'\s*\*\s*FROM IOWA STATE UNIVERSITY\s*\*\s*')
), ),
LegacyParser( LegacyParser(
name='parsers/turbomole', name='parsers/turbomole', code_name='turbomole',
parser_class_name='turbomoleparser.TurbomoleParser', parser_class_name='turbomoleparser.TurbomoleParser',
mainfile_contents_re=( mainfile_contents_re=(
r'\s*(P?<progr>[a-zA-z0-9_]+)\s*(?:\([^()]+\))\s*:\s*TURBOMOLE\s*(P?<version>.*)' r'\s*(P?<progr>[a-zA-z0-9_]+)\s*(?:\([^()]+\))\s*:\s*TURBOMOLE\s*(P?<version>.*)'
......
...@@ -79,7 +79,7 @@ class LegacyParser(Parser): ...@@ -79,7 +79,7 @@ class LegacyParser(Parser):
supported_compressions: A list of [gz, bz2], if the parser supports compressed files supported_compressions: A list of [gz, bz2], if the parser supports compressed files
""" """
def __init__( def __init__(
self, name: str, parser_class_name: str, self, name: str, code_name: str, parser_class_name: str,
mainfile_contents_re: str = None, mainfile_contents_re: str = None,
mainfile_mime_re: str = r'text/.*', mainfile_mime_re: str = r'text/.*',
mainfile_name_re: str = r'.*', mainfile_name_re: str = r'.*',
......
...@@ -184,8 +184,14 @@ class Calc(Proc): ...@@ -184,8 +184,14 @@ class Calc(Proc):
calc_with_metadata.crystal_system = config.services.not_processed_value calc_with_metadata.crystal_system = config.services.not_processed_value
calc_with_metadata.spacegroup = config.services.not_processed_value calc_with_metadata.spacegroup = config.services.not_processed_value
calc_with_metadata.spacegroup_symbol = config.services.not_processed_value calc_with_metadata.spacegroup_symbol = config.services.not_processed_value
calc_with_metadata.code_name = config.services.not_processed_value
calc_with_metadata.code_version = config.services.not_processed_value calc_with_metadata.code_version = config.services.not_processed_value
calc_with_metadata.code_name = config.services.not_processed_value
if self.parser is not None:
parser = parser_dict[self.parser]
if hasattr(parser, 'code_name'):
calc_with_metadata.code_name = parser.code_name
calc_with_metadata.processed = False calc_with_metadata.processed = False
self.metadata = calc_with_metadata.to_dict() self.metadata = calc_with_metadata.to_dict()
search.Entry.from_calc_with_metadata(calc_with_metadata).save() search.Entry.from_calc_with_metadata(calc_with_metadata).save()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment