matcalc._surface module
Surface Energy calculations.
- class SurfaceCalc(calculator: Calculator | str, *, relax_bulk: bool = True, relax_slab: bool = True, fmax: float = 0.1, optimizer: str | Optimizer = 'BFGS', max_steps: int = 500, relax_calc_kwargs: dict | None = None)[source]
Bases:
PropCalcA class for performing surface energy calculations by generating and optionally relaxing bulk and slab structures. This facilitates materials science and computational chemistry workflows, enabling computations of surface properties for various crystal orientations and surface terminations.
- Parameters:
calculator – ASE calculator or universal model name string.
relax_bulk – Relax bulk and cell before slab generation.
relax_slab – Relax each slab (fixed cell).
fmax – Force convergence (eV/Å).
optimizer – ASE optimizer name or class.
max_steps – Maximum relaxation steps.
relax_calc_kwargs – Optional kwargs for
RelaxCalc.
- calc(structure: Structure | Atoms | dict[str, Any]) dict[str, Any][source]
Performs surface energy calculation for a given structure dictionary. The function handles the relaxation of both bulk and slab structures when necessary and computes the surface energy using the slab’s relaxed energy, number of atoms, bulk energy per atom, and surface area.
- Parameters:
structure – Dict with
slaband eitherbulkorbulk_energy_per_atom, or a structure type (invalid combinations raise).- Returns:
Dict with
final_slab,slab_energy,surface_energy, and related bulk fields.
- calc_slabs(bulk: Structure, miller_index: tuple[int, int, int] = (1, 0, 0), min_slab_size: float = 10.0, min_vacuum_size: float = 20.0, symmetrize: bool = True, inplane_supercell: tuple[int, int] = (1, 1), slab_gen_kwargs: dict | None = None, get_slabs_kwargs: dict | None = None, **kwargs: dict[str, Any]) list[dict[str, Any]][source]
Calculates slabs based on a given bulk structure and generates a set of slabs using specified parameters. The function leverages slab generation tools and defines the in-plane supercell, symmetry, and optimizes the bulk structure prior to slab generation. This is useful for surface calculations in materials science and computational chemistry.
- Parameters:
bulk – Pymatgen bulk structure (converted to conventional cell).
miller_index – Slab orientation.
min_slab_size – Minimum slab thickness (Å).
min_vacuum_size – Vacuum thickness (Å).
symmetrize – Symmetrize slabs in
SlabGenerator.get_slabs.inplane_supercell – In-plane supercell factors for each slab.
slab_gen_kwargs – Extra kwargs for
SlabGenerator.get_slabs_kwargs – Extra kwargs for
get_slabs.**kwargs – Forwarded to
calc_many.
- Returns:
List of per-slab result dicts from
calc_many.