Lobsterpy

0.6.0 · active · verified Fri Apr 17

Lobsterpy is a Python package designed for automatic bonding analysis derived from LOBSTER calculations, which themselves process VASP output. It helps researchers analyze chemical bonding in materials efficiently. The current version is 0.6.0, and the project is under active development with irregular but consistent releases.

Common errors

Warnings

Install

Imports

Quickstart

This example demonstrates how to initialize `LobsterpyAnalysis` with a LOBSTER/VASP calculation directory and extract basic bonding and population data. Ensure the `path_to_lobster_calc` variable points to a directory containing all necessary LOBSTER and VASP output files.

from pathlib import Path
from lobsterpy.cohp.analyze import LobsterpyAnalysis

# NOTE: Replace with the actual path to your LOBSTER/VASP calculation directory.
# This directory should contain files like COHPCAR.lobster, vasprun.xml, POSCAR etc.
# For a runnable example, you would need to set up such a directory locally.
path_to_lobster_calc = Path('/path/to/your/lobster_calculation_output')

# Create an instance of LobsterpyAnalysis
try:
    analyzer = LobsterpyAnalysis(
        path_to_lobster_calc=path_to_lobster_calc,
        gaussian_smearing_width=0.05,
        spin_type='none' # or 'up', 'down' for spin-polarized calculations
    )

    # Access bonding analysis results
    bond_data = analyzer.bond_analysis
    print("Bond Analysis:\n", bond_data)

    # You can also get population data
    population_data = analyzer.get_population_data()
    print("Population Data:\n", population_data)

except FileNotFoundError as e:
    print(f"Error: Calculation path not found or missing files. {e}")
    print("Please ensure 'path_to_lobster_calc' points to a valid LOBSTER/VASP calculation directory.")
except Exception as e:
    print(f"An error occurred during analysis: {e}")

view raw JSON →