Commit aeffb12e authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added some tutorial examples.

parent 5d54a7a9
'''
A simple example used in the NOMAD webinar API tutorial
'''
from nomad.client import ArchiveQuery
query = ArchiveQuery(
url='http://labdev-nomad.esc.rzg.mpg.de/fairdi/nomad/reprocess/api',
query={
'dft.code_name': 'VASP',
'atoms': ['Ti', 'O']
},
required={
'section_run': {
'section_single_configuration_calculation[-1]': {
'energy_total': '*',
'section_dos': '*'
}
}
},
parallel=1,
max=10)
print(query)
result = query[0]
print(result.section_run[0].section_single_configuration_calculation[-1].section_dos[0].dos_energies)
# type: ignore
'''
A simple example used in the NOMAD webinar API tutorial
'''
import requests
import json
base_url = 'http://nomad-lab.eu/prod/rae/api'
# response = requests.get(base_url + '/repo?datasets.name=NOMAD%20webinar')
response = requests.get(
base_url + '/repo',
params={'datasets.name': 'NOMAD webinar', 'per_page': 1})
data = response.json()
upload_id = data['results'][0]['upload_id']
calc_id = data['results'][0]['calc_id']
response = requests.get(
base_url + '/archive/%s/%s' % (upload_id, calc_id))
print(json.dumps(response.json(), indent=2))
print(
response.json()['section_run'][0]['section_single_configuration_calculation'][-1]['section_dos'][0]['dos_energies'])
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