Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import json
4class CLICommand:
5 """Get calculations from NOMAD and write to JSON files.
7 ...
8 """
10 @staticmethod
11 def add_arguments(p):
12 p.add_argument('uri', nargs='+', metavar='nmd://<hash>',
13 help='URIs to get')
15 @staticmethod
16 def run(args):
17 from ase.nomad import download
18 for uri in args.uri:
19 calculation = download(uri)
20 identifier = calculation.hash.replace('/', '.')
21 fname = 'nmd.{}.nomad-json'.format(identifier)
22 with open(fname, 'w') as fd:
23 json.dump(calculation, fd)
24 print(uri)