Skip to content

Commit b024e51

Browse files
committed
Enhance RSS Workflow and Configuration Management
- Updated RSS structure generation documentation to reflect new JSON configuration format and usage of `apex rss <rss.json>`. - Improved clarity in the properties documentation regarding RSS structure generation and its applications for multi-component alloys. - Refined the RSS workflow documentation to include detailed steps for generating structures, verifying outputs, and visualizing results. - Enhanced submission process by clarifying the steps for generating and refreshing configuration files, ensuring proper handling of Bohrium project IDs and access keys. - Implemented rigorous validation checks for project IDs in global configuration files to prevent mismatches and ensure integrity. - Added unit tests to validate the new configuration management features, ensuring robustness in handling project ID types and refreshing global configurations.
1 parent bdcee37 commit b024e51

9 files changed

Lines changed: 607 additions & 162 deletions

File tree

apex/skills/apex-flow/SKILL.md

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: apex-flow
3-
description: Batch multi-property materials calculations (EOS, 0K elastic constant, surface energy, phonon, finite temperature elastic constant, gamma surface, gamma line, coherent energy) via APEX calculator backends VASP/ABACUS/LAMMPS. The bundled DPA-3.2-5M OMat24 model is a DeePMD potential for LAMMPS. Use when the user mentions APEX, apex, alloy property, oxide, or multi-property DFT/MLIP screening, including EOS, 0K elastic constant, surface energy, phonon calculation, finite temperature elastic constant, gamma surface, gamma line, coherent energy.
3+
description: Batch multi-property materials calculations (EOS, 0K elastic constant, surface energy, phonon, finite temperature elastic constant, gamma surface, gamma line, cohesive energy) and random-solid-solution structure generation via APEX calculator backends VASP/ABACUS/LAMMPS. The bundled DPA-3.2-5M OMat24 model is a DeePMD potential for LAMMPS. Use when the user mentions APEX, apex, alloy property, generate/give random solid solution, generate/give solid solution, generate/give high-entropy alloy, generate/give high-entropy oxide, generate/give high-entropy material, or multi-property DFT/MLIP screening.
44
---
55

66
# APEX Flow — Alloy Properties EXplorer
@@ -41,7 +41,7 @@ Options to offer via AskQuestion:
4141

4242
## High-Level Workflow (5 Steps)
4343

