import lmdb import pickle import gzip lmdb_file = '/path/to/lmdb/dir/hokusai2017.lmdb' with lmdb.open(lmdb_file, readonly=True, subdir=False) as env: with env.begin() as txn: val = pickle.loads(gzip.decompress((txn.get(b'000000984')))) pm3_val = val['pm3'] hf_val = val['hf'] dft1st_val = val['DFT_1st'] dft2nd_val = val['DFT_2nd'] for step in dft1st_val: # coords & grad is a list of dictionaries that stores the relevant information of each atom # energy is a scalar representing the energy for that conformer coords = step['coordinates'] energy = step['energy'] grad = step['gradient'] for atom in coords: # access atom's attributes element = atom['atom'] x = atom['x'] y = atom['y'] z = atom['z'] for atom in grad: # access atom's attributes element = atom['atom'] dx = atom['dx'] dy = atom['dy'] dz = atom['dz']