Add seed_cif_files base64 input for remote MCP initial pool.
MCP decodes CIF to a temp cif_dir; evolution_core implements cif_dir loading from disk.
Co-authored-by: Cursor cursoragent@cursor.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
flux — MatterGen-DEMO: Evolutionary Multi-Objective Crystal Design Plugin
An advanced evolutionary optimization framework for automated crystal structure discovery and multi-objective materials design
Overview
DEMO-MatterGen is a comprehensive plugin built on top of MatterGen that enables automated, multi-objective evolutionary optimization for crystal structure design. It combines state-of-the-art generative models with evolutionary algorithms to discover novel materials with desired properties.
Motivation
Existing generative models for materials design face three critical limitations:
Inefficient Multi-Objective Optimization: MatterGen and similar diffusion models can only perform “sample-then-filter” workflows. However, sampling Pareto-optimal materials is extremely difficult because Pareto front solutions lie at the extreme edges of the learned distribution, where diffusion models have low probability density.
Limited Conditional Generation: When targeting properties that were not included during model training (e.g., piezoelectricity, anisotropy, synthesizability scores), conditional generation becomes impossible, forcing researchers to generate massive amounts of candidates and post-filter.
Evolutionary Algorithms Cannot Handle Structured Data: Traditional evolutionary algorithms excel at multi-objective optimization but cannot be directly applied to molecular or crystalline structures due to the lack of meaningful crossover and mutation operators in discrete/geometric spaces.
DEMO bridges this gap by using the diffusion model itself as a structure-aware genetic operator (EGD), enabling evolutionary algorithms to natively operate on crystal structures while maintaining chemical and physical validity.
Key Features
Architecture
The plugin consists of five core modules:
1. Evoloop.py - Main Evolution Loop
The orchestrator that manages the entire evolutionary optimization process:
2. EMO_frameworks.py - Evolutionary Algorithm Engines
Implements multiple EMO strategies:
3. EGD_functions.py - Evolutionary Genetic Operators
Core genetic operations powered by MatterGen’s diffusion model:
4. SAES_functions.py - Selection and Environmental Algorithms
Advanced selection mechanisms:
5. characterize_functions.py - Property Evaluation Suite
Comprehensive material property characterization:
Installation
Prerequisites
JACS Microservice Setup
For CL-score evaluation, start the JACS server:
The server will automatically start on port 8080 when running Evoloop.py.
Quick Start
Initialization Modes
DEMO supports three initialization strategies:
Random Initialization (default): Generate initial population from MatterGen base model
CIF Directory Initialization: Start from existing crystal structures
Hybrid Mode: Fill population with both CIF files and random samples
Basic Usage
Hyperparameter Configuration
Edit the configuration in
Evoloop.py:Key Parameter Explanations:
Optimization Results
Example: 2D Material Discovery
Below is an example Pareto front discovered by DEMO when optimizing for low energy above hull and high band gap in 2D materials (subject to the above constraints):
Output Structure
Each run generates a timestamped directory:
Property Evaluation Details
Supported Properties
DEMO can optimize and constrain the following properties. You can easily add custom properties by extending
characterize_functions.py.FormulaK_naryelement_setSpaceGroupsg_numberE_form(eV/atom)E_hull(eV/atom)Exf_E(meV/atom)Bandgap(eV)Eps_XMag(uB)has_magnetismF_max(eV/A)S_max(GPa)Aniso_Ratiois_anisotropicVacuum(A)Thickness(A)CLscore(JACS)has_piezo_potentialPerformance Optimization
Model Caching
All models (CHGNet, ALIGNN, MatterGen) are cached in memory to avoid reloading:
Batch Processing
Use batch denoising for maximum efficiency:
Memory Management
/dev/shm(Linux RAM disk) for temporary files when availableCustomization Guide
Adding Custom Properties
To add your own property evaluator:
Add a characterization function in
characterize_functions.py:Register it in
extract_all_properties():Use it in constraints or objectives:
Custom Evolutionary Operators
Implement your own EMO engine by inheriting
BaseEMOEngine:Troubleshooting
Common Issues
JACS server connection failed
CUDA out of memory
batch_sizein denoising operationspop_sizeorn_offspringSlow property evaluation
/dev/shmfor faster I/OInvalid structures generated
noise_levelfor more diversitylimit_densityin crossoverCitation
If you use MatterGen-DEMO in your research, please cite our paper:
Please also cite the original MatterGen paper:
Molecular Version
For the molecular design version of DEMO, please visit: https://github.com/RuiqingS/DEMO
Contributing
Contributions are welcome! Please:
License
This plugin follows the same license as the main MatterGen repository.
Contact
For questions or issues specific to this plugin, please open an issue in the main MatterGen repository with the
[DEMO]tag.Acknowledgments
This plugin builds upon: