ArchiveQuery AssertionError, Unit of measurement and magnitude in encyclopedia's ```energy_total```

Some issues/questions I have found while using the NOMAD API:

  1. ArchiveQuery AssertionError
    Fetching data with ArchiveQuery appears to work properly when requesting e.g. data in the order of 1000 entries, but when reducing the number of constrains in the requested field, the following error arises:
File "path\anaconda3\lib\", line 43, in <module>
    for result in query:
  File "path\anaconda3\lib\", line 984, in __iter__
    v = self[i]
  File "path\anaconda3\lib\site-packages\nomad\", line 528, in __getitem__
  File "path\anaconda3\lib\site-packages\nomad\", line 481, in call_api
    assert False, 'archive query was not stopped before running out of things to query'
AssertionError: archive query was not stopped before running out of things to query

This is the code causing the error, where the commented line is the one that when on the query works, when off causes the error above.

query = ArchiveQuery(
    'domain': 'dft',
    'dft.system': 'bulk',
    'dft.labels_springer_compound_class': ['oxide'],
    #'dft.compound_type': 'ternary',
    'atoms': ['Li']
    required = {
      'section_metadata': {
        'encyclopedia': {
            'material': {
                'formula': '*'
          'properties': {
            'energies': {
                'energy_total': '*'
per_page = 100,
max = None,

Any ideas about the reason? Is it a problem of my code or is it a bug of ArchiveQuery?

  1. Unit of measurement and magnitude in encyclopedia’s energy_total

After downloading the data with the code above (including 'dft.compound_type': 'ternary'), I organised it in a pandas dataframeand grouped it by formula, with the following code:

for result in query:
    formula = result.section_metadata.encyclopedia.material.formula
    en =
    en = en*6.2415091e18 ## convert to eV
f_array = np.array(f)
e_array = np.array(e)
twod = np.column_stack((f_array, e_array))
df = pd.DataFrame(data = twod, index = None, columns = ['formula', 'energy'])
df['energy'] = df['energy'].astype("float64")
df.groupby(['formula']).agg(['mean','median','min','max', 'count','sum'])

The energy values are reported to be in the order of -1e-18eV, which did not sounds very reasonable to me, so I assumed there was an error and the values are actually stored in J. I then operated a manual conversion to eV. Was I right in doing so?
The code above results in rows like the following one (energies in eV after manual conversion):

                                 mean	       median	         min	             max	     count	      sum
Ag4Li4O4	-1179.191765	-1619.796100	-1619.796107	-4.253954	11	-12971.10941

Why do the energies vary so much? Can any of these data represent the material stability, or at least an average on the various phases?

Thank you very much,