From b3747ecb75d4bc4894da8bf3b3cff154664d905a Mon Sep 17 00:00:00 2001 From: Timo Reents <77727843+t-reents@users.noreply.github.com> Date: Mon, 10 Aug 2026 16:03:03 +0200 Subject: [PATCH 1/2] WIP --- src/xtalpaint/generate_inpainting.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/xtalpaint/generate_inpainting.py b/src/xtalpaint/generate_inpainting.py index 3808eff..df4a3da 100644 --- a/src/xtalpaint/generate_inpainting.py +++ b/src/xtalpaint/generate_inpainting.py @@ -38,6 +38,8 @@ _XTALPAINT_SAMPLING_CONF = Path(__file__).parent / "sampling_conf" +_XTALPAINT_SAMPLING_CONF = Path(__file__).parent / "sampling_conf" + def draw_samples_from_sampler( sampler: PredictorCorrector, From d0ab9aa10018d685cdfac97ee9f7c7232b19375c Mon Sep 17 00:00:00 2001 From: t-reents Date: Mon, 10 Aug 2026 17:23:41 +0200 Subject: [PATCH 2/2] Include sampling configs in the installed package --- README.md | 2 +- docs/configuration.md | 3 ++- mattergen-configs/README.md | 2 -- pyproject.toml | 2 +- src/xtalpaint/sampling_conf/README.md | 11 +++++++++++ .../xtalpaint}/sampling_conf/TD-paint.yaml | 0 .../xtalpaint}/sampling_conf/csp.yaml | 0 .../xtalpaint}/sampling_conf/default.yaml | 0 tests/test_inpainting_graph.py | 2 +- 9 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 src/xtalpaint/sampling_conf/README.md rename {mattergen-configs => src/xtalpaint}/sampling_conf/TD-paint.yaml (100%) rename {mattergen-configs => src/xtalpaint}/sampling_conf/csp.yaml (100%) rename {mattergen-configs => src/xtalpaint}/sampling_conf/default.yaml (100%) diff --git a/README.md b/README.md index 2dd405c..8aa8d6f 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ config = InpaintingConfig( n_corrector_steps=1, batch_size=100, record_trajectories=False, - sampling_config_path=None, # Potentially change it to point to the mattergen sampling config directory + sampling_config_path=None, # ``None`` uses the sampling configs bundled with XtalPaint; potentially change it to point to another sampling config directory ) results = run_inpainting_pipeline( diff --git a/docs/configuration.md b/docs/configuration.md index 9e20cda..8ad5afe 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -124,7 +124,8 @@ inpainting=InpaintingConfig( # Optional fix_cell=True, # keep unit cell fixed during sampling record_trajectories=False, - sampling_config_path=None, # override MatterGen sampling config dir + sampling_config_path=None, # ``None`` uses the bundled sampling configs, + # set to override with another dir ) ``` diff --git a/mattergen-configs/README.md b/mattergen-configs/README.md index c8c9045..ce6b669 100644 --- a/mattergen-configs/README.md +++ b/mattergen-configs/README.md @@ -9,8 +9,6 @@ Adapted from https://github.com/microsoft/mattergen/tree/main/mattergen/conf The `conf` subdirectory contains the standard configurations for training (see [here](https://github.com/microsoft/mattergen/tree/main/mattergen/conf)) and the additional ones for the `pos-only` and the `TD-paint` compatible model. We also copied the standard ones from the `MatterGen` repository to make it easier to specify the configuration file, as the new configuration files only overwrite a few parameters compared to the standard ones. -Similarly, `sampling_conf` contains the standard sampling configurations (see [here](https://github.com/microsoft/mattergen/tree/main/sampling_conf)) and the additional one for the `TD-paint` compatible model. - To perform the training, one can for example run the following command: diff --git a/pyproject.toml b/pyproject.toml index 6056738..d452bb0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,7 @@ where = ["src"] include = ["xtalpaint*"] [tool.setuptools.package-data] -"*" = ["**.yaml"] +"xtalpaint" = ["sampling_conf/**/*.yaml"] # Ruff configuration [tool.ruff] diff --git a/src/xtalpaint/sampling_conf/README.md b/src/xtalpaint/sampling_conf/README.md new file mode 100644 index 0000000..7994b39 --- /dev/null +++ b/src/xtalpaint/sampling_conf/README.md @@ -0,0 +1,11 @@ +# Configuration files to sample and train MatterGen + +``` +Copyright (c) Microsoft Corporation. +Licensed under the MIT License. +Adapted from https://github.com/microsoft/mattergen/tree/main/mattergen/conf + and https://github.com/microsoft/mattergen/tree/main/sampling_conf +``` + + +The sampling configurations (the standard ones copied from the `MatterGen` repository, see [here](https://github.com/microsoft/mattergen/tree/main/sampling_conf), plus the additional one for the `TD-paint` compatible model) are shipped inside the package at `src/xtalpaint/sampling_conf`, so that they are also available for wheel installs. XtalPaint falls back to them automatically when `sampling_config_path` is not set, because `MatterGen`'s own default resolves relative to its install location and only exists for source checkouts. diff --git a/mattergen-configs/sampling_conf/TD-paint.yaml b/src/xtalpaint/sampling_conf/TD-paint.yaml similarity index 100% rename from mattergen-configs/sampling_conf/TD-paint.yaml rename to src/xtalpaint/sampling_conf/TD-paint.yaml diff --git a/mattergen-configs/sampling_conf/csp.yaml b/src/xtalpaint/sampling_conf/csp.yaml similarity index 100% rename from mattergen-configs/sampling_conf/csp.yaml rename to src/xtalpaint/sampling_conf/csp.yaml diff --git a/mattergen-configs/sampling_conf/default.yaml b/src/xtalpaint/sampling_conf/default.yaml similarity index 100% rename from mattergen-configs/sampling_conf/default.yaml rename to src/xtalpaint/sampling_conf/default.yaml diff --git a/tests/test_inpainting_graph.py b/tests/test_inpainting_graph.py index fd9c403..5b115f5 100644 --- a/tests/test_inpainting_graph.py +++ b/tests/test_inpainting_graph.py @@ -32,7 +32,7 @@ # resolves relative to its install location and does not exist for wheel # installs (e.g. in CI). _SAMPLING_CONF = str( - (Path(__file__).parent.parent / "mattergen-configs" / "sampling_conf").resolve() + (Path(__file__).parent.parent / "src" / "xtalpaint" / "sampling_conf").resolve() ) _INPAINTING = dict(