DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to predict energy, forces and magnetic moments of a crystal with Chgnet

Load a pretrained CHGNet and run a static calculation on a CIF structure.

Short answer: Install with pip install chgnet; then load the default model with chgnet = CHGNet.load(); read your structure with Structure.from_file('examples/mp-18767-LiMnO2.cif'), using your own CIF path. All steps.

  • Top pick
  • Security and science
  • Intermediate
  • 30 minutes
  • From the README
  • Claude Code
  • Codex
  • Cursor
  • Gemini CLI

Who it is forA materials scientist who needs a quick estimate before spending DFT time.

The problemA DFT static calculation for every candidate structure is slow and costly.

The outcomePredicted energy per atom, forces, stress and magnetic moments for your structure.

What you need first

  • Python and pip
  • A crystal structure file such as a CIF
  • pymatgen for loading structures
  • CPU, NVIDIA GPU, Intel GPU or Apple silicon (device picked automatically)

Steps

  1. Install with pip install chgnet
  2. Load the default model with chgnet = CHGNet.load()
  3. Read your structure with Structure.from_file('examples/mp-18767-LiMnO2.cif'), using your own CIF path
  4. Call chgnet.predict_structure(structure) to get the prediction
  5. Print energy (eV/atom), forces (eV/A), stress (GPa) and magmom (mu_B) from the result

Prompt for your agent

Using CederGroupHub/chgnet, install it with `pip install chgnet`, load a CIF with pymatgen and run `chgnet.predict_structure(structure)`. Print energy, forces, stress and magmom with their units.

Caveat. Predictions are model estimates, so check anything important against DFT.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for CederGroupHub/chgnet and "Predict energy, forces and magnetic moments of a crystal"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer