$npx -y skills add jinzhezenggroup/computational-chemistry-agent-skills --skill pymatgen-structureStructure manipulation and crystal analysis workflows based on pymatgen. USE WHEN you need to read/write common atomistic formats (CIF, POSCAR, XYZ), build supercells, perform site substitution/doping, inspect symmetry (space group), or compute local structure descriptors for mat
| 1 | # pymatgen Structure Operations |
| 2 | |
| 3 | Use this skill to perform **structure preprocessing and analysis** with `pymatgen`. |
| 4 | |
| 5 | ## Scope |
| 6 | |
| 7 | This skill should: |
| 8 | |
| 9 | - require at least one user-provided structure file |
| 10 | - parse and normalize common structure formats |
| 11 | - perform requested geometry edits (for example supercell, substitution) |
| 12 | - run basic crystal analysis (for example symmetry, composition) |
| 13 | - write explicit output files and summarize key changes |
| 14 | |
| 15 | This skill should **not**: |
| 16 | |
| 17 | - submit HPC jobs |
| 18 | - run expensive DFT/MD production calculations |
| 19 | - invent missing scientific intent (for example random doping strategy) without confirmation |
| 20 | |
| 21 | If the user asks for DFT submission, hand off to a submission skill such as `dpdisp-submit` after preprocessing is done. |
| 22 | |
| 23 | ## Hard requirement |
| 24 | |
| 25 | The user must provide an input structure source (file path or explicit coordinates + lattice). |
| 26 | |
| 27 | If structure input is missing, stop and ask for it. |
| 28 | |
| 29 | ## Supported input/output formats |
| 30 | |
| 31 | Typical input formats: |
| 32 | |
| 33 | - `cif` |
| 34 | - `POSCAR` / `CONTCAR` |
| 35 | - `xyz` (for non-periodic or when cell is provided separately) |
| 36 | - other formats supported by `pymatgen` IO backends |
| 37 | |
| 38 | Typical output formats: |
| 39 | |
| 40 | - `cif` |
| 41 | - `POSCAR` |
| 42 | - `xyz` |
| 43 | - optional JSON summaries |
| 44 | |
| 45 | ## Expected workflow |
| 46 | |
| 47 | 1. Read user-provided structure. |
| 48 | 1. Validate periodicity and cell information. |
| 49 | 1. Confirm requested operation (convert, supercell, substitution, analysis). |
| 50 | 1. Collect only missing critical parameters. |
| 51 | 1. Execute operation via `pymatgen`. |
| 52 | 1. Write output structure(s) and a short result summary. |
| 53 | 1. If requested, prepare handoff-ready files for downstream skills. |
| 54 | |
| 55 | For concrete command patterns, see `references/commands-and-workflow.md`. |
| 56 | |
| 57 | ## Operations this skill should handle |
| 58 | |
| 59 | ### A) Format conversion |
| 60 | |
| 61 | - convert between `cif` / `POSCAR` / `xyz` |
| 62 | - preserve lattice and species ordering when possible |
| 63 | |
| 64 | ### B) Supercell construction |
| 65 | |
| 66 | - apply scaling matrix, for example `[[2,0,0],[0,2,0],[0,0,1]]` |
| 67 | - report final atom count and new lattice vectors |
| 68 | |
| 69 | ### C) Substitution / doping-like edits |
| 70 | |
| 71 | - deterministic site substitution by species or by explicit site index |
| 72 | - report stoichiometry before/after |
| 73 | - ask user before applying random substitutions |
| 74 | |
| 75 | ### D) Symmetry and composition analysis |
| 76 | |
| 77 | - reduced formula |
| 78 | - lattice parameters |
| 79 | - space group symbol/number |
| 80 | - optional primitive/conventional standardization when explicitly requested |
| 81 | |
| 82 | ### E) Local environment quick checks |
| 83 | |
| 84 | - nearest-neighbor distances or coordination-style summaries |
| 85 | - report method/threshold assumptions |
| 86 | |
| 87 | ## Parameters to collect |
| 88 | |
| 89 | ### Must provide |
| 90 | |
| 91 | - input structure path |
| 92 | - target operation type |
| 93 | - output path (or output naming rule) |
| 94 | |
| 95 | ### Operation-specific |
| 96 | |
| 97 | For format conversion: |
| 98 | |
| 99 | - output format |
| 100 | |
| 101 | For supercell: |
| 102 | |
| 103 | - scaling matrix or `(na, nb, nc)` |
| 104 | |
| 105 | For substitution: |
| 106 | |
| 107 | - source species/site selection |
| 108 | - target species |
| 109 | - substitution fraction or exact indices |
| 110 | |
| 111 | For symmetry analysis: |
| 112 | |
| 113 | - symmetry tolerance (if non-default behavior is desired) |
| 114 | |
| 115 | ## Required behavior |
| 116 | |
| 117 | 1. Check file existence/readability before processing. |
| 118 | 1. Detect and report missing lattice info for periodic workflows. |
| 119 | 1. Do not silently drop atoms or reorder species without notice. |
| 120 | 1. Explicitly show assumptions (for example tolerance values). |
| 121 | 1. Return exact output file paths. |
| 122 | |
| 123 | ## Defaulting policy |
| 124 | |
| 125 | Allowed only for low-risk defaults, clearly labeled. |
| 126 | |
| 127 | Reasonable defaults: |
| 128 | |
| 129 | - symmetry tolerance defaults from `pymatgen` when user does not specify |
| 130 | - output basename derived from input name + operation suffix |
| 131 | |
| 132 | Do **not** silently invent: |
| 133 | |
| 134 | - lattice for periodic systems |
| 135 | - substitution ratio for doping tasks |
| 136 | - magnetic/electronic settings (outside this skill's scope) |
| 137 | |
| 138 | ## Expected output |
| 139 | |
| 140 | Provide: |
| 141 | |
| 142 | 1. output file path(s) |
| 143 | 1. concise summary of changes (atom count, composition, lattice deltas) |
| 144 | 1. analysis result highlights (for example space group) |
| 145 | 1. explicit assumptions and unresolved choices |
| 146 | 1. next-step suggestion when user wants downstream DFT/MD submission |
| 147 | |
| 148 | ## Common failure points |
| 149 | |
| 150 | - unreadable input file or ambiguous format |
| 151 | - xyz input lacking periodic cell when periodic workflow is requested |
| 152 | - invalid scaling matrix or impossible substitution request |
| 153 | - too aggressive tolerances causing unstable symmetry classification |