libAtoms / abcd

1 stars 4 forks source link

-f is not really optional for download -- no file type inference despite ase already doing this #96

Closed stenczelt closed 3 years ago

stenczelt commented 4 years ago

if you are trying to download something without the file type specified, the command line interface breaks, even if the filename would make it obvious for ASE:

this works:

abcd download fn.xyz -f xyz  -q="filename='proc_gap5_minima_135.xyz'"

but this does not:

abcd download fn.xyz  -q="filename='proc_gap5_minima_135.xyz'"
Traceback (most recent call last):
  File "/home/tks32/programs/miniconda3/envs/quip_env/bin/abcd", line 8, in <module>
    sys.exit(main())
  File "/home/tks32/programs/miniconda3/envs/quip_env/lib/python3.7/site-packages/abcd/frontends/commandline/parser.py", line 121, in main
    callback_func(**kwargs)
  File "/home/tks32/programs/miniconda3/envs/quip_env/lib/python3.7/site-packages/abcd/frontends/commandline/decorators.py", line 15, in wrapper
    func(*args, config=config, **kwargs)
  File "/home/tks32/programs/miniconda3/envs/quip_env/lib/python3.7/site-packages/abcd/frontends/commandline/decorators.py", line 48, in wrapper
    func(*args, db=db, query=query, **kwargs)
  File "/home/tks32/programs/miniconda3/envs/quip_env/lib/python3.7/site-packages/abcd/frontends/commandline/commands.py", line 41, in download
    write(filename, list(db.get_atoms(query=query)), format=fileformat)
  File "/home/tks32/programs/miniconda3/envs/quip_env/lib/python3.7/site-packages/ase/io/formats.py", line 507, in write
    **kwargs)
  File "/home/tks32/programs/miniconda3/envs/quip_env/lib/python3.7/site-packages/ase/parallel.py", line 233, in new_func
    return func(*args, **kwargs)
  File "/home/tks32/programs/miniconda3/envs/quip_env/lib/python3.7/site-packages/ase/io/formats.py", line 528, in _write
    io.write(filename, images, append=append, **kwargs)
  File "/home/tks32/programs/miniconda3/envs/quip_env/lib/python3.7/site-packages/ase/io/db.py", line 32, in write_db
    con = ase.db.connect(filename, serial=True, append=append, **kwargs)
  File "/home/tks32/programs/miniconda3/envs/quip_env/lib/python3.7/site-packages/ase/db/core.py", line 188, in connect
    raise ValueError('Unknown database type: ' + type)
ValueError: Unknown database type: xyz

Where from the trace I would infer that something is passed to ase incorrectly in the absence of the -f argument.

gabor1 commented 4 years ago

I think is the same as #89

stenczelt commented 3 years ago

simply "extxyz" could be the default format to use

stenczelt commented 3 years ago

especially because in ASE, format="xyz" refers to plain xyz, but file.xyz with format not given will result in extended xyz