44-
1. **Prepare inputs** — Check `BOHRIUM_ACCESS_KEY`, then generate `param.json` + `global.json` (including a fresh ticket) and copy structure/model files into a job directory using `scripts/generate_config.py`
44+
1. **Prepare inputs** — Check `BOHRIUM_ACCESS_KEY`, then generate `param.json` + `global.json` (including a fresh ticket) and copy structure/model files into a job directory using `scripts/generate_config.py create ...`. Never hand-write either JSON file.
4545
2. **Submit outer Bohrium job** — A lightweight client (`c1_m2_cpu`, recommended) that runs `apex submit ...` without `-s`, connects to the dflow orchestration server, and waits for completion
4646
3. **dflow executes** — Inner containers (LAMMPS/ABACUS/VASP) run the actual calculations, managed by `workflows.deepmodeling.com`
4747
4. **Monitor and retrieve results**`apex submit` monitors the inner workflow and retrieves results after completion; parse `confs/<structure>/<prop>_00/result.json`
@@ -86,38 +86,56 @@ Options to offer via AskQuestion:
8686
Immediately preserve the exact inner dflow workflow ID printed by
8787
`apex submit` and report it to the user. Keep this ID available for all later
8888
monitoring, retrieval, and workflow-control actions; do not confuse it with
89-
the outer Bohrium job ID. Query progress from the job directory with:
90-
Use the returned workflow/step phases and durations to track progress. A
89+
the outer Bohrium job ID. Follow the exact status-query and reporting
90+
protocol in `reference/workflow-control.md`; never infer workflow identity
91+
or material identity from the outer job name alone. Use the returned
92+
workflow/step phases and durations to track progress. A
9193
long-running or failed step should be investigated by its step ID/key rather
9294
than treated as successful completion. After the workflow reaches
9395
`Succeeded`, verify that automatic result retrieval completed as described
9496
in `reference/submission.md`.
9597
4. **Kill = inner FIRST, outer SECOND.** If you only kill the outer Bohrium node, the dflow workflow continues consuming resources silently. Always terminate the inner dflow workflow first. See `reference/workflow-control.md`.
96-
5. **Generate the ticket before packaging the job; never refresh it in `run.sh`.**
98+
5. **MUST use `generate_config.py`; never hand-write `param.json` or `global.json`.**
99+
- Create the complete job with `python <skill-root>/scripts/generate_config.py create ...`.
100+
- To preserve an approved `param.json` while refreshing credentials, run
101+
`python <skill-root>/scripts/generate_config.py refresh-global --global global.json`
102+
from the task directory. This updates only `global.json`.
103+
- Do not invent unsupported flags or call the ticket API directly.
104+
6. **Generate the ticket before packaging the job; never refresh it in `run.sh`.**
97105
- First inspect the agent/local environment for `BOHRIUM_ACCESS_KEY`.
98106
- If it is missing, STOP and ask the user to provide/configure it. `generate_config.py` cannot generate a ticket without an access key.
99-
- If it exists, run `scripts/generate_config.py`; it converts the key to a fresh ticket and writes it to `global.json`.
107+
- If it exists, use `create` for a new job or `refresh-global` for an existing job; both convert the key to a fresh ticket and write it to `global.json`.
100108
- Verify that `global.json` contains a non-empty `bohrium_config.ticket` before submission.
101109
- `run.sh` must only install/verify APEX and call `apex submit`. Do not add ticket API calls or depend on `BOHRIUM_ACCESS_KEY` inside the APEX container.
102110
See `reference/submission.md`.
103-
6. **Project ID from environment only.** `generate_config.py` reads `BOHRIUM_PROJECT_ID` (or `--project-id`). Never hardcode a project ID (including old examples like `13529`) into `global.json`, docs, or prompts.
104-
7. **Screen image × machine before submit.** Before writing `global.json` or submitting, run:
111+
7. **Project ID from environment only.** `generate_config.py` reads `BOHRIUM_PROJECT_ID` (or `--project-id`). Never hardcode a project ID (including old examples like `13529`) into `global.json`, docs, or prompts.
112+
8. **Hard-validate inside the task directory before every upload.** Run:
113+
```bash
114+
cd <job-dir>
115+
python <skill-root>/scripts/validate_inputs.py \
116+
--param param.json --global global.json
117+
```
118+
Do not upload or submit unless it prints `Validation PASSED` and reports both
119+
`program_id` and `bohrium_config.project_id` with `type=int`. A quoted numeric
120+
string is invalid. Upload the newly validated directory as a new outer job;
121+
never retry an outer job whose input snapshot was invalid.
122+
9. **Screen image × machine before submit.** Before writing `global.json` or submitting, run:
105123
```bash
106124
python scripts/validate_apex_combo.py list-combos --backend lammps --prefer gpu
107125
python scripts/validate_apex_combo.py check \
108126
--image registry.dp.tech/dptech/dp/native/prod-397637/deepmd-kit-phonolammps:3.1.3 \
109127
--scass "c8_m31_1 * NVIDIA T4"
110128
```
111129
Do **not** hardcode an unverified `scass_type`. Prefer `recommend` / `list-combos` output. Known failures include `deepmd-kit:3.1.0`, `3.1.1-cuda12.1`, `3.1.2`, the combination `deepmd-kit:3.1.1` × `NVIDIA T4`, `c4_m16_cpu`, and `c12_m46_1 * NVIDIA T4`. The default LAMMPS image is `registry.dp.tech/dptech/dp/native/prod-397637/deepmd-kit-phonolammps:3.1.3`; `apex submit` enforces it for LAMMPS phonon and Grüneisen workflows.
112-
8. **MUST use the bundled frozen DPA model under** `models/` **for LAMMPS + DeePMD unless the user explicitly requests another compatible model.** The skill ships
130+
10. **MUST use the bundled frozen DPA model under** `models/` **for LAMMPS + DeePMD unless the user explicitly requests another compatible model.** The skill ships
113131
`models/DPA-3.2-5M/DPA-3.2-5M-OMat24.pth`, a ready-to-run frozen
114132
DPA-3.2-5M OMat24 model. Copy it into the job directory before generating
115133
`param.json`. The multi-head source checkpoint is **not** in the skill zip —
116134
fetch it only when the user explicitly needs another task head
117135
(`scripts/fetch_models.py --source-checkpoint` or
118136
`dp --pt pretrained download DPA-3.2-5M`) and freeze that head before use.
119137
See `models/README.md`.
120-
9. **Preserve the user's input cell and prevent accidental double expansion.**
138+
11. **Preserve the user's input cell and prevent accidental double expansion.**
121139
APEX does not require a conventional cell. Do not convert a primitive cell or
122140
user-provided supercell to a conventional cell merely because an example uses
123141
`confs/std-fcc` or another `std-*` name.
@@ -133,7 +151,7 @@ Options to offer via AskQuestion:
133151

134152

135153

136-
## Supported Properties (15 types)
154+
## Supported Properties (14 types)
137155

138156

139157
| Type | JSON `type` value | Backend | Description |
@@ -218,7 +236,11 @@ See `reference/submission.md` for the full validated template.
218236

219237
## RSS (Random Solid Solution) Workflow
220238

