[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75BJ40NEHZFSTNJ2DHN48NS":3,"skill-same:01M75BJ40NEHZFSTNJ2DHN48NS":84},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":30,"ownerHtmlUrl":31,"ownerBlogUrl":6,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M75BJ40NEHZFSTNJ2DHN48NS","pymatgen",null,"Materials science toolkit. Crystal structures (CIF, POSCAR), phase diagrams, band structure, DOS, Materials Project integration, format conversion, for computational materials science.","Lord1Egypt\u002Fai-skillforge","Lord1Egypt","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99746359?v=4","01M7592YDNT0XK9WJ0T2MQVPDN","Mohamed Mounir Ali AL Keshita","01M7597M9CBBVAPX1CYE1KFTSM",2,"MIT","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fjs\u002Fskills\u002Fscientific\u002Fpymatgen\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: pymatgen\ndescription: Materials science toolkit. Crystal structures (CIF, POSCAR), phase diagrams, band structure, DOS, Materials Project integration, format conversion, for computational materials science.\nlicense: MIT license\nmetadata:\n    skill-author: Lord1Egypt\n---\n\n# Pymatgen - Python Materials Genomics\n\n## Overview\n\nPymatgen is a comprehensive Python library for materials analysis that powers the Materials Project. Create, analyze, and manipulate crystal structures and molecules, compute phase diagrams and thermodynamic properties, analyze electronic structure (band structures, DOS), generate surfaces and interfaces, and access Materials Project's database of computed materials. Supports 100+ file formats from various computational codes.\n\n## When to Use This Skill\n\nThis skill should be used when:\n- Working with crystal structures or molecular systems in materials science\n- Converting between structure file formats (CIF, POSCAR, XYZ, etc.)\n- Analyzing symmetry, space groups, or coordination environments\n- Computing phase diagrams or assessing thermodynamic stability\n- Analyzing electronic structure data (band gaps, DOS, band structures)\n- Generating surfaces, slabs, or studying interfaces\n- Accessing the Materials Project database programmatically\n- Setting up high-throughput computational workflows\n- Analyzing diffusion, magnetism, or mechanical properties\n- Working with VASP, Gaussian, Quantum ESPRESSO, or other computational codes\n\n## Quick Start Guide\n\n### Installation\n\n```bash\n# Core pymatgen\nuv pip install pymatgen\n\n# With Materials Project API access\nuv pip install pymatgen mp-api\n\n# Optional dependencies for extended functionality\nuv pip install pymatgen[analysis]  # Additional analysis tools\nuv pip install pymatgen[vis]       # Visualization tools\n```\n\n### Basic Structure Operations\n\n```python\nfrom pymatgen.core import Structure, Lattice\n\n# Read structure from file (automatic format detection)\nstruct = Structure.from_file(\"POSCAR\")\n\n# Create structure from scratch\nlattice = Lattice.cubic(3.84)\nstruct = Structure(lattice, [\"Si\", \"Si\"], [[0,0,0], [0.25,0.25,0.25]])\n\n# Write to different format\nstruct.to(filename=\"structure.cif\")\n\n# Basic properties\nprint(f\"Formula: {struct.composition.reduced_formula}\")\nprint(f\"Space group: {struct.get_space_group_info()}\")\nprint(f\"Density: {struct.density:.2f} g\u002Fcm³\")\n```\n\n### Materials Project Integration\n\n```bash\n# Set up API key\nexport MP_API_KEY=\"your_api_key_here\"\n```\n\n```python\nfrom mp_api.client import MPRester\n\nwith MPRester() as mpr:\n    # Get structure by material ID\n    struct = mpr.get_structure_by_material_id(\"mp-149\")\n\n    # Search for materials\n    materials = mpr.materials.summary.search(\n        formula=\"Fe2O3\",\n        energy_above_hull=(0, 0.05)\n    )\n```\n\n## Core Capabilities\n\n### 1. Structure Creation and Manipulation\n\nCreate structures using various methods and perform transformations.\n\n**From files:**\n```python\n# Automatic format detection\nstruct = Structure.from_file(\"structure.cif\")\nstruct = Structure.from_file(\"POSCAR\")\nmol = Molecule.from_file(\"molecule.xyz\")\n```\n\n**From scratch:**\n```python\nfrom pymatgen.core import Structure, Lattice\n\n# Using lattice parameters\nlattice = Lattice.from_parameters(a=3.84, b=3.84, c=3.84,\n                                  alpha=120, beta=90, gamma=60)\ncoords = [[0, 0, 0], [0.75, 0.5, 0.75]]\nstruct = Structure(lattice, [\"Si\", \"Si\"], coords)\n\n# From space group\nstruct = Structure.from_spacegroup(\n    \"Fm-3m\",\n    Lattice.cubic(3.5),\n    [\"Si\"],\n    [[0, 0, 0]]\n)\n```\n\n**Transformations:**\n```python\nfrom pymatgen.transformations.standard_transformations import (\n    SupercellTransformation,\n    SubstitutionTransformation,\n    PrimitiveCellTransformation\n)\n\n# Create supercell\ntrans = SupercellTransformation([[2,0,0],[0,2,0],[0,0,2]])\nsupercell = trans.apply_transformation(struct)\n\n# Substitute elements\ntrans = SubstitutionTransformation({\"Fe\": \"Mn\"})\nnew_struct = trans.apply_transformation(struct)\n\n# Get primitive cell\ntrans = PrimitiveCellTransformation()\nprimitive = trans.apply_transformation(struct)\n```\n\n**Reference:** See `references\u002Fcore_classes.md` for comprehensive documentation of Structure, Lattice, Molecule, and related classes.\n\n### 2. File Format Conversion\n\nConvert between 100+ file formats with automatic format detection.\n\n**Using convenience methods:**\n```python\n# Read any format\nstruct = Structure.from_file(\"input_file\")\n\n# Write to any format\nstruct.to(filename=\"output.cif\")\nstruct.to(filename=\"POSCAR\")\nstruct.to(filename=\"output.xyz\")\n```\n\n**Using the conversion script:**\n```bash\n# Single file conversion\npython scripts\u002Fstructure_converter.py POSCAR structure.cif\n\n# Batch conversion\npython scripts\u002Fstructure_converter.py *.cif --output-dir .\u002Fposcar_files --format poscar\n```\n\n**Reference:** See `references\u002Fio_formats.md` for detailed documentation of all supported formats and code integrations.\n\n### 3. Structure Analysis and Symmetry\n\nAnalyze structures for symmetry, coordination, and other properties.\n\n**Symmetry analysis:**\n```python\nfrom pymatgen.symmetry.analyzer import SpacegroupAnalyzer\n\nsga = SpacegroupAnalyzer(struct)\n\n# Get space group information\nprint(f\"Space group: {sga.get_space_group_symbol()}\")\nprint(f\"Number: {sga.get_space_group_number()}\")\nprint(f\"Crystal system: {sga.get_crystal_system()}\")\n\n# Get conventional\u002Fprimitive cells\nconventional = sga.get_conventional_standard_structure()\nprimitive = sga.get_primitive_standard_structure()\n```\n\n**Coordination environment:**\n```python\nfrom pymatgen.analysis.local_env import CrystalNN\n\ncnn = CrystalNN()\nneighbors = cnn.get_nn_info(struct, n=0)  # Neighbors of site 0\n\nprint(f\"Coordination number: {len(neighbors)}\")\nfor neighbor in neighbors:\n    site = struct[neighbor['site_index']]\n    print(f\"  {site.species_string} at {neighbor['weight']:.3f} Å\")\n```\n\n**Using the analysis script:**\n```bash\n# Comprehensive analysis\npython scripts\u002Fstructure_analyzer.py POSCAR --symmetry --neighbors\n\n# Export results\npython scripts\u002Fstructure_analyzer.py structure.cif --symmetry --export json\n```\n\n**Reference:** See `references\u002Fanalysis_modules.md` for detailed documentation of all analysis capabilities.\n\n### 4. Phase Diagrams and Thermodynamics\n\nConstruct phase diagrams and analyze thermodynamic stability.\n\n**Phase diagram construction:**\n```python\nfrom mp_api.client import MPRester\nfrom pymatgen.analysis.phase_diagram import PhaseDiagram, PDPlotter\n\n# Get entries from Materials Project\nwith MPRester() as mpr:\n    entries = mpr.get_entries_in_chemsys(\"Li-Fe-O\")\n\n# Build phase diagram\npd = PhaseDiagram(entries)\n\n# Check stability\nfrom pymatgen.core import Composition\ncomp = Composition(\"LiFeO2\")\n\n# Find entry for composition\nfor entry in entries:\n    if entry.composition.reduced_formula == comp.reduced_formula:\n        e_above_hull = pd.get_e_above_hull(entry)\n        print(f\"Energy above hull: {e_above_hull:.4f} eV\u002Fatom\")\n\n        if e_above_hull > 0.001:\n            # Get decomposition\n            decomp = pd.get_decomposition(comp)\n            print(\"Decomposes to:\", decomp)\n\n# Plot\nplotter = PDPlotter(pd)\nplotter.show()\n```\n\n**Using the phase diagram script:**\n```bash\n# Generate phase diagram\npython scripts\u002Fphase_diagram_generator.py Li-Fe-O --output li_fe_o.png\n\n# Analyze specific composition\npython scripts\u002Fphase_diagram_generator.py Li-Fe-O --analyze \"LiFeO2\" --show\n```\n\n**Reference:** See `references\u002Fanalysis_modules.md` (Phase Diagrams section) and `references\u002Ftransformations_workflows.md` (Workflow 2) for detailed examples.\n\n### 5. Electronic Structure Analysis\n\nAnalyze band structures, density of states, and electronic properties.\n\n**Band structure:**\n```python\nfrom pymatgen.io.vasp import Vasprun\nfrom pymatgen.electronic_structure.plotter import BSPlotter\n\n# Read from VASP calculation\nvasprun = Vasprun(\"vasprun.xml\")\nbs = vasprun.get_band_structure()\n\n# Analyze\nband_gap = bs.get_band_gap()\nprint(f\"Band gap: {band_gap['energy']:.3f} eV\")\nprint(f\"Direct: {band_gap['direct']}\")\nprint(f\"Is metal: {bs.is_metal()}\")\n\n# Plot\nplotter = BSPlotter(bs)\nplotter.save_plot(\"band_structure.png\")\n```\n\n**Density of states:**\n```python\nfrom pymatgen.electronic_structure.plotter import DosPlotter\n\ndos = vasprun.complete_dos\n\n# Get element-projected DOS\nelement_dos = dos.get_element_dos()\nfor element, element_dos_obj in element_dos.items():\n    print(f\"{element}: {element_dos_obj.get_gap():.3f} eV\")\n\n# Plot\nplotter = DosPlotter()\nplotter.add_dos(\"Total DOS\", dos)\nplotter.show()\n```\n\n**Reference:** See `references\u002Fanalysis_modules.md` (Electronic Structure section) and `references\u002Fio_formats.md` (VASP section).\n\n### 6. Surface and Interface Analysis\n\nGenerate slabs, analyze surfaces, and study interfaces.\n\n**Slab generation:**\n```python\nfrom pymatgen.core.surface import SlabGenerator\n\n# Generate slabs for specific Miller index\nslabgen = SlabGenerator(\n    struct,\n    miller_index=(1, 1, 1),\n    min_slab_size=10.0,      # Å\n    min_vacuum_size=10.0,    # Å\n    center_slab=True\n)\n\nslabs = slabgen.get_slabs()\n\n# Write slabs\nfor i, slab in enumerate(slabs):\n    slab.to(filename=f\"slab_{i}.cif\")\n```\n\n**Wulff shape construction:**\n```python\nfrom pymatgen.analysis.wulff import WulffShape\n\n# Define surface energies\nsurface_energies = {\n    (1, 0, 0): 1.0,\n    (1, 1, 0): 1.1,\n    (1, 1, 1): 0.9,\n}\n\nwulff = WulffShape(struct.lattice, surface_energies)\nprint(f\"Surface area: {wulff.surface_area:.2f} Ų\")\nprint(f\"Volume: {wulff.volume:.2f} ų\")\n\nwulff.show()\n```\n\n**Adsorption site finding:**\n```python\nfrom pymatgen.analysis.adsorption import AdsorbateSiteFinder\nfrom pymatgen.core import Molecule\n\nasf = AdsorbateSiteFinder(slab)\n\n# Find sites\nads_sites = asf.find_adsorption_sites()\nprint(f\"On-top sites: {len(ads_sites['ontop'])}\")\nprint(f\"Bridge sites: {len(ads_sites['bridge'])}\")\nprint(f\"Hollow sites: {len(ads_sites['hollow'])}\")\n\n# Add adsorbate\nadsorbate = Molecule(\"O\", [[0, 0, 0]])\nads_struct = asf.add_adsorbate(adsorbate, ads_sites[\"ontop\"][0])\n```\n\n**Reference:** See `references\u002Fanalysis_modules.md` (Surface and Interface section) and `references\u002Ftransformations_workflows.md` (Workflows 3 and 9).\n\n### 7. Materials Project Database Access\n\nProgrammatically access the Materials Project database.\n\n**Setup:**\n1. Get API key from https:\u002F\u002Fnext-gen.materialsproject.org\u002F\n2. Set environment variable: `export MP_API_KEY=\"your_key_here\"`\n\n**Search and retrieve:**\n```python\nfrom mp_api.client import MPRester\n\nwith MPRester() as mpr:\n    # Search by formula\n    materials = mpr.materials.summary.search(formula=\"Fe2O3\")\n\n    # Search by chemical system\n    materials = mpr.materials.summary.search(chemsys=\"Li-Fe-O\")\n\n    # Filter by properties\n    materials = mpr.materials.summary.search(\n        chemsys=\"Li-Fe-O\",\n        energy_above_hull=(0, 0.05),  # Stable\u002Fmetastable\n        band_gap=(1.0, 3.0)            # Semiconducting\n    )\n\n    # Get structure\n    struct = mpr.get_structure_by_material_id(\"mp-149\")\n\n    # Get band structure\n    bs = mpr.get_bandstructure_by_material_id(\"mp-149\")\n\n    # Get entries for phase diagram\n    entries = mpr.get_entries_in_chemsys(\"Li-Fe-O\")\n```\n\n**Reference:** See `references\u002Fmaterials_project_api.md` for comprehensive API documentation and examples.\n\n### 8. Computational Workflow Setup\n\nSet up calculations for various electronic structure codes.\n\n**VASP input generation:**\n```python\nfrom pymatgen.io.vasp.sets import MPRelaxSet, MPStaticSet, MPNonSCFSet\n\n# Relaxation\nrelax = MPRelaxSet(struct)\nrelax.write_input(\".\u002Frelax_calc\")\n\n# Static calculation\nstatic = MPStaticSet(struct)\nstatic.write_input(\".\u002Fstatic_calc\")\n\n# Band structure (non-self-consistent)\nnscf = MPNonSCFSet(struct, mode=\"line\")\nnscf.write_input(\".\u002Fbandstructure_calc\")\n\n# Custom parameters\ncustom = MPRelaxSet(struct, user_incar_settings={\"ENCUT\": 600})\ncustom.write_input(\".\u002Fcustom_calc\")\n```\n\n**Other codes:**\n```python\n# Gaussian\nfrom pymatgen.io.gaussian import GaussianInput\n\ngin = GaussianInput(\n    mol,\n    functional=\"B3LYP\",\n    basis_set=\"6-31G(d)\",\n    route_parameters={\"Opt\": None}\n)\ngin.write_file(\"input.gjf\")\n\n# Quantum ESPRESSO\nfrom pymatgen.io.pwscf import PWInput\n\npwin = PWInput(struct, control={\"calculation\": \"scf\"})\npwin.write_file(\"pw.in\")\n```\n\n**Reference:** See `references\u002Fio_formats.md` (Electronic Structure Code I\u002FO section) and `references\u002Ftransformations_workflows.md` for workflow examples.\n\n### 9. Advanced Analysis\n\n**Diffraction patterns:**\n```python\nfrom pymatgen.analysis.diffraction.xrd import XRDCalculator\n\nxrd = XRDCalculator()\npattern = xrd.get_pattern(struct)\n\n# Get peaks\nfor peak in pattern.hkls:\n    print(f\"2θ = {peak['2theta']:.2f}°, hkl = {peak['hkl']}\")\n\npattern.plot()\n```\n\n**Elastic properties:**\n```python\nfrom pymatgen.analysis.elasticity import ElasticTensor\n\n# From elastic tensor matrix\nelastic_tensor = ElasticTensor.from_voigt(matrix)\n\nprint(f\"Bulk modulus: {elastic_tensor.k_voigt:.1f} GPa\")\nprint(f\"Shear modulus: {elastic_tensor.g_voigt:.1f} GPa\")\nprint(f\"Young's modulus: {elastic_tensor.y_mod:.1f} GPa\")\n```\n\n**Magnetic ordering:**\n```python\nfrom pymatgen.transformations.advanced_transformations import MagOrderingTransformation\n\n# Enumerate magnetic orderings\ntrans = MagOrderingTransformation({\"Fe\": 5.0})\nmag_structs = trans.apply_transformation(struct, return_ranked_list=True)\n\n# Get lowest energy magnetic structure\nlowest_energy_struct = mag_structs[0]['structure']\n```\n\n**Reference:** See `references\u002Fanalysis_modules.md` for comprehensive analysis module documentation.\n\n## Bundled Resources\n\n### Scripts (`scripts\u002F`)\n\nExecutable Python scripts for common tasks:\n\n- **`structure_converter.py`**: Convert between structure file formats\n  - Supports batch conversion and automatic format detection\n  - Usage: `python scripts\u002Fstructure_converter.py POSCAR structure.cif`\n\n- **`structure_analyzer.py`**: Comprehensive structure analysis\n  - Symmetry, coordination, lattice parameters, distance matrix\n  - Usage: `python scripts\u002Fstructure_analyzer.py structure.cif --symmetry --neighbors`\n\n- **`phase_diagram_generator.py`**: Generate phase diagrams from Materials Project\n  - Stability analysis and thermodynamic properties\n  - Usage: `python scripts\u002Fphase_diagram_generator.py Li-Fe-O --analyze \"LiFeO2\"`\n\nAll scripts include detailed help: `python scripts\u002Fscript_name.py --help`\n\n### References (`references\u002F`)\n\nComprehensive documentation loaded into context as needed:\n\n- **`core_classes.md`**: Element, Structure, Lattice, Molecule, Composition classes\n- **`io_formats.md`**: File format support and code integration (VASP, Gaussian, etc.)\n- **`analysis_modules.md`**: Phase diagrams, surfaces, electronic structure, symmetry\n- **`materials_project_api.md`**: Complete Materials Project API guide\n- **`transformations_workflows.md`**: Transformations framework and common workflows\n\nLoad references when detailed information is needed about specific modules or workflows.\n\n## Common Workflows\n\n### High-Throughput Structure Generation\n\n```python\nfrom pymatgen.transformations.standard_transformations import SubstitutionTransformation\nfrom pymatgen.io.vasp.sets import MPRelaxSet\n\n# Generate doped structures\nbase_struct = Structure.from_file(\"POSCAR\")\ndopants = [\"Mn\", \"Co\", \"Ni\", \"Cu\"]\n\nfor dopant in dopants:\n    trans = SubstitutionTransformation({\"Fe\": dopant})\n    doped_struct = trans.apply_transformation(base_struct)\n\n    # Generate VASP inputs\n    vasp_input = MPRelaxSet(doped_struct)\n    vasp_input.write_input(f\".\u002Fcalcs\u002FFe_{dopant}\")\n```\n\n### Band Structure Calculation Workflow\n\n```python\n# 1. Relaxation\nrelax = MPRelaxSet(struct)\nrelax.write_input(\".\u002F1_relax\")\n\n# 2. Static (after relaxation)\nrelaxed = Structure.from_file(\"1_relax\u002FCONTCAR\")\nstatic = MPStaticSet(relaxed)\nstatic.write_input(\".\u002F2_static\")\n\n# 3. Band structure (non-self-consistent)\nnscf = MPNonSCFSet(relaxed, mode=\"line\")\nnscf.write_input(\".\u002F3_bandstructure\")\n\n# 4. Analysis\nfrom pymatgen.io.vasp import Vasprun\nvasprun = Vasprun(\"3_bandstructure\u002Fvasprun.xml\")\nbs = vasprun.get_band_structure()\nbs.get_band_gap()\n```\n\n### Surface Energy Calculation\n\n```python\n# 1. Get bulk energy\nbulk_vasprun = Vasprun(\"bulk\u002Fvasprun.xml\")\nbulk_E_per_atom = bulk_vasprun.final_energy \u002F len(bulk)\n\n# 2. Generate and calculate slabs\nslabgen = SlabGenerator(bulk, (1,1,1), 10, 15)\nslab = slabgen.get_slabs()[0]\n\nMPRelaxSet(slab).write_input(\".\u002Fslab_calc\")\n\n# 3. Calculate surface energy (after calculation)\nslab_vasprun = Vasprun(\"slab_calc\u002Fvasprun.xml\")\nE_surf = (slab_vasprun.final_energy - len(slab) * bulk_E_per_atom) \u002F (2 * slab.surface_area)\nE_surf *= 16.021766  # Convert eV\u002FŲ to J\u002Fm²\n```\n\n**More workflows:** See `references\u002Ftransformations_workflows.md` for 10 detailed workflow examples.\n\n## Best Practices\n\n### Structure Handling\n\n1. **Use automatic format detection**: `Structure.from_file()` handles most formats\n2. **Prefer immutable structures**: Use `IStructure` when structure shouldn't change\n3. **Check symmetry**: Use `SpacegroupAnalyzer` to reduce to primitive cell\n4. **Validate structures**: Check for overlapping atoms or unreasonable bond lengths\n\n### File I\u002FO\n\n1. **Use convenience methods**: `from_file()` and `to()` are preferred\n2. **Specify formats explicitly**: When automatic detection fails\n3. **Handle exceptions**: Wrap file I\u002FO in try-except blocks\n4. **Use serialization**: `as_dict()`\u002F`from_dict()` for version-safe storage\n\n### Materials Project API\n\n1. **Use context manager**: Always use `with MPRester() as mpr:`\n2. **Batch queries**: Request multiple items at once\n3. **Cache results**: Save frequently used data locally\n4. **Filter effectively**: Use property filters to reduce data transfer\n\n### Computational Workflows\n\n1. **Use input sets**: Prefer `MPRelaxSet`, `MPStaticSet` over manual INCAR\n2. **Check convergence**: Always verify calculations converged\n3. **Track transformations**: Use `TransformedStructure` for provenance\n4. **Organize calculations**: Use clear directory structures\n\n### Performance\n\n1. **Reduce symmetry**: Use primitive cells when possible\n2. **Limit neighbor searches**: Specify reasonable cutoff radii\n3. **Use appropriate methods**: Different analysis tools have different speed\u002Faccuracy tradeoffs\n4. **Parallelize when possible**: Many operations can be parallelized\n\n## Units and Conventions\n\nPymatgen uses atomic units throughout:\n- **Lengths**: Angstroms (Å)\n- **Energies**: Electronvolts (eV)\n- **Angles**: Degrees (°)\n- **Magnetic moments**: Bohr magnetons (μB)\n- **Time**: Femtoseconds (fs)\n\nConvert units using `pymatgen.core.units` when needed.\n\n## Integration with Other Tools\n\nPymatgen integrates seamlessly with:\n- **ASE** (Atomic Simulation Environment)\n- **Phonopy** (phonon calculations)\n- **BoltzTraP** (transport properties)\n- **Atomate\u002FFireworks** (workflow management)\n- **AiiDA** (provenance tracking)\n- **Zeo++** (pore analysis)\n- **OpenBabel** (molecule conversion)\n\n## Troubleshooting\n\n**Import errors**: Install missing dependencies\n```bash\nuv pip install pymatgen[analysis,vis]\n```\n\n**API key not found**: Set MP_API_KEY environment variable\n```bash\nexport MP_API_KEY=\"your_key_here\"\n```\n\n**Structure read failures**: Check file format and syntax\n```python\n# Try explicit format specification\nstruct = Structure.from_file(\"file.txt\", fmt=\"cif\")\n```\n\n**Symmetry analysis fails**: Structure may have numerical precision issues\n```python\n# Increase tolerance\nfrom pymatgen.symmetry.analyzer import SpacegroupAnalyzer\nsga = SpacegroupAnalyzer(struct, symprec=0.1)\n```\n\n## Additional Resources\n\n- **Documentation**: https:\u002F\u002Fpymatgen.org\u002F\n- **Materials Project**: https:\u002F\u002Fmaterialsproject.org\u002F\n- **GitHub**: https:\u002F\u002Fgithub.com\u002Fmaterialsproject\u002Fpymatgen\n- **Forum**: https:\u002F\u002Fmatsci.org\u002F\n- **Example notebooks**: https:\u002F\u002Fmatgenb.materialsvirtuallab.org\u002F\n\n## Version Notes\n\nThis skill is designed for pymatgen 2024.x and later. For the Materials Project API, use the `mp-api` package (separate from legacy `pymatgen.ext.matproj`).\n\nRequirements:\n- Python 3.10 or higher\n- pymatgen >= 2023.x\n- mp-api (for Materials Project access)\n\n","# Pymatgen - Python Materials Genomics\n\n## Overview\n\nPymatgen is a comprehensive Python library for materials analysis that powers the Materials Project. Create, analyze, and manipulate crystal structures and molecules, compute phase diagrams and thermodynamic properties, analyze electronic structure (band structures, DOS), generate surfaces and interfaces, and access Materials Project's database of computed materials. Supports 100+ file formats from various computational codes.\n\n## When to Use This Skill\n\nThis skill should be used when:\n- Working with crystal structures or molecular systems in materials science\n- Converting between structure file formats (CIF, POSCAR, XYZ, etc.)\n- Analyzing symmetry, space groups, or coordination environments\n- Computing phase diagrams or assessing thermodynamic stability\n- Analyzing electronic structure data (band gaps, DOS, band structures)\n- Generating surfaces, slabs, or studying interfaces\n- Accessing the Materials Project database programmatically\n- Setting up high-throughput computational workflows\n- Analyzing diffusion, magnetism, or mechanical properties\n- Working with VASP, Gaussian, Quantum ESPRESSO, or other computational codes\n\n## Quick Start Guide\n\n### Installation\n\n```bash\n# Core pymatgen\nuv pip install pymatgen\n\n# With Materials Project API access\nuv pip install pymatgen mp-api\n\n# Optional dependencies for extended functionality\nuv pip install pymatgen[analysis]  # Additional analysis tools\nuv pip install pymatgen[vis]       # Visualization tools\n```\n\n### Basic Structure Operations\n\n```python\nfrom pymatgen.core import Structure, Lattice\n\n# Read structure from file (automatic format detection)\nstruct = Structure.from_file(\"POSCAR\")\n\n# Create structure from scratch\nlattice = Lattice.cubic(3.84)\nstruct = Structure(lattice, [\"Si\", \"Si\"], [[0,0,0], [0.25,0.25,0.25]])\n\n# Write to different format\nstruct.to(filename=\"structure.cif\")\n\n# Basic properties\nprint(f\"Formula: {struct.composition.reduced_formula}\")\nprint(f\"Space group: {struct.get_space_group_info()}\")\nprint(f\"Density: {struct.density:.2f} g\u002Fcm³\")\n```\n\n### Materials Project Integration\n\n```bash\n# Set up API key\nexport MP_API_KEY=\"your_api_key_here\"\n```\n\n```python\nfrom mp_api.client import MPRester\n\nwith MPRester() as mpr:\n    # Get structure by material ID\n    struct = mpr.get_structure_by_material_id(\"mp-149\")\n\n    # Search for materials\n    materials = mpr.materials.summary.search(\n        formula=\"Fe2O3\",\n        energy_above_hull=(0, 0.05)\n    )\n```\n\n## Core Capabilities\n\n### 1. Structure Creation and Manipulation\n\nCreate structures using various methods and perform transformations.\n\n**From files:**\n```python\n# Automatic format detection\nstruct = Structure.from_file(\"structure.cif\")\nstruct = Structure.from_file(\"POSCAR\")\nmol = Molecule.from_file(\"molecule.xyz\")\n```\n\n**From scratch:**\n```python\nfrom pymatgen.core import Structure, Lattice\n\n# Using lattice parameters\nlattice = Lattice.from_parameters(a=3.84, b=3.84, c=3.84,\n                                  alpha=120, beta=90, gamma=60)\ncoords = [[0, 0, 0], [0.75, 0.5, 0.75]]\nstruct = Structure(lattice, [\"Si\", \"Si\"], coords)\n\n# From space group\nstruct = Structure.from_spacegroup(\n    \"Fm-3m\",\n    Lattice.cubic(3.5),\n    [\"Si\"],\n    [[0, 0, 0]]\n)\n```\n\n**Transformations:**\n```python\nfrom pymatgen.transformations.standard_transformations import (\n    SupercellTransformation,\n    SubstitutionTransformation,\n    PrimitiveCellTransformation\n)\n\n# Create supercell\ntrans = SupercellTransformation([[2,0,0],[0,2,0],[0,0,2]])\nsupercell = trans.apply_transformation(struct)\n\n# Substitute elements\ntrans = SubstitutionTransformation({\"Fe\": \"Mn\"})\nnew_struct = trans.apply_transformation(struct)\n\n# Get primitive cell\ntrans = PrimitiveCellTransformation()\nprimitive = trans.apply_transformation(struct)\n```\n\n**Reference:** See `references\u002Fcore_classes.md` for comprehensive documentation of Structure, Lattice, Molecule, and related classes.\n\n### 2. File Format Conversion\n\nConvert between 100+ file formats with automatic format detection.\n\n**Using convenience methods:**\n```python\n# Read any format\nstruct = Structure.from_file(\"input_file\")\n\n# Write to any format\nstruct.to(filename=\"output.cif\")\nstruct.to(filename=\"POSCAR\")\nstruct.to(filename=\"output.xyz\")\n```\n\n**Using the conversion script:**\n```bash\n# Single file conversion\npython scripts\u002Fstructure_converter.py POSCAR structure.cif\n\n# Batch conversion\npython scripts\u002Fstructure_converter.py *.cif --output-dir .\u002Fposcar_files --format poscar\n```\n\n**Reference:** See `references\u002Fio_formats.md` for detailed documentation of all supported formats and code integrations.\n\n### 3. Structure Analysis and Symmetry\n\nAnalyze structures for symmetry, coordination, and other properties.\n\n**Symmetry analysis:**\n```python\nfrom pymatgen.symmetry.analyzer import SpacegroupAnalyzer\n\nsga = SpacegroupAnalyzer(struct)\n\n# Get space group information\nprint(f\"Space group: {sga.get_space_group_symbol()}\")\nprint(f\"Number: {sga.get_space_group_number()}\")\nprint(f\"Crystal system: {sga.get_crystal_system()}\")\n\n# Get conventional\u002Fprimitive cells\nconventional = sga.get_conventional_standard_structure()\nprimitive = sga.get_primitive_standard_structure()\n```\n\n**Coordination environment:**\n```python\nfrom pymatgen.analysis.local_env import CrystalNN\n\ncnn = CrystalNN()\nneighbors = cnn.get_nn_info(struct, n=0)  # Neighbors of site 0\n\nprint(f\"Coordination number: {len(neighbors)}\")\nfor neighbor in neighbors:\n    site = struct[neighbor['site_index']]\n    print(f\"  {site.species_string} at {neighbor['weight']:.3f} Å\")\n```\n\n**Using the analysis script:**\n```bash\n# Comprehensive analysis\npython scripts\u002Fstructure_analyzer.py POSCAR --symmetry --neighbors\n\n# Export results\npython scripts\u002Fstructure_analyzer.py structure.cif --symmetry --export json\n```\n\n**Reference:** See `references\u002Fanalysis_modules.md` for detailed documentation of all analysis capabilities.\n\n### 4. Phase Diagrams and Thermodynamics\n\nConstruct phase diagrams and analyze thermodynamic stability.\n\n**Phase diagram construction:**\n```python\nfrom mp_api.client import MPRester\nfrom pymatgen.analysis.phase_diagram import PhaseDiagram, PDPlotter\n\n# Get entries from Materials Project\nwith MPRester() as mpr:\n    entries = mpr.get_entries_in_chemsys(\"Li-Fe-O\")\n\n# Build phase diagram\npd = PhaseDiagram(entries)\n\n# Check stability\nfrom pymatgen.core import Composition\ncomp = Composition(\"LiFeO2\")\n\n# Find entry for composition\nfor entry in entries:\n    if entry.composition.reduced_formula == comp.reduced_formula:\n        e_above_hull = pd.get_e_above_hull(entry)\n        print(f\"Energy above hull: {e_above_hull:.4f} eV\u002Fatom\")\n\n        if e_above_hull > 0.001:\n            # Get decomposition\n            decomp = pd.get_decomposition(comp)\n            print(\"Decomposes to:\", decomp)\n\n# Plot\nplotter = PDPlotter(pd)\nplotter.show()\n```\n\n**Using the phase diagram script:**\n```bash\n# Generate phase diagram\npython scripts\u002Fphase_diagram_generator.py Li-Fe-O --output li_fe_o.png\n\n# Analyze specific composition\npython scripts\u002Fphase_diagram_generator.py Li-Fe-O --analyze \"LiFeO2\" --show\n```\n\n**Reference:** See `references\u002Fanalysis_modules.md` (Phase Diagrams section) and `references\u002Ftransformations_workflows.md` (Workflow 2) for detailed examples.\n\n### 5. Electronic Structure Analysis\n\nAnalyze band structures, density of states, and electronic properties.\n\n**Band structure:**\n```python\nfrom pymatgen.io.vasp import Vasprun\nfrom pymatgen.electronic_structure.plotter import BSPlotter\n\n# Read from VASP calculation\nvasprun = Vasprun(\"vasprun.xml\")\nbs = vasprun.get_band_structure()\n\n# Analyze\nband_gap = bs.get_band_gap()\nprint(f\"Band gap: {band_gap['energy']:.3f} eV\")\nprint(f\"Direct: {band_gap['direct']}\")\nprint(f\"Is metal: {bs.is_metal()}\")\n\n# Plot\nplotter = BSPlotter(bs)\nplotter.save_plot(\"band_structure.png\")\n```\n\n**Density of states:**\n```python\nfrom pymatgen.electronic_structure.plotter import DosPlotter\n\ndos = vasprun.complete_dos\n\n# Get element-projected DOS\nelement_dos = dos.get_element_dos()\nfor element, element_dos_obj in element_dos.items():\n    print(f\"{element}: {element_dos_obj.get_gap():.3f} eV\")\n\n# Plot\nplotter = DosPlotter()\nplotter.add_dos(\"Total DOS\", dos)\nplotter.show()\n```\n\n**Reference:** See `references\u002Fanalysis_modules.md` (Electronic Structure section) and `references\u002Fio_formats.md` (VASP section).\n\n### 6. Surface and Interface Analysis\n\nGenerate slabs, analyze surfaces, and study interfaces.\n\n**Slab generation:**\n```python\nfrom pymatgen.core.surface import SlabGenerator\n\n# Generate slabs for specific Miller index\nslabgen = SlabGenerator(\n    struct,\n    miller_index=(1, 1, 1),\n    min_slab_size=10.0,      # Å\n    min_vacuum_size=10.0,    # Å\n    center_slab=True\n)\n\nslabs = slabgen.get_slabs()\n\n# Write slabs\nfor i, slab in enumerate(slabs):\n    slab.to(filename=f\"slab_{i}.cif\")\n```\n\n**Wulff shape construction:**\n```python\nfrom pymatgen.analysis.wulff import WulffShape\n\n# Define surface energies\nsurface_energies = {\n    (1, 0, 0): 1.0,\n    (1, 1, 0): 1.1,\n    (1, 1, 1): 0.9,\n}\n\nwulff = WulffShape(struct.lattice, surface_energies)\nprint(f\"Surface area: {wulff.surface_area:.2f} Ų\")\nprint(f\"Volume: {wulff.volume:.2f} ų\")\n\nwulff.show()\n```\n\n**Adsorption site finding:**\n```python\nfrom pymatgen.analysis.adsorption import AdsorbateSiteFinder\nfrom pymatgen.core import Molecule\n\nasf = AdsorbateSiteFinder(slab)\n\n# Find sites\nads_sites = asf.find_adsorption_sites()\nprint(f\"On-top sites: {len(ads_sites['ontop'])}\")\nprint(f\"Bridge sites: {len(ads_sites['bridge'])}\")\nprint(f\"Hollow sites: {len(ads_sites['hollow'])}\")\n\n# Add adsorbate\nadsorbate = Molecule(\"O\", [[0, 0, 0]])\nads_struct = asf.add_adsorbate(adsorbate, ads_sites[\"ontop\"][0])\n```\n\n**Reference:** See `references\u002Fanalysis_modules.md` (Surface and Interface section) and `references\u002Ftransformations_workflows.md` (Workflows 3 and 9).\n\n### 7. Materials Project Database Access\n\nProgrammatically access the Materials Project database.\n\n**Setup:**\n1. Get API key from https:\u002F\u002Fnext-gen.materialsproject.org\u002F\n2. Set environment variable: `export MP_API_KEY=\"your_key_here\"`\n\n**Search and retrieve:**\n```python\nfrom mp_api.client import MPRester\n\nwith MPRester() as mpr:\n    # Search by formula\n    materials = mpr.materials.summary.search(formula=\"Fe2O3\")\n\n    # Search by chemical system\n    materials = mpr.materials.summary.search(chemsys=\"Li-Fe-O\")\n\n    # Filter by properties\n    materials = mpr.materials.summary.search(\n        chemsys=\"Li-Fe-O\",\n        energy_above_hull=(0, 0.05),  # Stable\u002Fmetastable\n        band_gap=(1.0, 3.0)            # Semiconducting\n    )\n\n    # Get structure\n    struct = mpr.get_structure_by_material_id(\"mp-149\")\n\n    # Get band structure\n    bs = mpr.get_bandstructure_by_material_id(\"mp-149\")\n\n    # Get entries for phase diagram\n    entries = mpr.get_entries_in_chemsys(\"Li-Fe-O\")\n```\n\n**Reference:** See `references\u002Fmaterials_project_api.md` for comprehensive API documentation and examples.\n\n### 8. Computational Workflow Setup\n\nSet up calculations for various electronic structure codes.\n\n**VASP input generation:**\n```python\nfrom pymatgen.io.vasp.sets import MPRelaxSet, MPStaticSet, MPNonSCFSet\n\n# Relaxation\nrelax = MPRelaxSet(struct)\nrelax.write_input(\".\u002Frelax_calc\")\n\n# Static calculation\nstatic = MPStaticSet(struct)\nstatic.write_input(\".\u002Fstatic_calc\")\n\n# Band structure (non-self-consistent)\nnscf = MPNonSCFSet(struct, mode=\"line\")\nnscf.write_input(\".\u002Fbandstructure_calc\")\n\n# Custom parameters\ncustom = MPRelaxSet(struct, user_incar_settings={\"ENCUT\": 600})\ncustom.write_input(\".\u002Fcustom_calc\")\n```\n\n**Other codes:**\n```python\n# Gaussian\nfrom pymatgen.io.gaussian import GaussianInput\n\ngin = GaussianInput(\n    mol,\n    functional=\"B3LYP\",\n    basis_set=\"6-31G(d)\",\n    route_parameters={\"Opt\": None}\n)\ngin.write_file(\"input.gjf\")\n\n# Quantum ESPRESSO\nfrom pymatgen.io.pwscf import PWInput\n\npwin = PWInput(struct, control={\"calculation\": \"scf\"})\npwin.write_file(\"pw.in\")\n```\n\n**Reference:** See `references\u002Fio_formats.md` (Electronic Structure Code I\u002FO section) and `references\u002Ftransformations_workflows.md` for workflow examples.\n\n### 9. Advanced Analysis\n\n**Diffraction patterns:**\n```python\nfrom pymatgen.analysis.diffraction.xrd import XRDCalculator\n\nxrd = XRDCalculator()\npattern = xrd.get_pattern(struct)\n\n# Get peaks\nfor peak in pattern.hkls:\n    print(f\"2θ = {peak['2theta']:.2f}°, hkl = {peak['hkl']}\")\n\npattern.plot()\n```\n\n**Elastic properties:**\n```python\nfrom pymatgen.analysis.elasticity import ElasticTensor\n\n# From elastic tensor matrix\nelastic_tensor = ElasticTensor.from_voigt(matrix)\n\nprint(f\"Bulk modulus: {elastic_tensor.k_voigt:.1f} GPa\")\nprint(f\"Shear modulus: {elastic_tensor.g_voigt:.1f} GPa\")\nprint(f\"Young's modulus: {elastic_tensor.y_mod:.1f} GPa\")\n```\n\n**Magnetic ordering:**\n```python\nfrom pymatgen.transformations.advanced_transformations import MagOrderingTransformation\n\n# Enumerate magnetic orderings\ntrans = MagOrderingTransformation({\"Fe\": 5.0})\nmag_structs = trans.apply_transformation(struct, return_ranked_list=True)\n\n# Get lowest energy magnetic structure\nlowest_energy_struct = mag_structs[0]['structure']\n```\n\n**Reference:** See `references\u002Fanalysis_modules.md` for comprehensive analysis module documentation.\n\n## Bundled Resources\n\n### Scripts (`scripts\u002F`)\n\nExecutable Python scripts for common tasks:\n\n- **`structure_converter.py`**: Convert between structure file formats\n  - Supports batch conversion and automatic format detection\n  - Usage: `python scripts\u002Fstructure_converter.py POSCAR structure.cif`\n\n- **`structure_analyzer.py`**: Comprehensive structure analysis\n  - Symmetry, coordination, lattice parameters, distance matrix\n  - Usage: `python scripts\u002Fstructure_analyzer.py structure.cif --symmetry --neighbors`\n\n- **`phase_diagram_generator.py`**: Generate phase diagrams from Materials Project\n  - Stability analysis and thermodynamic properties\n  - Usage: `python scripts\u002Fphase_diagram_generator.py Li-Fe-O --analyze \"LiFeO2\"`\n\nAll scripts include detailed help: `python scripts\u002Fscript_name.py --help`\n\n### References (`references\u002F`)\n\nComprehensive documentation loaded into context as needed:\n\n- **`core_classes.md`**: Element, Structure, Lattice, Molecule, Composition classes\n- **`io_formats.md`**: File format support and code integration (VASP, Gaussian, etc.)\n- **`analysis_modules.md`**: Phase diagrams, surfaces, electronic structure, symmetry\n- **`materials_project_api.md`**: Complete Materials Project API guide\n- **`transformations_workflows.md`**: Transformations framework and common workflows\n\nLoad references when detailed information is needed about specific modules or workflows.\n\n## Common Workflows\n\n### High-Throughput Structure Generation\n\n```python\nfrom pymatgen.transformations.standard_transformations import SubstitutionTransformation\nfrom pymatgen.io.vasp.sets import MPRelaxSet\n\n# Generate doped structures\nbase_struct = Structure.from_file(\"POSCAR\")\ndopants = [\"Mn\", \"Co\", \"Ni\", \"Cu\"]\n\nfor dopant in dopants:\n    trans = SubstitutionTransformation({\"Fe\": dopant})\n    doped_struct = trans.apply_transformation(base_struct)\n\n    # Generate VASP inputs\n    vasp_input = MPRelaxSet(doped_struct)\n    vasp_input.write_input(f\".\u002Fcalcs\u002FFe_{dopant}\")\n```\n\n### Band Structure Calculation Workflow\n\n```python\n# 1. Relaxation\nrelax = MPRelaxSet(struct)\nrelax.write_input(\".\u002F1_relax\")\n\n# 2. Static (after relaxation)\nrelaxed = Structure.from_file(\"1_relax\u002FCONTCAR\")\nstatic = MPStaticSet(relaxed)\nstatic.write_input(\".\u002F2_static\")\n\n# 3. Band structure (non-self-consistent)\nnscf = MPNonSCFSet(relaxed, mode=\"line\")\nnscf.write_input(\".\u002F3_bandstructure\")\n\n# 4. Analysis\nfrom pymatgen.io.vasp import Vasprun\nvasprun = Vasprun(\"3_bandstructure\u002Fvasprun.xml\")\nbs = vasprun.get_band_structure()\nbs.get_band_gap()\n```\n\n### Surface Energy Calculation\n\n```python\n# 1. Get bulk energy\nbulk_vasprun = Vasprun(\"bulk\u002Fvasprun.xml\")\nbulk_E_per_atom = bulk_vasprun.final_energy \u002F len(bulk)\n\n# 2. Generate and calculate slabs\nslabgen = SlabGenerator(bulk, (1,1,1), 10, 15)\nslab = slabgen.get_slabs()[0]\n\nMPRelaxSet(slab).write_input(\".\u002Fslab_calc\")\n\n# 3. Calculate surface energy (after calculation)\nslab_vasprun = Vasprun(\"slab_calc\u002Fvasprun.xml\")\nE_surf = (slab_vasprun.final_energy - len(slab) * bulk_E_per_atom) \u002F (2 * slab.surface_area)\nE_surf *= 16.021766  # Convert eV\u002FŲ to J\u002Fm²\n```\n\n**More workflows:** See `references\u002Ftransformations_workflows.md` for 10 detailed workflow examples.\n\n## Best Practices\n\n### Structure Handling\n\n1. **Use automatic format detection**: `Structure.from_file()` handles most formats\n2. **Prefer immutable structures**: Use `IStructure` when structure shouldn't change\n3. **Check symmetry**: Use `SpacegroupAnalyzer` to reduce to primitive cell\n4. **Validate structures**: Check for overlapping atoms or unreasonable bond lengths\n\n### File I\u002FO\n\n1. **Use convenience methods**: `from_file()` and `to()` are preferred\n2. **Specify formats explicitly**: When automatic detection fails\n3. **Handle exceptions**: Wrap file I\u002FO in try-except blocks\n4. **Use serialization**: `as_dict()`\u002F`from_dict()` for version-safe storage\n\n### Materials Project API\n\n1. **Use context manager**: Always use `with MPRester() as mpr:`\n2. **Batch queries**: Request multiple items at once\n3. **Cache results**: Save frequently used data locally\n4. **Filter effectively**: Use property filters to reduce data transfer\n\n### Computational Workflows\n\n1. **Use input sets**: Prefer `MPRelaxSet`, `MPStaticSet` over manual INCAR\n2. **Check convergence**: Always verify calculations converged\n3. **Track transformations**: Use `TransformedStructure` for provenance\n4. **Organize calculations**: Use clear directory structures\n\n### Performance\n\n1. **Reduce symmetry**: Use primitive cells when possible\n2. **Limit neighbor searches**: Specify reasonable cutoff radii\n3. **Use appropriate methods**: Different analysis tools have different speed\u002Faccuracy tradeoffs\n4. **Parallelize when possible**: Many operations can be parallelized\n\n## Units and Conventions\n\nPymatgen uses atomic units throughout:\n- **Lengths**: Angstroms (Å)\n- **Energies**: Electronvolts (eV)\n- **Angles**: Degrees (°)\n- **Magnetic moments**: Bohr magnetons (μB)\n- **Time**: Femtoseconds (fs)\n\nConvert units using `pymatgen.core.units` when needed.\n\n## Integration with Other Tools\n\nPymatgen integrates seamlessly with:\n- **ASE** (Atomic Simulation Environment)\n- **Phonopy** (phonon calculations)\n- **BoltzTraP** (transport properties)\n- **Atomate\u002FFireworks** (workflow management)\n- **AiiDA** (provenance tracking)\n- **Zeo++** (pore analysis)\n- **OpenBabel** (molecule conversion)\n\n## Troubleshooting\n\n**Import errors**: Install missing dependencies\n```bash\nuv pip install pymatgen[analysis,vis]\n```\n\n**API key not found**: Set MP_API_KEY environment variable\n```bash\nexport MP_API_KEY=\"your_key_here\"\n```\n\n**Structure read failures**: Check file format and syntax\n```python\n# Try explicit format specification\nstruct = Structure.from_file(\"file.txt\", fmt=\"cif\")\n```\n\n**Symmetry analysis fails**: Structure may have numerical precision issues\n```python\n# Increase tolerance\nfrom pymatgen.symmetry.analyzer import SpacegroupAnalyzer\nsga = SpacegroupAnalyzer(struct, symprec=0.1)\n```\n\n## Additional Resources\n\n- **Documentation**: https:\u002F\u002Fpymatgen.org\u002F\n- **Materials Project**: https:\u002F\u002Fmaterialsproject.org\u002F\n- **GitHub**: https:\u002F\u002Fgithub.com\u002Fmaterialsproject\u002Fpymatgen\n- **Forum**: https:\u002F\u002Fmatsci.org\u002F\n- **Example notebooks**: https:\u002F\u002Fmatgenb.materialsvirtuallab.org\u002F\n\n## Version Notes\n\nThis skill is designed for pymatgen 2024.x and later. For the Materials Project API, use the `mp-api` package (separate from legacy `pymatgen.ext.matproj`).\n\nRequirements:\n- Python 3.10 or higher\n- pymatgen >= 2023.x\n- mp-api (for Materials Project access)\n\n",{"name":5,"license":24,"metadata":25,"description":7},"MIT license",{"skill-author":9},"main","3f88e1b76af67701a6405069a542e21a997d2868","js\u002Fskills\u002Fscientific\u002Fpymatgen",0,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge","https:\u002F\u002Fgithub.com\u002FLord1Egypt","Unbreakable. Unstoppable. Unmatched⚡.\r\n Speaker of machine tongues 🤖  | World-builder of decentralized dreams 🌐 | Defender of the digital realm🛡️.","2026-06-05 10:16:24",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add Lord1Egypt\u002Fai-skillforge --skill pymatgen",{"tool":40,"command":41},"bunx","bunx skills add Lord1Egypt\u002Fai-skillforge --skill pymatgen",{"tool":43,"command":44},"pnpm","pnpm dlx skills add Lord1Egypt\u002Fai-skillforge --skill pymatgen","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fjs\u002Fskills\u002Fscientific\u002Fpymatgen\u002FSKILL.md",true,[48,54,58,62,66,70,76,80],{"path":49,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":52,"sourceHtmlUrl":53},"references\u002Fanalysis_modules.md","REFERENCE","参考文档",12942,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fjs\u002Fskills\u002Fscientific\u002Fpymatgen\u002Freferences\u002Fanalysis_modules.md",{"path":55,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":56,"sourceHtmlUrl":57},"references\u002Fcore_classes.md",9445,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fjs\u002Fskills\u002Fscientific\u002Fpymatgen\u002Freferences\u002Fcore_classes.md",{"path":59,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":60,"sourceHtmlUrl":61},"references\u002Fio_formats.md",10518,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fjs\u002Fskills\u002Fscientific\u002Fpymatgen\u002Freferences\u002Fio_formats.md",{"path":63,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":64,"sourceHtmlUrl":65},"references\u002Fmaterials_project_api.md",12770,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fjs\u002Fskills\u002Fscientific\u002Fpymatgen\u002Freferences\u002Fmaterials_project_api.md",{"path":67,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":68,"sourceHtmlUrl":69},"references\u002Ftransformations_workflows.md",16805,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fjs\u002Fskills\u002Fscientific\u002Fpymatgen\u002Freferences\u002Ftransformations_workflows.md",{"path":71,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":74,"sourceHtmlUrl":75},"scripts\u002Fphase_diagram_generator.py","SCRIPT","脚本",7353,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fjs\u002Fskills\u002Fscientific\u002Fpymatgen\u002Fscripts\u002Fphase_diagram_generator.py",{"path":77,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":78,"sourceHtmlUrl":79},"scripts\u002Fstructure_analyzer.py",8452,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fjs\u002Fskills\u002Fscientific\u002Fpymatgen\u002Fscripts\u002Fstructure_analyzer.py",{"path":81,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":82,"sourceHtmlUrl":83},"scripts\u002Fstructure_converter.py",5179,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fjs\u002Fskills\u002Fscientific\u002Fpymatgen\u002Fscripts\u002Fstructure_converter.py",[85,92,99,106,113,120],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M75GWTHWA52GYQKS347FF6CD","zarr-python","Chunked N-D arrays for cloud storage. Compressed arrays, parallel I\u002FO, S3\u002FGCS integration, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fscientific\u002Fzarr-python\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M75GW9FBP9NAFBSNVJ23RHSX","what-if-oracle","Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like \"what if...\", \"what would happen if...\", \"what are the possibilities\", \"explore scenarios\", \"scenario analysis\", \"possibility space\", \"what could go wrong\", \"best case \u002F worst case\", \"risk analysis\", \"contingency planning\", \"strategic options\", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fscientific\u002Fwhat-if-oracle\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":19},"01M75GW351MZZQ1V7207PDCX5D","venue-templates","Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fscientific\u002Fvenue-templates\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":19},"01M75GVYGMAZDV2NHWSV6PP6TK","vaex","Use this skill for processing and analyzing large tabular datasets (billions of rows) that exceed available RAM. Vaex excels at out-of-core DataFrame operations, lazy evaluation, fast aggregations, efficient visualization of big data, and machine learning on large datasets. Apply when users need to work with large CSV\u002FHDF5\u002FArrow\u002FParquet files, perform fast statistics on massive datasets, create visualizations of big data, or build ML pipelines that do not fit in memory.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fscientific\u002Fvaex\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":19},"01M75GVS0ADH3DZ3QB564EVYC9","usfiscaldata","Query the U.S. Treasury Fiscal Data API for federal financial data including national debt, government spending, revenue, interest rates, exchange rates, and savings bonds. Access 54 datasets and 182 data tables with no API key required. Use when working with U.S. federal fiscal data, national debt tracking (Debt to the Penny), Daily Treasury Statements, Monthly Treasury Statements, Treasury securities auctions, interest rates on Treasury securities, foreign exchange rates, savings bonds, or any U.S. government financial statistics.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fscientific\u002Fusfiscaldata\u002FSKILL.md",[],[],{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":19},"01M75GVDTBSXRQ4Q11RVJQC56M","treatment-plans","Generate concise (3-4 page), focused medical treatment plans in LaTeX\u002FPDF format for all clinical specialties. Supports general medical treatment, rehabilitation therapy, mental health care, chronic disease management, perioperative care, and pain management. Includes SMART goal frameworks, evidence-based interventions with minimal text citations, regulatory compliance (HIPAA), and professional formatting. Prioritizes brevity and clinical actionability.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fscientific\u002Ftreatment-plans\u002FSKILL.md",[],[]]