{"library":"mp-emmet","title":"Materials Project Emmet","description":"Emmet is a builder framework developed by the Materials Project to manage and process scientific data, primarily related to materials science. It provides tools to extract, transform, and load data into a standardized database schema, facilitating advanced materials discovery and analysis. The library is actively maintained with frequent updates, with the current stable version being 2024.5.17, available as 'mp-emmet' on PyPI.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install mp-emmet"],"cli":null},"imports":["from emmet.core.tasks import TaskDoc","from emmet.builders.materials.materials import MaterialsBuilder","from pymatgen.ext.matproj import MPRester"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom pymatgen.ext.matproj import MPRester\n\n# Set your Materials Project API key as an environment variable (MP_API_KEY)\n# Get your API key from https://materialsproject.org/dashboard\napi_key = os.environ.get(\"MP_API_KEY\", \"\")\n\nif not api_key:\n    print(\"Warning: MP_API_KEY environment variable not set. API calls will likely fail.\")\n    print(\"Using a placeholder API key for demonstration purposes.\")\n    api_key = \"YOUR_API_KEY_HERE_IF_NOT_SET_IN_ENV\"\n\ntry:\n    with MPRester(api_key=api_key) as mpr:\n        # Fetch the TaskDoc for a specific Materials Project task_id\n        # Example Task ID for LiCoO2 calculation\n        task_id = \"mp-149\"\n        task_doc = mpr.get_task_doc(task_id)\n\n        print(f\"\\nSuccessfully fetched TaskDoc for ID: {task_id}\")\n        print(f\"Pretty Formula: {task_doc.formula_pretty}\")\n        print(f\"Energy per atom: {task_doc.energy_per_atom:.3f} eV/atom\")\n\nexcept Exception as e:\n    print(f\"\\nAn error occurred during data retrieval: {e}\")\n    print(\"Please ensure your MP_API_KEY is correctly set and valid.\")","lang":"python","description":"This quickstart demonstrates how to fetch materials data, specifically a TaskDoc, from the Materials Project database. Emmet defines the underlying schema for these documents. The `MPRester` from `pymatgen` is the standard client for interacting with the Materials Project API, which serves Emmet-structured data. Ensure your `MP_API_KEY` environment variable is set for successful API calls.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}