{
 "schema_version": 1,
 "generated": "2026-11-09",
 "id": "cedergrouphub-chgnet--pre-relax-structures-before-dft-with-chgnet",
 "repo": "CederGroupHub/chgnet",
 "repo_url": "https://github.com/CederGroupHub/chgnet",
 "repo_slug": "cedergrouphub-chgnet",
 "title": "Pre-relax structures before a DFT run",
 "page_title": "How to pre-relax structures before a DFT run with Chgnet",
 "summary": "Use StructOptimizer to relax a structure and get site-wise magnetic moments to seed spin-polarized DFT.",
 "who": "A computational chemist preparing inputs for a spin-polarized DFT calculation.",
 "problem": "Starting DFT from an unrelaxed structure wastes many ionic steps.",
 "outcome": "A relaxed structure and its total energy, ready to hand to your DFT workflow.",
 "steps": [
  "Install with `pip install chgnet`",
  "Create the optimizer with `relaxer = StructOptimizer()`",
  "Run `result = relaxer.relax(structure)` on your pymatgen structure",
  "Use `result[\"final_structure\"]` as the relaxed structure",
  "Read the final energy from `result['trajectory'].energies[-1]`"
 ],
 "agent_prompt": "With CederGroupHub/chgnet, relax my CIF using `relaxer = StructOptimizer()` and `result = relaxer.relax(structure)`, then print the relaxed structure and total energy in eV.",
 "agents": [
  "claude-code",
  "codex",
  "cursor",
  "gemini-cli"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "This card is written from the CederGroupHub/chgnet README, not from a test run by Deduped. Before you start, make sure you have Python and pip. Check the repo for newer instructions before you rely on these steps.",
 "category": "Security and science",
 "tags": [
  "Security and science"
 ],
 "lang": "python",
 "requirements": [
  "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)"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/cedergrouphub-chgnet/pre-relax-structures-before-dft-with-chgnet/",
 "md": "https://dedupedai.com/use-cases/cedergrouphub-chgnet/pre-relax-structures-before-dft-with-chgnet/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/cedergrouphub-chgnet--pre-relax-structures-before-dft-with-chgnet.json",
 "api_version": "v1"
}
