Coding

Chatmosp Parameter Builder

Try it

Parameter building and management center of the chatMOSP system. Handles MSR / KMC parameter queries, intelligent completion, gas entropy calculation, MSR↔KMC interaction parameter conversion, and missing-parameter handling. Triggers: after input-coordinator identifies a task but before the calculat

What it does

Parameter building and management center of the chatMOSP system. Handles MSR / KMC parameter queries, intelligent completion, gas entropy calculation, MSR↔KMC interaction parameter conversion, and missing-parameter handling. Triggers: after input-coordinator identifies a task but before the calculation engine executes, parameters need to be built or adjusted; or the user queries/modifies the current task's parameters.

The skill document

Language routing / 语言路由 Detect the user's language from the latest message.

  • If the user writes in English, continue with this English file and respond in English.
  • If the user writes in Chinese, read SKILL.md in this same directory and respond in Chinese. Always match the response language to the user's input language.

chatmosp-parameter-builder

1. Core Responsibilities

  1. Intelligent parameter completion — search MOSP_database → replace temperature → calculate gas entropy
  2. MSR / KMC parameter separation — two parameter sets are fully independent
  3. 5-option confirmation flow — must show user and wait for confirmation
  4. Gas entropy calculation — auto-calculate for 8 gases based on temperature
  5. Interaction parameter conversion — MSR full-adsorption ↔ KMC per-atom (literature defaults to KMC)
  6. Missing parameter handling — call literature-search for key parameters
  7. Temperature replacement — recalculate entropy when user changes temperature
  8. Parameter validation — format, range, consistency, completeness checks

2. ⚠️ Mandatory: Parameter Confirmation

No matter how clear the user's request is, parameters MUST be displayed and confirmed after building.

2.1 The 5 Options

  1. ✅ Confirm — use these parameters
  2. ✏️ Modify — adjust specific parameters (Temperature / Pressure / partial pressure / cluster size / gas species)
  3. 📊 Compare — run multiple conditions for comparison (multi-Temperature / multi-Pressure / multi-size / multi-gas-ratio)
  4. 🔄 Switch calculation mode — switch between MSR and KMC
  5. ❌ Cancel task, change system — change metal or gas system

Only after user selects option 1 can the calculation proceed.

3. MSR / KMC Parameter Separation

TaskSourceMUST NOT include
MSRMSR section + Gas + Adsorption from MOSP_databaseKMC fields
KMCKMC section (with nspecies, s1/s2, p1, e1-e7, li full set)MSR fields

⚠️ CRITICAL: MSR's input.json and KMC's input.json are TWO INDEPENDENT files. Do NOT reuse one for the other.

4. MSR Parameter Display Template

MUST use the following format exactly, do NOT create your own format:

📊 MSR Parameters ready, please confirm:

【Basic Information】
- Metal: {metal}
- Temperature: {T} K ({T-273}°C)
- Pressure: {P} Pa
- Cluster radius: {R} Å
- Crystal structure: {structure}

【Gas Environment】
- {Gas1} partial pressure: {pp1}%
- {Gas2} partial pressure: {pp2}%

【Gas Entropy Values】 (Auto-calculated)
- {Gas1} entropy: {S1} eV/K (calculated at {T}K)
- {Gas2} entropy: {S2} eV/K (calculated at {T}K)

【Surface Facet Parameters】
- {facet1} facet: surface energy {γ1} eV/Ų
- {facet2} facet: surface energy {γ2} eV/Ų
- {facet3} facet: surface energy {γ3} eV/Ų (most stable)

【Surface Adsorption Parameters】 (read from Adsorption field in input.json)
{facet1} facet:
  - {Gas1} E_ads = {E1} eV
  - {Gas2} E_ads = {E2} eV
{facet2} facet:
  - {Gas1} E_ads = {E3} eV
  - {Gas2} E_ads = {E4} eV
{facet3} facet:
  - {Gas1} E_ads = {E5} eV
  - {Gas2} E_ads = {E6} eV

【Interaction Matrix】 (read from input.json)
{facet1} facet: CO-CO={w1}, CO-O={w2}, O-O={w3}
{facet2} facet: CO-CO={w4}, CO-O={w5}, O-O={w6}
{facet3} facet: CO-CO={w7}, CO-O={w8}, O-O={w9}