221-
For high-entropy alloys/ceramics, use `apex rss` to generate structures, then run property calculations on them. See `reference/rss_workflow.md` for full details.
239+
For random solid solutions, solid solutions, high-entropy alloys, high-entropy
240+
oxides/ceramics, and other high-entropy materials, use `apex rss` to generate
241+
structures before property calculations. Read `reference/rss_workflow.md`
242+
before asking the user questions or writing `rss.json`; it defines the required
243+
QA, current JSON schema, output layout, and visualization fallback.
222244

223245
## Working Test Case (Reference)
224246

@@ -235,7 +257,7 @@ Successfully validated workflow (ID: `cu-fcc-elastic-v3-joint-sdfml`):
235257

236258
| Script | Purpose |
237259
| ------------------------ | --------------------------------------------------------------------------------- |
238-
| `generate_config.py` | Generate global.json + param.json with ticket auth; requires `BOHRIUM_PROJECT_ID` |
260+
| `generate_config.py` | `create` a complete job or `refresh-global` credentials without changing param.json |
239261
| `validate_apex_combo.py` | List / check / recommend safe image × scass_type combos |
240262
| `fetch_models.py` | Optional: download the DPA-3.2-5M multi-head source `.pt` for freezing another head |
241263
| `parse_results.py` | Parse APEX output into summary |
@@ -250,8 +272,8 @@ Successfully validated workflow (ID: `cu-fcc-elastic-v3-joint-sdfml`):
250272
| File | Content |
251273
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
252274
| `reference/submission.md` | Authentication (ticket API + refresh), run.sh template, Bohrium config (images/machines), global.json template, RFC 1123 naming, submission lifecycle |
253-
| `reference/workflow-control.md` | Key commands table, stopping/killing procedure, pre-submission structure validation |
254-
| `reference/properties.md` | Complete parameter reference for all 15 property types |
275+
| `reference/workflow-control.md` | Running-task status/count format, live Argo link, stopping/killing procedure, and structure validation |
276+
| `reference/properties.md` | Complete parameter reference for all 14 property types |
255277
| `reference/calculators.md` | Detailed backend configuration (VASP, ABACUS, LAMMPS) |
256278
| `reference/lammps_potentials.md` | LAMMPS potential type details and examples |
257279
| `reference/rss_workflow.md` | RSS structure generation workflow |

apex/skills/apex-flow/reference/examples.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,21 +210,43 @@ apex do param.json post_props -c global.json
210210
**Scenario**: High-entropy alloy property screening using random solid solutions.
211211

212212
### Step 1: Generate RSS structures (run locally)
213+
214+
Write `rss.json`:
215+
216+
```json
217+
{
218+
"parent_lattice": {
219+
"type": "fcc",
220+
"a": "auto",
221+
"supercell": "auto"
222+
},
223+
"compositions": {
224+
"all": {
225+
"Co": 0.2,
226+
"Cr": 0.2,
227+
"Fe": 0.2,
228+
"Mn": 0.2,
229+
"Ni": 0.2
230+
}
231+
},
232+
"composition_tolerance": 0.005,
233+
"maximum_num_atoms": 200,
234+
"num_configs": 5,
235+
"seed": 21,
236+
"output_structure": "confs/rss_fcc"
237+
}
238+
```
239+
213240
```bash
214-
# Generate 5 random configurations of equiatomic CoCrFeMnNi in FCC
215-
apex rss --composition "Co0.2Cr0.2Fe0.2Mn0.2Ni0.2" \
216-
--prototype fcc \
217-
--supercell 3 3 3 \
218-
--n-configs 5 \
219-
--output-dir confs/rss_fcc
241+
apex rss rss.json
220242
```
221243

222244
### Step 2: Property calculation
223245

224246
### param.json
225247
```json
226248
{
227-
"structures": ["confs/rss_fcc"],
249+
"structures": ["confs/rss_fcc/conf_*"],
228250
"interaction": {
229251
"type": "deepmd",
230252
"model": "CoCrFeMnNi.pb",

apex/skills/apex-flow/reference/properties.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -584,15 +584,13 @@ VASP and ABACUS run the same temperature schedule with their native NpT integrat
584584

585585
---
586586

587-
## 15. RSS (Random Solid Solution) — Structure Generation
587+
## RSS Structure Generation
588588

589-
**type**: Not a property calculation per se. Use `apex rss` CLI command.
589+
Use `apex rss <rss.json>` to generate input structures.
590590

591-
This generates random solid solution configurations for multi-component alloys. The generated structures are then used as input to property calculations above.
592-
593-
```bash
594-
apex rss --composition "CoCrFeMnNi" --prototype bcc --supercell 3 3 3 --n-configs 10
595-
```
591+
It generates random-solid-solution configurations for multi-component alloys,
592+
high-entropy oxides, and related materials. Use the generated
593+
`conf_###/POSCAR` directories as inputs to the property calculations above.
596594

597595
See `reference/rss_workflow.md` for full details.
598596

0 commit comments

Comments
 (0)