import os, getpass os.environ['MPDS_KEY'] = getpass.getpass() !pip install mpds_client from mpds_client import MPDSDataRetrieval, MPDSDataTypes, APIError [x for x in dir(MPDSDataTypes) if not x.startswith('__')] example_props = [ # NB these props support machine-learning data type 'isothermal bulk modulus', 'enthalpy of formation', 'heat capacity at constant pressure', 'Seebeck coefficient', 'values of electronic band gap', # NB both direct + indirect gaps 'temperature for congruent melting', 'Debye temperature', 'linear thermal expansion coefficient' ] desired_fields = { 'P':[ # *P*hysical property entries 'sample.material.entry', 'sample.material.phase', 'sample.material.chemical_elements', 'sample.material.chemical_formula' ], 'S':[ # Crystalline *S*tructure entries 'entry' 'phase', 'chemical_elements', 'chemical_formula' ], 'C':[ # Phase diagrams, i.e. *C*onstitution entries 'entry', lambda: 'MANY-PHASE', # constants are given like this (on purpose) 'chemical_elements', lambda: 'MANY-FORMULAE' ] # NB. P-S-C are interconnected by means of the distinct phases } client = MPDSDataRetrieval(dtype=MPDSDataTypes.MACHINE_LEARNING) for prop in example_props: print("*" * 100) print("Considering %s" % prop) try: for card in client.get_data({ "props": prop, # we defined our props above "classes": "transitional, superconductor", # a transitional metal atom must be present, # and a superconductor must be assigned in the original publication "aetypes": "all 7-vertex", # atomic environment type e.g. hexagonal pyramid, pentagonal bipyramid etc. "aeatoms": "X-S", # atomic environment atoms: any atom in the center, sulphur in the vertices (ligands) "years": "2010-2019" # only recent results (void for MACHINE_LEARNING, as all are 2018) }, fields=desired_fields): print("%s %s %s" % (card[0], "-".join(card[2]), card[3])) except APIError as ex: if ex.code == 1: print("No matches.") else: print("Error %s: %s" % (ex.code, ex.msg)) client.dtype = MPDSDataTypes.PEER_REVIEWED print(client.get_data({"elements": "O", "classes": "binary", "sgs": "I4/mmm"})) import random prop = random.choice(example_props) print(client.get_data({"props": prop, "elements": "O", "classes": "binary, lanthanoid, non-disordered"}))