[ase-users] storing bytes in ase-db?
John Kitchin
jkitchin at andrew.cmu.edu
Fri Mar 23 17:28:06 CET 2018
Hi, I was trying to store a bytestring in an ase-db like this:
```
import ase.db
from ase import Atoms, Atom
from ase.calculators.lj import LennardJones
db = ase.db.connect('test.db')
atoms = Atoms([Atom('Ar', [0, 0, 0])], cell=(10, 10, 10))
atoms.set_calculator(LennardJones())
atoms.get_potential_energy()
db.write(atoms, data={'hash': b'1'})
```
but it eads to this error
TypeError: Object of type 'bytes' is not JSON serializable.
It is not obvious to me why we shouldn't do (or be able to do) this. It
also does not work as a keyword. Does anyone know a workaround?
John
-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20180323/414e4091/attachment-0001.html>
More information about the ase-users
mailing list