Using Nomad's parsers locally

Hello,
I am Aminata DIALLO, student in Master 2 Computer Science at the University of Pars Saclay in France. I am currently doing an internship on the management of data from material calculation trajectories. I wish to execute locally on my computer the parser and the normalizer of Nomad.
On the other hand, I have some difficulties:
-I am trying to do parsing of a cp2k output file, when I do it in command line, I get the output of json format which I find not complete but at the beginning I get an error like this :
ERROR nomad.cli 2021-06-24T09:01:22 Parsing was not successful.

  • exception: Traceback (most recent call):
    File “/home/lambe/my_env/lib/python3.6/site-packages/nomad/cli/parse.py”, line 65, in parse
    os.chdir(os.path.abspath(os.path.dirname(mainfile_path)))
    FileNotFoundError: [Errno 2] No file or directory of this type: ‘/home/lambe/150k’.
  • exception_hash: WZU6aJ0izcIzts40ole7p2o_tmtE
  • nomad.cli.parser : parsers/cp2k
  • nomad.commit : 59baef14
  • nomad.deployment : standard
  • nomad.release : devel
  • nomad.service : cli
  • nomad.version : 0.10.4

-I want to use the Nomad parser and normalize it through a python program but I can’t access the nomad.cli.parser modul at the beginning of my program.

Can you please give me some explanations to my concerns.

Best regards,
Aminata DIALLO.

The parser is trying to change the working directory to “/home/lambe/150k”. If the directory exists, it is probably a right issue. If the directory does not exists, it is probably a problem with the given file path and it being misinterpreted, e.g. due to badly quoted special characters. Do you have more details about this?

It is really hard to tell, why you might have problems importing nomad modules. Do you have a more specific error message?

Hi,
When I type the command, nomad parse --parser parsers/cp2k --show-metadata 150k/dyn.out
I get the output:

ERROR nomad.cli 2021-06-28T12:24:16 parsing was not successful

  • exception: Traceback (most recent call last):
    File “/home/lambe/my_env/lib/python3.6/site-packages/nomad/cli/parse.py”, line 65, in parse
    os.chdir(os.path.abspath(os.path.dirname(mainfile_path)))
    FileNotFoundError: [Errno 2] No such file or directory: ‘/home/lambe/150k’
  • exception_hash: WZU6aJ0izcIzts40ole7p2o_tmtE
  • nomad.cli.parser: parsers/cp2k
  • nomad.commit: 59baef14
  • nomad.deployment: standard
  • nomad.release: devel
  • nomad.service: cli
  • nomad.version: 0.10.4
    WARNING nomad.datamodel 2021-06-28T12:24:17 no section_run found
  • nomad.calc_id: None
  • nomad.commit: 59baef14
  • nomad.deployment: standard
  • nomad.mainfile: None
  • nomad.release: devel
  • nomad.service: cli
  • nomad.upload_id: None
  • nomad.version: 0.10.4
    WARNING nomad.datamodel 2021-06-28T12:24:17 no section_run found
  • nomad.calc_id: None
  • nomad.commit: 59baef14
  • nomad.deployment: standard
  • nomad.mainfile: None
  • nomad.release: devel
  • nomad.service: cli
  • nomad.upload_id: None
  • nomad.version: 0.10.4
    {
    “domain”: “dft”,
    “dft”: {
    “code_name”: “unavailable”
    },
    “encyclopedia”: {
    “status”: “invalid_metainfo”
    }
    }

By the way when I try for example to use the parser through the program as shown on gitlab like this :

from nomad.cli.parse import parse, normalize_all

archive = parse(Desktop/Desktop_mac/150/Zala6_150k.out)
normalize_all(archive)

print(archive)

I have an error
File “/home/lambe/test.py”, line 2, in
from nomad.cli.parse import parse, normalize_all
ModuleNotFoundError: No module named ‘nomad.cli’

I still get the same error even if I install it with pip3 insatall nomad-lab[cli].

This is really hard to investigate remotely. I am pretty sure this a general issue about how Python is treating the paths you are giving, independent of NOMAD version or whether you use the CLI or Python script. What happens if you are using an absolute path? Move the file to a different directory? What OS are you using? What happens if you use Python’s os.chdir('/home/lambe/150k')?