YAML configuration files are the primary way to define materials and campaigns in MatCraft. The schema is designed to be readable and self-documenting.
A material YAML defines the design space — what can vary and what you want to optimize:
name: "lithium-ion-cathode-v2"
domain: battery
description: "NMC cathode composition optimization"
components:
- name: nickel_fraction
type: continuous
bounds: [0.3, 0.9]
description: "Ni molar fraction in NMC"
- name: manganese_fraction
type: continuous
bounds: [0.05, 0.4]
- name: cobalt_fraction
type: continuous
bounds: [0.05, 0.3]
- name: coating_thickness
type: continuous
bounds: [1.0, 20.0]
unit: "nm"
constraints:
- type: sum_equals
components: [nickel_fraction, manganese_fraction, cobalt_fraction]
value: 1.0
tolerance: 0.001
objectives:
- name: specific_capacity
direction: maximize
unit: "mAh/g"
- name: cycle_retention
direction: maximize
unit: "%"
description: "Capacity retention after 500 cycles"
- name: material_cost
direction: minimize
unit: "$/kg"Campaign settings can be included in the same file or a separate one:
campaign:
max_iterations: 20
batch_size: 5
surrogate:
type: mlp
hidden_layers: [64, 64]
learning_rate: 0.001
epochs: 200
acquisition:
type: expected_improvement
exploration_weight: 0.1
convergence:
patience: 5
min_improvement: 0.01continuous, discrete, or categorical. Categorical components use choices instead of bounds.maximize or minimize.sum_equals, sum_lte, ratio_between, or custom (with a Python expression).domain field is optional but enables domain-specific physics models and validation.Validate your YAML before launching a campaign:
materia config validate my_material.yamlThis checks for schema errors, bound consistency, constraint feasibility, and warns about potential issues like very high-dimensional spaces or tight constraints.