] mpfile.add_data_table(mpid, df_E, "hop_activation_barriers") print("add table for hop attempt frequencies for {} (HCP)".format( mpid)) columns_v = ["Hop attempt frequency, v_a [THz]" ] + ["Hop attempt frequency, v_X [THz]"] df_v = df[["Solute element name"] + columns_v] df_v.columns = ["Solute"] + ["vₐ [THz]"] + ["vₓ [THz]"] mpfile.add_data_table(mpid, df_v, "hop_attempt_frequencies") print("DONE") mpfile = MPFile() mpfile.max_contribs = 15 run(mpfile) print(mpfile) filename = f"{project}.txt" mpfile.write_file(filename=filename) mpfile = MPFile.from_file(filename) print(len(mpfile.ids)) table_names = ["D₀_Q", "hop_activation_barriers", "hop_attempt_frequencies"] for idx, (identifier, content) in enumerate(mpfile.document.items()): # doc = {'identifier': identifier, 'project': project, 'content': {}} # doc['content']['data'] = content['data'] # doc['collaborators'] = [{'name': 'Patrick Huck', 'email': '*****@*****.**'}] # r = db.contributions.insert_one(doc)
mpfile.add_structure(structure, name=project, identifier=identifier) sdct = mpfile.document[identifier]['structures'][project] sdct.pop('@module') sdct.pop('@class') if sdct['charge'] is None: sdct.pop('charge') sdct['identifier'] = identifier sdct['project'] = 'jarvis_dft' sdct['name'] = project sdct['cid'] = doc['_id'] r = db.structures.insert_one(sdct) inserted_ids.append(r.inserted_id) except Exception as ex: print(str(ex)) print(inserted_ids) r = db.contributions.update_one( {'_id': doc['_id']}, {'$set': { 'content.structures': inserted_ids }}) print(r.matched_count, r.modified_count) from mpcontribs.io.archieml.mpfile import MPFile mpfile = MPFile() mpfile.max_contribs = 3200 run(mpfile)
"project": "screening_inorganic_pv", "name": "absorption", "cid": cid, }, {"$set": table}, ) print(len(table["data"]), r.modified_count) # df = DataFrame(data=dos_data[mp_id]) # df.columns = ['E [eV]', 'DOS [eV⁻¹]'] # mpfile.add_data_table(mp_id, df, 'dos') # table = mpfile.document[mp_id]['dos'] # table.pop('@module') # table.pop('@class') # table['identifier'] = mp_id # table['project'] = 'screening_inorganic_pv' # table['name'] = 'dos' # table['cid'] = cid # r = db.tables.insert_one(table) # tids.append(r.inserted_id) # r = db.contributions.update_one(query, {'$set': {'content.tables': tids}}) from mpcontribs.io.archieml.mpfile import MPFile mpfile = MPFile() mpfile.max_contribs = 790 run(mpfile) # print(mpfile)