【Output Settings】
- Task directory: {task_name}
- Generated files: input.json, ini.xyz, {task_name}_cluster.xyz, faceinfo.txt,
  structure.png, rotation.gif

Please select:
1. ✅ Confirm - Proceed with MSR calculation
2. ✏️ Modify - Adjust specific parameters (Temperature / Pressure / partial pressure / cluster size / gas species)
3. 📊 Compare - Run multiple conditions (multi-Temperature / multi-Pressure / multi-size / multi-gas-ratio)
4. 🔄 Switch to KMC
5. ❌ Cancel and change system

⚠️ Unit note: Gas1_pp / Gas2_pp are PERCENTAGES (%), NOT pressure values. MUST display with % sign.

5. KMC Parameter Display Template

📊 KMC Parameters ready, please confirm:

【Basic Information】
- Task type: KMC (Kinetic Monte Carlo simulation)
- Reaction: {reaction}
- Temperature: {T} K ({T-273}°C)
- Pressure: {P} Pa
- Gas partial pressure: {Gas1} {pp1}%, {Gas2} {pp2}%

【Cluster Information】 (from MSR results)
- Metal: {metal}
- Cluster radius: {R} Å
- Number of atoms: {N}
- Crystal structure: {structure}
- MSR task directory: {msr_task_name}

【Simulation Parameters】
- Simulation steps: {steps}
- Recording interval: every {record_int} steps
- Number of species: {nspecies}
- Number of reaction events: {nevents}

【Species Definitions】
- s1: {name1} ({role1})
- s2: {name2} ({role2})
- ...

【Product Definitions】
- p1: {product_name} (generated by events X, Y)

【Reaction Mechanism】 (brief)
- {mechanism_brief}

【Output Settings】
- KMC task directory: {msr_task_name}/KMC_{steps}steps/
- Generated files: input.json, coverage.png, coverage_steps.png, tof.png, tof_time.png, ...

Please select:
1. ✅ Confirm - Proceed with KMC simulation
2. ✏️ Modify - Adjust specific parameters (steps / Temperature / Pressure / partial pressure / recording interval)
3. 📊 Compare - Run multiple conditions (multi-steps / multi-Temperature / multi-Pressure / multi-gas-ratio)
4. 🔄 Switch to MSR
5. ❌ Cancel and change system

Suggestions:
- For quick testing, start with 100,000 steps
- 5M steps yields better statistics but takes longer

6. Intelligent Parameter Completion

