{"id":24355,"library":"pymatgen-core","title":"pymatgen-core","description":"Python Materials Genomics (pymatgen) core library for materials analysis, providing object representations for structures, molecules, and crystals. Current version 2026.4.16, released April 2026. Active development with monthly releases, compatible with Python >= 3.11. This package is a refactored subset of the original pymatgen, focusing on core data structures and basic I/O.","status":"active","version":"2026.4.16","language":"python","source_language":"en","source_url":"https://github.com/materialsproject/pymatgen-core","tags":["materials","crystallography","structure","pymatgen"],"install":[{"cmd":"pip install pymatgen-core","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Full pymatgen package may be needed for advanced features not yet migrated (e.g., some analysis tools). pymatgen-core is a subset.","package":"pymatgen","optional":true}],"imports":[{"note":"In pymatgen-core, core classes are under pymatgen.core, not top-level pymatgen.","wrong":"from pymatgen import Structure","symbol":"Structure","correct":"from pymatgen.core import Structure"},{"note":"Same as Structure; Molecule moved to pymatgen.core.","wrong":"from pymatgen import Molecule","symbol":"Molecule","correct":"from pymatgen.core import Molecule"},{"note":"Lattice is also in pymatgen.core.","wrong":"from pymatgen import Lattice","symbol":"Lattice","correct":"from pymatgen.core import Lattice"},{"note":"Element moved to pymatgen.core.","wrong":"from pymatgen import Element","symbol":"Element","correct":"from pymatgen.core import Element"}],"quickstart":{"code":"from pymatgen.core import Structure, Lattice, Element\n\n# Create a simple silicon diamond cubic structure\nlattice = Lattice.cubic(5.431)  # lattice constant in Angstrom\nspecies = [Element(\"Si\")] * 8\ncoords = [\n    [0, 0, 0],\n    [0.25, 0.25, 0.25],\n    [0.5, 0.5, 0],\n    [0.5, 0, 0.5],\n    [0, 0.5, 0.5],\n    [0.75, 0.75, 0.25],\n    [0.75, 0.25, 0.75],\n    [0.25, 0.75, 0.75]\n]\nstructure = Structure(lattice, species, coords, coords_are_cartesian=False)\nprint(structure)\nprint(f\"Volume: {structure.volume:.2f} Å³\")","lang":"python","description":"Create a silicon diamond cubic structure using pymatgen-core. Note: import from pymatgen.core, not pymatgen directly."},"warnings":[{"fix":"Install pymatgen (the full package) if you need advanced features. Use pymatgen-core only for core data structures and basic I/O. Adjust imports to use pymatgen.core subpackage.","message":"pymatgen-core is a refactored subset of pymatgen. Many modules (e.g., analysis, io.vasp, electronic_structure) are not included; they remain in the full pymatgen package. Code that imports from pymatgen.core will break if it expects all functionality of pymatgen.","severity":"breaking","affected_versions":"all versions of pymatgen-core"},{"fix":"Change 'from pymatgen import Structure' to 'from pymatgen.core import Structure'.","message":"Some classes that were previously at the top-level pymatgen (e.g., Structure, Molecule) are now inside pymatgen.core. Direct imports from pymatgen will fail with ImportError or AttributeError.","severity":"gotcha","affected_versions":">=2026.2.24"},{"fix":"Stay updated with release notes. Consider using pymatgen-core for new projects if you only need core features.","message":"The original pymatgen package may eventually be superseded by pymatgen-core. Users should monitor migration guides for future breaking changes.","severity":"deprecated","affected_versions":"pymatgen-core >=2026.2.24"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from pymatgen.core import Structure' instead.","cause":"pymatgen-core moved core classes to pymatgen.core subpackage.","error":"ImportError: cannot import name 'Structure' from 'pymatgen' (unknown location)"},{"fix":"Install pymatgen (the full package) via 'pip install pymatgen' and import from 'pymatgen.io.vasp'.","cause":"VASP I/O is not part of pymatgen-core; it's in the full pymatgen package.","error":"ModuleNotFoundError: No module named 'pymatgen.io.vasp'"},{"fix":"Check the pymatgen-core documentation for available methods. Use pymatgen (full) if the method is missing.","cause":"Some methods may not be available in pymatgen-core if they were moved to other modules.","error":"AttributeError: 'Structure' object has no attribute 'get_sorted_structure'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}