def data_json( energy="na", typ="na", formula="na", sgp="na", name="na", ref="na", func="na", elem="na", encut="na", kpoints="na", el_tens="na", KV="na", GV="na", m_eg="na", b_eg="na", op_eg="na", mbj_eg="na", en_arr="na", realx_arr="na", imagx_arr="na", realy_arr="na", imagy_arr="na", realz_arr="na", imagz_arr="na", men_arr="na", mrealx_arr="na", mimagx_arr="na", mrealy_arr="na", mimagy_arr="na", mrealz_arr="na", mimagz_arr="na", struct="na", other="na", ): """ This is an example of how to upload jarvis data to the API Args: string key value pairs Returns: curate data at the API """ top = Element("JARVIS-DFT") child = SubElement(top, "energy-ev") child.text = str(energy) child = SubElement(top, "formula") child.text = str(formula) child = SubElement(top, "space-group") child.text = str(sgp) child = SubElement(top, "JVID") child.text = str(name) child = SubElement(top, "reference") child.text = str(ref) child = SubElement(top, "calc_type") child.text = str(typ) child = SubElement(top, "functional") child.text = str(func) child = SubElement(top, "elements") child.text = str(elem) child = SubElement(top, "encut-ev") child.text = str(encut) child = SubElement(top, "kpoints") child.text = str(kpoints) child = SubElement(top, "elastic_tensor-gpa") child.text = str(el_tens) child = SubElement(top, "kv-gpa") child.text = str(KV) child = SubElement(top, "gv-gpa") child.text = str(GV) child = SubElement(top, "scf_eg-ev") child.text = str(m_eg) child = SubElement(top, "brill_eg-ev") child.text = str(b_eg) child = SubElement(top, "optics_eg-ev") child.text = str(op_eg) child = SubElement(top, "mbj-eg_ev") child.text = str(mbj_eg) child = SubElement(top, "opt_energy_arr-ev") child.text = str(en_arr) child = SubElement(top, "realx_arr") child.text = str(realx_arr) child = SubElement(top, "imagx_arr") child.text = str(imagx_arr) child = SubElement(top, "realy_arr") child.text = str(realy_arr) child = SubElement(top, "imagy_arr") child.text = str(imagy_arr) child = SubElement(top, "realz_arr") child.text = str(realz_arr) child = SubElement(top, "imagz_arr") child.text = str(imagz_arr) child = SubElement(top, "mbj_energy_arr-ev") child.text = str(men_arr) child = SubElement(top, "mbj_realx_arr") child.text = str(mrealx_arr) child = SubElement(top, "mbj_imagx_arr") child.text = str(mimagx_arr) child = SubElement(top, "mbj_realy_arr") child.text = str(mrealy_arr) child = SubElement(top, "mbj_imagy_arr") child.text = str(mimagy_arr) child = SubElement(top, "mbj_realz_arr") child.text = str(mrealz_arr) child = SubElement(top, "mbj_imagz_arr") child.text = str(mimagz_arr) child = SubElement(top, "structure") child.text = str(struct) child = SubElement(top, "other") child.text = str(other) filename = str(name) + str(".xml") ElementTree(top).write(filename) curate(filename, filename, schema, "https://jarvis.nist.gov/", user, passd, cert=False)
def data_json(energy='na', typ='na', formula='na', sgp='na', name='na', ref='na', func='na', elem='na', encut='na', kpoints='na', el_tens='na', KV='na', GV='na', m_eg='na', b_eg='na', op_eg='na', mbj_eg='na', en_arr='na', realx_arr='na', imagx_arr='na', realy_arr='na', imagy_arr='na', realz_arr='na', imagz_arr='na', men_arr='na', mrealx_arr='na', mimagx_arr='na', mrealy_arr='na', mimagy_arr='na', mrealz_arr='na', mimagz_arr='na', struct='na', other='na'): """ This is an example of how to upload jarvis data to the API Args: string key value pairs Returns: curate data at the API """ top = Element('JARVIS-DFT') child = SubElement(top, 'energy-ev') child.text = str(energy) child = SubElement(top, 'formula') child.text = str(formula) child = SubElement(top, 'space-group') child.text = str(sgp) child = SubElement(top, 'JVID') child.text = str(name) child = SubElement(top, 'reference') child.text = str(ref) child = SubElement(top, 'calc_type') child.text = str(typ) child = SubElement(top, 'functional') child.text = str(func) child = SubElement(top, 'elements') child.text = str(elem) child = SubElement(top, 'encut-ev') child.text = str(encut) child = SubElement(top, 'kpoints') child.text = str(kpoints) child = SubElement(top, 'elastic_tensor-gpa') child.text = str(el_tens) child = SubElement(top, 'kv-gpa') child.text = str(KV) child = SubElement(top, 'gv-gpa') child.text = str(GV) child = SubElement(top, 'scf_eg-ev') child.text = str(m_eg) child = SubElement(top, 'brill_eg-ev') child.text = str(b_eg) child = SubElement(top, 'optics_eg-ev') child.text = str(op_eg) child = SubElement(top, 'mbj-eg_ev') child.text = str(mbj_eg) child = SubElement(top, 'opt_energy_arr-ev') child.text = str(en_arr) child = SubElement(top, 'realx_arr') child.text = str(realx_arr) child = SubElement(top, 'imagx_arr') child.text = str(imagx_arr) child = SubElement(top, 'realy_arr') child.text = str(realy_arr) child = SubElement(top, 'imagy_arr') child.text = str(imagy_arr) child = SubElement(top, 'realz_arr') child.text = str(realz_arr) child = SubElement(top, 'imagz_arr') child.text = str(imagz_arr) child = SubElement(top, 'mbj_energy_arr-ev') child.text = str(men_arr) child = SubElement(top, 'mbj_realx_arr') child.text = str(mrealx_arr) child = SubElement(top, 'mbj_imagx_arr') child.text = str(mimagx_arr) child = SubElement(top, 'mbj_realy_arr') child.text = str(mrealy_arr) child = SubElement(top, 'mbj_imagy_arr') child.text = str(mimagy_arr) child = SubElement(top, 'mbj_realz_arr') child.text = str(mrealz_arr) child = SubElement(top, 'mbj_imagz_arr') child.text = str(mimagz_arr) child = SubElement(top, 'structure') child.text = str(struct) child = SubElement(top, 'other') child.text = str(other) filename = str(name) + str('.xml') ElementTree(top).write(filename) curate(filename, filename, schema, 'https://jarvis.nist.gov/', user, passd, cert=False)
def data_json( energy="na", typ="na", formula="na", sgp="na", name="na", ref="na", func="na", elem="na", encut="na", kpoints="na", el_tens="na", KV="na", GV="na", m_eg="na", b_eg="na", op_eg="na", mbj_eg="na", en_arr="na", realx_arr="na", imagx_arr="na", realy_arr="na", imagy_arr="na", realz_arr="na", imagz_arr="na", men_arr="na", mrealx_arr="na", mimagx_arr="na", mrealy_arr="na", mimagy_arr="na", mrealz_arr="na", mimagz_arr="na", struct="na", other="na", curate_xml=False, ): """ Give an example of how to upload JARVIS data to the API. It converts input data to XML based on a template schema, which must be available in the JARVIS-API. After the conversion, the XML could be uploaded to the API. Any user with registered username and password can upload. If they prefer to upload using their own schema, contact the developers. See an example: https://jarvis.nist.gov/data?id=5df7f05ceaf3b300338bf83f Args: metadata with a calculation curate_xml: for debugging set it to False, and produce XML files """ top = Element("JARVIS-DFT") child = SubElement(top, "energy-ev") child.text = str(energy) child = SubElement(top, "formula") child.text = str(formula) child = SubElement(top, "space-group") child.text = str(sgp) child = SubElement(top, "JVID") child.text = str(name) child = SubElement(top, "reference") child.text = str(ref) child = SubElement(top, "calc_type") child.text = str(typ) child = SubElement(top, "functional") child.text = str(func) child = SubElement(top, "elements") child.text = str(elem) child = SubElement(top, "encut-ev") child.text = str(encut) child = SubElement(top, "kpoints") child.text = str(kpoints) child = SubElement(top, "elastic_tensor-gpa") child.text = str(el_tens) child = SubElement(top, "kv-gpa") child.text = str(KV) child = SubElement(top, "gv-gpa") child.text = str(GV) child = SubElement(top, "scf_eg-ev") child.text = str(m_eg) child = SubElement(top, "brill_eg-ev") child.text = str(b_eg) child = SubElement(top, "optics_eg-ev") child.text = str(op_eg) child = SubElement(top, "mbj-eg_ev") child.text = str(mbj_eg) child = SubElement(top, "opt_energy_arr-ev") child.text = str(en_arr) child = SubElement(top, "realx_arr") child.text = str(realx_arr) child = SubElement(top, "imagx_arr") child.text = str(imagx_arr) child = SubElement(top, "realy_arr") child.text = str(realy_arr) child = SubElement(top, "imagy_arr") child.text = str(imagy_arr) child = SubElement(top, "realz_arr") child.text = str(realz_arr) child = SubElement(top, "imagz_arr") child.text = str(imagz_arr) child = SubElement(top, "mbj_energy_arr-ev") child.text = str(men_arr) child = SubElement(top, "mbj_realx_arr") child.text = str(mrealx_arr) child = SubElement(top, "mbj_imagx_arr") child.text = str(mimagx_arr) child = SubElement(top, "mbj_realy_arr") child.text = str(mrealy_arr) child = SubElement(top, "mbj_imagy_arr") child.text = str(mimagy_arr) child = SubElement(top, "mbj_realz_arr") child.text = str(mrealz_arr) child = SubElement(top, "mbj_imagz_arr") child.text = str(mimagz_arr) child = SubElement(top, "structure") child.text = str(struct) child = SubElement(top, "other") child.text = str(other) filename = str(name) + str(".xml") ElementTree(top).write(filename) if curate_xml: curate( filename, filename, schema, "https://jarvis.nist.gov/", user, passd, cert=False, )