> For the complete documentation index, see [llms.txt](https://docs.materialsproject.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.materialsproject.org/methodology/materials-methodology/grain-boundaries.md).

# Grain Boundaries

Many real, bulk crystalline materials consist of many grains separated by grain boundaries (GBs). GBs are interfaces where crystals of the same phase meet with different orientations. These boundaries strongly affect mechanical, electrical, and chemical properties, making them critical in materials design.

On MP, the GB structures and properties can be accessed through the API or generated via the Crystal Toolkit. The toolkit employs the Coincidence Site Lattice (CSL) method, where two misoriented crystals are superimposed and coincident lattice sites identified. The algorithm (implemented in pymatgen) constructs the GB structure by:<sup>1</sup>

1\. **Lattice Transformation** – transform the unit cell into a CLS unit cell where the *a* and *b* vectors lie parallel to the desired GB plane.

2\. **Grain Creation and Rotation** – build two grains and rotate them relative to each other using the specified axis and angle.

3\. **Grain Stacking** – place the two grains together, adjusting relative shifts along the *a*, *b*, and *c* directions.

4\. **Atom Merging** – remove atoms that are too close, based on a user-defined distance tolerance.

<figure><img src="/files/HGvSyisa8j0vGs5JBppq" alt=""><figcaption></figcaption></figure>

```python
from mp_api.client import MPRester

with MPRester("your_api_key_here") as mpr:
   grain_bdy = mpr.materials.grain_boundaries.search()
```

## References

\[1] Zheng, H. *et al.* Grain boundary properties of elemental metals. *Acta Mater.* vol. 186, pp. 40–49, yr. 2020. ([DOI](https://doi.org/10.1016/j.actamat.2019.12.030))

## Authors

Mona Abdelgaid


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.materialsproject.org/methodology/materials-methodology/grain-boundaries.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
