{"id":10109,"library":"pymatgen-analysis-alloys","title":"pymatgen-analysis-alloys Library","description":"pymatgen-analysis-alloys is an add-on library for Pymatgen, providing classes and tools specifically designed for describing alloy (disordered) systems. It extends Pymatgen's core functionalities to handle compositions and structures where atomic sites may be occupied by multiple species with certain probabilities. The current version is 0.0.8, and releases are generally tied to new features or compatibility updates within the broader Pymatgen ecosystem.","status":"active","version":"0.0.8","language":"en","source_language":"en","source_url":"https://github.com/materialsproject/pymatgen-analysis-alloys","tags":["materials science","chemistry","alloys","pymatgen","disordered systems"],"install":[{"cmd":"pip install pymatgen-analysis-alloys","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core dependency for materials science data structures; requires >=2022.0.8","package":"pymatgen","optional":false}],"imports":[{"symbol":"DisorderedComposition","correct":"from pymatgen_analysis_alloys.composition import DisorderedComposition"},{"note":"Classes are typically nested in submodules like 'composition' or 'disordered_systems'.","wrong":"from pymatgen_analysis_alloys import DisorderedStructure","symbol":"DisorderedStructure","correct":"from pymatgen_analysis_alloys.disordered_systems import DisorderedStructure"}],"quickstart":{"code":"from pymatgen_analysis_alloys.composition import DisorderedComposition\nfrom pymatgen.core.composition import Composition\n\n# Create a simple disordered composition, e.g., Cu_0.5 Ni_0.5\ndisordered_comp = DisorderedComposition({\"Cu\": 0.5, \"Ni\": 0.5})\n\nprint(f\"Disordered composition: {disordered_comp}\")\nprint(f\"Formula: {disordered_comp.reduced_formula}\")\n\n# Compare with a standard pymatgen Composition\nstandard_comp = Composition({\"Cu\": 0.5, \"Ni\": 0.5})\nprint(f\"Standard composition: {standard_comp}\")\n\n# Accessing properties\nprint(f\"Atomic fractions: {disordered_comp.as_dict()}\")\n","lang":"python","description":"This example demonstrates how to create a `DisorderedComposition` object for an alloy system and access its basic properties. It also shows the distinction between a `DisorderedComposition` and a standard Pymatgen `Composition`."},"warnings":[{"fix":"Ensure your `pymatgen` installation meets the minimum version requirement: `pip install --upgrade pymatgen`.","message":"Compatibility with `pymatgen` versions is crucial. This library requires `pymatgen>=2022.0.8`. Using an older `pymatgen` version may lead to `ImportError`s, `TypeError`s, or unexpected behavior.","severity":"gotcha","affected_versions":"<0.0.8"},{"fix":"Always refer to the specific documentation or source code for `pymatgen-analysis-alloys` objects when integrating them into workflows, especially if passing them to other Pymatgen-based tools.","message":"Objects from `pymatgen-analysis-alloys` (e.g., `DisorderedComposition`, `DisorderedStructure`) are specialized extensions of `pymatgen`'s core objects. While they often inherit similar methods, they may not be fully compatible with all functions expecting a pure `pymatgen.Composition` or `pymatgen.Structure` without explicit handling.","severity":"gotcha","affected_versions":"All"},{"fix":"Understand the scope of `pymatgen-analysis-alloys` as a foundational descriptive tool for disordered materials, and plan to integrate it with other computational packages for advanced simulations.","message":"The library primarily focuses on the *description* and representation of disordered systems. While it provides useful data structures, it does not inherently offer advanced simulation or analysis capabilities (e.g., Monte Carlo, DFT calculations) beyond what Pymatgen itself provides, without further integration with other tools.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Install the library using pip: `pip install pymatgen-analysis-alloys`","cause":"The `pymatgen-analysis-alloys` library has not been installed in your Python environment.","error":"ModuleNotFoundError: No module named 'pymatgen_analysis_alloys'"},{"fix":"Use the correct import path: `from pymatgen_analysis_alloys.composition import DisorderedComposition`","cause":"The specific class `DisorderedComposition` is located within a submodule (`composition`) of the `pymatgen_analysis_alloys` package, not directly under the top-level package.","error":"ImportError: cannot import name 'DisorderedComposition' from 'pymatgen_analysis_alloys'"},{"fix":"Ensure that inputs to constructors like `DisorderedComposition` or `DisorderedStructure` match the expected type (e.g., a dictionary for composition, or specific Pymatgen objects and site definitions for structures).","cause":"Attempting to call a dictionary object as if it were a function, commonly occurring when trying to pass arguments to a constructor without using the correct syntax or input type.","error":"TypeError: 'dict' object is not callable"}]}