User input
  → Extract parameters (metal, T, gas, P, steps, R, partial pressures)
  → Search MOSP_database (metal + gas match)
  → Load matching example file
  → Replace user-specified parameters
  → Calculate gas entropy (at user's T)
  → Check parameter completeness
  → Display to user for confirmation (5 options)

6.1 Search matching

  • Metal matching: exact (Pd, Pt, Au, Cu, Ni, ...)
  • Gas matching: gas species set match (CO+O₂ → CO oxidation environment)
  • Best match: highest metal+gas match score
  • Default source: mosp-for-chatMOSP/MOSP_database/

6.2 Priority

  1. User-specified > MOSP_database defaults > System defaults
  2. User unspecified → example defaults
  3. No example → system presets (P=101325Pa, R=20Å, steps=1000000)

7. Gas Entropy Calculation

7.1 Formula

S(J/K/mol) = a × T^b
S(eV/K)   = (a × T^b) / 96485
  • a, b are gas-specific (see table)
  • T is temperature (K)
  • 96485 is J→eV conversion factor

7.2 Parameters for 8 gases

Gasab
H₂41.3620.201
N₂82.3940.148
O₂90.4540.143
CO₂76.4580.181
CO85.1420.147
NO93.1210.143
H₂O64.2340.18665
NO₂93.020.1668

Parameters fit over 0~6000K, no temperature-range limitation.

7.3 Example

CO at 473K:

S(J/K/mol) = 85.142 × 473^0.147 ≈ 210.5 J/K/mol
S(eV/K)   = 210.5 / 96485 ≈ 0.00218 eV/K

7.4 Field mapping

TaskGas entropy field
MSRGas1_S / Gas2_S
KMCs1.S_gas / s2.S_gas

⚠️ CRITICAL: MSR and KMC gas entropy MUST use same formula, same values.

7.5 Recalculate on temperature change

When user selects "Modify" and changes temperature, MUST recalculate all gas entropies using §7.1 formula and update fields.

Example: T change from 500K to 800K

  • CO: S(500K) ≈ 0.002200 eV/K → S(800K) ≈ 0.002357 eV/K ✅
  • O₂: S(500K) ≈ 0.002285 eV/K → S(800K) ≈ 0.002446 eV/K ✅

8. Temperature Replacement

example temperature T_example → user temperature T_user:

  1. Update Temperature = T_user
  2. Recalculate gas entropy per §7
  3. Keep other parameters (gamma, E_ads, w matrix are T-independent)

9. Interaction Parameter Conversion (MSR ↔ KMC)

⚠️ IMPORTANT DEFAULT: All interaction parameters returned by literature search are treated as KMC format by default (interaction per adjacent atom). If used as MSR task parameters, automatically convert to MSR format, but MUST remind the user to check the literature to confirm it is truly per-adjacent-atom interaction.

Trigger condition: Only triggered for literature-retrieved parameters. MOSP_database built-in parameters are not processed (assumed correct).

9.1 Format definitions

FormatMeaningTypical range
MSRTotal interaction at full adsorption> 0.5 eV (absolute)
KMCInteraction per adjacent atom< 0.3 eV (absolute)

9.2 Default processing flow (literature parameters)

  1. Literature search returns parameters → default assumption: KMC format
  2. Auto-convert to MSR format (if needed for MSR task)
  3. Show user both original and converted values + conversion formula
  4. Remind user to check literature:
⚠️ Interaction parameters have been auto-converted from KMC format to MSR format.
Please check the original literature to confirm it is per-adjacent-atom
interaction (not full-adsorption total interaction).

Conversion formula: MSR parameter = KMC parameter × coordination number
- (100) facet: × 4
- (110) facet: × 2
- (111) facet: × 6

9.3 Conversion formula

MSR parameter = KMC parameter × coordination number

FacetCoordination
(100)4
(110)2
(111)6

9.4 Conversion example (KMC → MSR, automatic)

FacetOriginal KMCConverted MSR
(100)-0.149-0.596 (×4)
(110)-0.159-0.318 (×2)
(111)-0.168-1.008 (×6)

9.5 Conversion timing

  • MSR task + literature parameters (default KMC) → auto-convert to MSR + remind user
  • KMC task + literature parameters (default KMC) → no conversion
  • MOSP_database built-in parameters → no processing

10. Parameter Completeness Handling

After finding an example, MUST check completeness:

10.1 Key parameters missing (E_ads, w, gamma, etc.)

Step 1: Inform user "{metal}.json lacks key data (adsorption energy, interaction matrix)"

Step 2: Provide 4 options:

  1. Literature search (open access: Nature Communications, Science Advances, PNAS, ACS Central Science, Chemical Science)
  2. Literature search (paid: Science, Nature, JACS, Angewandte Chemie)
  3. User specifies parameters directly
  4. Cancel task, change system

Step 3: Option 1/2 → call literature-search; Option 3 → wait for user input; Option 4 → end task

10.2 Secondary parameters missing (Gas1_S, Gas2_S, etc.)

  • Auto-calculate (per §7.1 formula)
  • Inform user: "Some parameters use defaults or auto-calculation"

Literature-retrieved parameters do NOT include gas entropy. Regardless of completeness score, MUST recalculate per §7.1 before assembling input.json.

11. KMC input.json Required Fields

11.1 Top-level

FieldTypeExample
Elementstring"Pt"
Lattice constantstring"3.9239"
Crystal structurestring"FCC"
Temperaturestring"850"
Pressurestring"150"
flag_MSRbooleanfalse
flag_KMCbooleantrue
KMCobject{...}

11.2 KMC object

FieldTypeDescription
nLoopstringTotal simulation steps
record_intstringRecording interval
nspeciesnumberNumber of species
nproductsnumberNumber of products
neventsnumberNumber of reaction events
nevents_mobnumberNumber of mobility events
s1 / s2stringSpecies 1/2 definition (JSON string)
p1stringProduct 1 definition (JSON string)
e1 ~ e7stringReaction events 1~7 (JSON string)
liarrayLattice interaction matrix

12. Parameter Units Quick Reference

MSR parameters

FieldUnitDescription
ElementunitlessPd, Pt, Au
Lattice constantÅLattice constant
PressurePaSystem pressure
TemperatureKTemperature
RadiusÅCluster radius
Gas_pp%Partial pressure %
Gas_SeV/KGas entropy
Face.gammaeV/ŲSurface energy
Face.E_adseVAdsorption energy
Face.S_adseV/KAdsorption entropy
Face.weVInteraction matrix element

KMC parameters

FieldUnitDescription
nLoopstepsSimulation steps
record_intstepsRecording interval
massamuMolecular mass
PP_ratio%Partial pressure ratio
S_adseV/KAdsorption entropy
S_gaseV/KGas entropy
Ea_diffeVDiffusion activation energy
sticking0-1Sticking coefficient
E_ads_paraeVAdsorption energy parameter
BEP_paraeVBEP relationship parameter
lieVLattice interaction matrix

13. Error Handling

SituationAction
No matching exampleCall literature-search
Key parameters missingShow user 4 options (see §10.1)
Temperature unspecifiedDefault 500K, but confirm with user
Pressure unspecifiedDefault 101325 Pa
Cluster size unspecifiedDefault 20 Å (MSR) or 50 Å (KMC)
Steps unspecifiedDefault 1000000
Gas / partial pressure mismatchPrompt user to check

14. Cross-Skill Handoff

  • input-coordinator → this skill: task recognized, route to here
  • this skill → literature-search: when parameters missing (see literature-search)
  • this skill → msr-generator: deliver MSR params after user confirmation
  • this skill → kmc-simulator: deliver KMC params after user confirmation
  • MSR ↔ KMC handoff: after MSR, KMC independently fetches from MOSP_database, does NOT reuse MSR's input.json

15. Dependencies

  • chatmosp-input-coordinator — task entry
  • chatmosp-literature-search — when parameters missing
  • chatmosp-file-organizer — get MOSP_database path
  • chatmosp-msr-generator — MSR calculation receiver
  • chatmosp-kmc-simulator — KMC simulation receiver

16. File Structure

chatmosp-parameter-builder/
├── SKILL.md       # Chinese reference
└── SKILL_cn.md    # This file (English)

ChatMOSP Companion Skills

This skill is part of the ChatMOSP skill set. For complete functionality, install the companion ChatMOSP skills from ClawHub when they are missing:

  • chatmosp-input-coordinator
  • chatmosp-parameter-builder
  • chatmosp-msr-generator
  • chatmosp-kmc-simulator
  • chatmosp-literature-search
  • chatmosp-file-organizer

If a required companion skill is unavailable, ask the user to install the missing ChatMOSP skill from ClawHub before continuing. Use the GitHub repository only as a fallback.

Related skills

Entry skill of the chatMOSP system. Parses Chinese/English natural language input, recognizes three task types (MSR / KMC / parameter query), extracts metal, temperature, gas, partial pressure, steps, and size parameters, then dispatches parameter-builder, file-organizer, msr-generator, and kmc-simu

1 installs

Academic literature searcher of the chatMOSP system. When MOSP_database lacks matching parameters, searches open-access journals (Nature Communications, Science Advances, PNAS, etc.) and other academic resources to extract MSR/KMC parameters.

File system manager of the chatMOSP system. Handles MSR / KMC task directory creation, intelligent naming (in `metal_gas-pp_T_K_P_Pa_R_size` format), and secure file operations (path-traversal protection, whitelist restriction). Triggers: after parameter-builder confirms parameters and before calcul

2 installs

MSR (Multiscale Structure Reconstruction) calculation engine of the chatMOSP system. Invokes mosp-for-chatMOSP/utils/msr.py to generate metal cluster structures (Wulff construction), producing ini.xyz and {task_name}_cluster.xyz, then automatically generates PNG structure images and GIF rotation ani

2 installs

KMC (Kinetic Monte Carlo) simulation engine of the chatMOSP system. Invokes kmc_standalone.py via Wine to run the Windows main.exe engine, executes catalyst surface reaction kinetic simulations, and produces TOF / coverage results.

1 installs

This skill should be used when users need to translate natural language molecular structure queries into MolQL (Mol-Script) expressions. It handles basic atom/residue/chain selection, distance-based queries, property-based filtering, complex multi-part queries, and provides clarification for ambiguous requests.

2 installs1 stars