{"id":5209,"library":"emmet-core","title":"Emmet Core","description":"Emmet Core is the foundational Python library for the Materials Project data ecosystem. It provides Pydantic models and serializers for representing diverse materials science data, including crystallographic structures, VASP calculations, and associated metadata. This library ensures data standardization and interoperability within the materials science domain. It is currently at version 0.86.3, with an active development cycle often releasing pre-release versions.","status":"active","version":"0.86.3","language":"en","source_language":"en","source_url":"https://github.com/materialsproject/emmet","tags":["materials-science","data-models","pydantic","vasp","materials-project"],"install":[{"cmd":"pip install emmet-core","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Requires Python 3.11 or higher.","package":"python","optional":false},{"reason":"Core data models are built using Pydantic V2.","package":"pydantic","optional":false},{"reason":"Used for crystallographic structures and other materials objects.","package":"pymatgen","optional":false},{"reason":"Common utilities library.","package":"monty","optional":false}],"imports":[{"symbol":"MaterialsDoc","correct":"from emmet_core.models.materials import MaterialsDoc"},{"symbol":"TaskDocument","correct":"from emmet_core.models.vasp.calculation import TaskDocument"},{"symbol":"RunType","correct":"from emmet_core.models.vasp.calculation import RunType"},{"symbol":"MPProperties","correct":"from emmet_core.mp_properties import MPProperties"}],"quickstart":{"code":"from datetime import datetime\nfrom pymatgen.core import Structure, Lattice, Species\nfrom emmet_core.models.materials import MaterialsDoc\n\n# Create a simple structure using pymatgen\nlattice = Lattice.cubic(4)\nspecies = [Species(\"Fe\"), Species(\"O\")]\ncoords = [[0, 0, 0], [0.5, 0.5, 0.5]]\nstructure = Structure(lattice, species, coords)\n\n# Create a MaterialsDoc instance\nmaterial_doc = MaterialsDoc(\n    material_id=\"mp-12345\",\n    structure=structure,\n    formula_pretty=\"FeO\",\n    last_updated=datetime.utcnow(),\n    # Many other fields exist but are optional for a basic doc\n    nsites=len(structure),\n    volume=structure.volume,\n    density=structure.density,\n    nelements=len(structure.composition.elements),\n    elements=[str(el) for el in structure.composition.elements],\n    composition=structure.composition.as_dict(),\n    chemsys=\"Fe-O\",\n    symmetry={\"space_group_number\": 225, \"point_group\": \"m-3m\"}\n)\n\nprint(f\"Created MaterialsDoc for {material_doc.formula_pretty} with ID: {material_doc.material_id}\")\nprint(f\"Structure volume: {material_doc.volume:.2f} Å^3\")","lang":"python","description":"This example demonstrates how to create a basic `MaterialsDoc` instance by first generating a `pymatgen` structure and then populating the Pydantic model with required and some optional fields. This showcases the core data modeling capabilities of `emmet-core`."},"warnings":[{"fix":"Upgrade your Python environment to 3.11 or later.","message":"Emmet-core requires Python 3.11 or newer. Attempting to install or run with older Python versions will result in dependency resolution failures or runtime errors.","severity":"breaking","affected_versions":"<0.86.0"},{"fix":"Ensure your project's dependencies are compatible with Pydantic V2, or isolate emmet-core in a separate environment if V1 is strictly required elsewhere.","message":"Emmet-core relies exclusively on Pydantic V2 for its data models. If your project uses Pydantic V1, you will encounter compatibility issues, as Pydantic V1 and V2 are not backward-compatible.","severity":"breaking","affected_versions":">=0.80.0"},{"fix":"Always review the changelog when upgrading, particularly for changes in data model fields or types, and validate existing data against new schemas.","message":"As a data modeling library for a large scientific project, emmet-core's schemas can evolve. While efforts are made for stability, schema changes may occur, especially in minor or pre-release versions, potentially breaking backward compatibility for stored data.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If you need more than just the data models, install `pip install emmet` or `pip install emmet-builder` depending on your use case.","message":"Emmet-core provides Pydantic models for data structuring. For functionality like data building, API interactions, or database integration (e.g., MongoDB), you typically need to install the broader 'emmet' library or 'emmet-builder', not just 'emmet-core'.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}