Skip to content

Conversation

@atulcthakur
Copy link
Contributor

Summary

Description

This PR introduces the GBCalc class, which provides a high-level interface for calculating grain boundary energies of crystalline materials using PESCalculator and Pymatgen structures. It supports:

  • Relaxation (or single-point calculation) of the bulk structure.
  • Generation of GB structures using GrainBoundaryGenerator.
  • Relaxation of GBs using RelaxCalc.
  • Calculation of GB energy using the difference between GB and bulk energies normalized by surface area.

Key Features

  • calc_gbs: Generates GB structures from user input, relaxes bulk structure and stores bulk energy/state.
  • calc: Computes GB energy using stored bulk reference. Relax GB.
  • calc_many: Override base calc_many. Parallel version of calc to handle multiple slab entries.
  • Extensive docstrings and type hints for clarity and maintainability.
  • Supports customizable relaxation via RelaxCalc and ASE optimizers.

Todos

If this is work in progress, what else needs to be done?

  • Write Tests for GBCalc

Checklist

  • Google format doc strings added. Check with ruff.
  • Type annotations included. Check with mypy.
  • [] Tests added for new features/fixes.
  • If applicable, new classes/functions/modules have duecredit @due.dcite decorators to reference relevant papers by DOI (example)

@shyuep
Copy link
Contributor

shyuep commented Oct 14, 2025

When will this be done?

@rul048 rul048 changed the title Add GBCalc class for computing Grain Boundary Energetics [WIP] Add GBCalc class for Grain Boundary Energy Calculation Nov 4, 2025
@rul048 rul048 self-requested a review November 4, 2025 01:29
Copy link
Contributor

@rul048 rul048 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution, Atul.

The test failure in test_GB_calc_basic seems to be caused by using an invalid input parameter, sigma=1, which physically corresponds to a perfect crystal rather than a grain boundary. In this case, GrainBoundaryGenerator.get_rotation_angle_from_sigma() returns no valid CSL configuration and raises a RuntimeError. To fix this, the test should use a physically meaningful ∑ value such as 3, 5, or 7. Alternatively, GBCalc can include a check to raise a clearer error or skip execution when sigma <= 1, ensuring the workflow only runs for valid grain boundary configurations.

Also, could you please run ruff check .py and ruff format .py to check and clear any style issues, and then use mypy .py to catch potential type inconsistencies? These steps can usually resolve linting issues.

@atulcthakur
Copy link
Contributor Author

Hi all,
Thanks for your comments. I am aware that the tests and lints are broken. I am going to push a fix in a day or two. This PR should be done soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants