Skip to content

Commit 5a720af

Browse files
njzjz-botJinzhe Zengpre-commit-ci[bot]
authored
chore: add mdformat for markdown (#1866)
Sync pre-commit config from deepmd-kit@69eb0c3bb10be0ace823a5240c9fef6d0bb26c08 Changes: - Add mdformat for markdown formatting - Add mdformat plugins: myst, ruff, web, config, beautysh, gfm-alerts Authored by OpenClaw (model: glm-5) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Widespread formatting and clarity improvements across guides, tutorials, troubleshooting, and examples; expanded and standardized JSON/YAML samples and workflow explanations for init, relaxation, property, refine, reproduce, and run processes. * **Chores** * Added a Markdown formatter to pre-commit hooks and set CI autoupdate branch. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Jinzhe Zeng <njzjz2008@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 0a08fd3 commit 5a720af

44 files changed

Lines changed: 1166 additions & 905 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,19 @@ repos:
3939
hooks:
4040
- id: velin
4141
args: ["--write"]
42+
# markdown
43+
- repo: https://github.com/hukkin/mdformat
44+
rev: 1.0.0
45+
hooks:
46+
- id: mdformat
47+
exclude: "^(tests/|examples/init/abacus/).*$"
48+
additional_dependencies:
49+
# See https://github.com/executablebooks/mdformat-myst/issues/13
50+
- "git+https://github.com/njzjz-bothub/mdformat-myst@d9c414e#egg=mdformat-myst"
51+
- mdformat-ruff==0.1.3
52+
- mdformat-web==0.2.0
53+
- mdformat-config==0.2.1
54+
- mdformat-beautysh==1.0.0
55+
- mdformat-gfm-alerts==2.0.0
56+
ci:
57+
autoupdate_branch: devel

AGENTS.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Always reference these instructions first and fallback to search or bash command
77
## Working Effectively
88

99
### Bootstrap and Install
10+
1011
- **Environment Setup**:
1112
- Ensure Python 3.9+ is available: `python --version`
1213
- Create virtual environment: `python -m venv dpgen_env && source dpgen_env/bin/activate`
@@ -16,25 +17,29 @@ Always reference these instructions first and fallback to search or bash command
1617
- Test installation: `dpgen -h`
1718

1819
### Core Dependencies Installation Times
20+
1921
- **Dependencies**: Include large scientific packages (numpy, pymatgen, ASE, etc.)
2022
- **Installation Time**: Full installation takes 1-5 minutes with uv, 3-10 minutes with pip. Use timeout of 10+ minutes.
2123
- If network timeouts occur, retry with: `uv pip install --timeout 600 -e .` or `pip install --timeout 600 -e .`
2224
- For faster testing: `uv pip install --no-deps -e .` or `pip install --no-deps -e .` (installs without dependencies, will fail at runtime)
2325

2426
### Testing
27+
2528
- **Unit Tests**: `python -m unittest discover tests -v` -- takes 2-5 minutes. Set timeout to 10+ minutes.
2629
- **Coverage**: `coverage run --source=./dpgen -m unittest -v && coverage report` -- takes 3-8 minutes. Set timeout to 15+ minutes.
27-
- **Quick Test**: `python -m unittest tests.test_load_file -v` -- takes <1 second (will fail without dependencies but tests framework)
30+
- **Quick Test**: `python -m unittest tests.test_load_file -v` -- takes \<1 second (will fail without dependencies but tests framework)
2831
- **CLI Test**: `python -m unittest tests.test_cli -v` -- tests all dpgen subcommands
2932

3033
### Build Process
34+
3135
- **No Traditional Build**: This is a pure Python package using setuptools
3236
- **Documentation Build**: `cd doc && make html` -- takes 2-5 minutes. Set timeout to 10+ minutes.
3337
- **Package Build**: `python -m build` -- takes 1-3 minutes
3438

3539
## Development Requirements
3640

3741
### Commit Messages and PR Titles
42+
3843
- **Use Semantic Commit Messages**: Follow conventional commit format for all commits and PR titles
3944
- `feat:` for new features
4045
- `fix:` for bug fixes
@@ -45,6 +50,7 @@ Always reference these instructions first and fallback to search or bash command
4550
- Examples: `feat: add comprehensive GitHub Copilot instructions`, `fix: resolve timeout in dependency installation`
4651

4752
### Package Management
53+
4854
- **Prefer uv**: Use `uv` for Python dependency management when available
4955
- Installation: `uv pip install -e .`
5056
- Adding dependencies: `uv add package-name`
@@ -53,20 +59,23 @@ Always reference these instructions first and fallback to search or bash command
5359
## Main Workflows and Commands
5460

5561
### dpgen run - Core Workflow
62+
5663
- **Purpose**: Main deep potential generation with iterative training/exploration/labeling
5764
- **Usage**: `dpgen run param.json machine.json`
5865
- **Key Files**:
5966
- `param.json`: System parameters, training config, exploration settings
6067
- `machine.json`: HPC/computation resource configuration
6168
- **Process**: Creates iterations (iter.000001, iter.000002, etc.) with 00.train, 01.model_devi, 02.fp subdirectories
6269

63-
### dpgen init_* - Data Preparation
70+
### dpgen init\_\* - Data Preparation
71+
6472
- **init_bulk**: `dpgen init_bulk param.json [machine.json]` -- bulk systems
6573
- **init_surf**: `dpgen init_surf param.json [machine.json]` -- surface systems
6674
- **init_reaction**: `dpgen init_reaction param.json [machine.json]` -- reactive systems
6775
- **Purpose**: Generate initial training data for deep potential models
6876

6977
### dpgen autotest - Validation
78+
7079
- **Usage**: `dpgen autotest make|run|post param.json [machine.json]`
7180
- **Three Phases**:
7281
- `make`: Set up calculation tasks
@@ -75,17 +84,20 @@ Always reference these instructions first and fallback to search or bash command
7584
- **Supports**: VASP, ABACUS, DeepMD, MEAM, EAM force fields
7685

7786
### dpgen simplify - Dataset Optimization
87+
7888
- **Usage**: `dpgen simplify param.json machine.json`
7989
- **Purpose**: Reduce dataset size while maintaining quality
8090

8191
### Other Commands
92+
8293
- **collect**: `dpgen collect JOB_DIR OUTPUT` -- gather generated data
8394
- **db**: `dpgen db param.json` -- database operations
8495
- **gui**: `dpgen gui` -- web interface (requires dpgui package)
8596

8697
## Configuration Files
8798

8899
### Parameter Files (param.json)
100+
89101
- **Location**: `examples/` directory contains templates for different scenarios
90102
- **Key Examples**:
91103
- `examples/run/deprecated/dp2.x-lammps-vasp/param.json` -- VASP with LAMMPS
@@ -95,6 +107,7 @@ Always reference these instructions first and fallback to search or bash command
95107
- **Format**: JSON with extensive nested parameters for system, training, exploration settings
96108

97109
### Machine Files (machine.json)
110+
98111
- **Location**: `examples/machine/` directory
99112
- **Purpose**: Define computational resources (HPC systems, cloud platforms)
100113
- **Examples**:
@@ -105,11 +118,13 @@ Always reference these instructions first and fallback to search or bash command
105118
## Validation
106119

107120
### Always Run Before Committing
121+
108122
- **Full Dependencies Required**: All validation requires `uv pip install -e .` or `pip install -e .` (1-5 min install)
109123
- `python -m unittest discover tests -v` -- full test suite (requires dependencies)
110124
- `dpgen -h && dpgen run -h && dpgen autotest -h` -- CLI validation (requires installation)
111125

112126
### Working Without Full Installation
127+
113128
- **Code Exploration**: All source code can be read and edited without installation
114129
- **Local Import Test**: `python -c "import sys; sys.path.insert(0, '.'); import dpgen"` (0.03s)
115130
- **JSON Examples**: Configuration files in `examples/` can be examined without running
@@ -119,6 +134,7 @@ Always reference these instructions first and fallback to search or bash command
119134
## Repository Structure
120135

121136
### Key Directories
137+
122138
- `dpgen/` -- Main source code
123139
- `generator/` -- Core DP-GEN functionality (`dpgen run`)
124140
- `auto_test/` -- Testing framework (`dpgen autotest`)
@@ -130,6 +146,7 @@ Always reference these instructions first and fallback to search or bash command
130146
- `doc/` -- Sphinx documentation
131147

132148
### Important Files
149+
133150
- `pyproject.toml` -- Modern Python packaging configuration
134151
- `.github/workflows/test.yml` -- CI pipeline (Python 3.9, 3.12)
135152
- `dpgen/main.py` -- CLI command definitions and entry points
@@ -139,17 +156,20 @@ Always reference these instructions first and fallback to search or bash command
139156
## Common Development Tasks
140157

141158
### Adding New Features
159+
142160
- **Main CLI**: Edit `dpgen/main.py` to add new subcommands
143161
- **Core Logic**: Extend modules in `dpgen/generator/`, `dpgen/auto_test/`, etc.
144162
- **Tests**: Add corresponding tests in `tests/` directory
145163
- **Examples**: Provide configuration examples in `examples/`
146164

147165
### Code Quality
166+
148167
- **Linting**: Uses ruff configuration in pyproject.toml
149168
- **Import Style**: isort with black profile
150169
- **Documentation**: Numpy-style docstrings, Sphinx for docs
151170

152171
### Working with Scientific Dependencies
172+
153173
- **Heavy Dependencies**: Package integrates with VASP, LAMMPS, Gaussian, etc.
154174
- **File I/O**: Uses dpdata for structure file handling
155175
- **HPC Integration**: dpdispatcher for job submission/management
@@ -160,17 +180,19 @@ Always reference these instructions first and fallback to search or bash command
160180
- **Installation**: 1-5 minutes with uv, 3-10 minutes with pip (timeout 10+ minutes)
161181
- **Full Test Suite**: 2-5 minutes (timeout 10+ minutes)
162182
- **Documentation Build**: 2-5 minutes (timeout 10+ minutes)
163-
- **Quick Import Test**: <1 second
183+
- **Quick Import Test**: \<1 second
164184
- **CI Pipeline**: Runs on Python 3.9 and 3.12, full cycle ~10-15 minutes
165185

166186
## Error Patterns
167187

168188
### Common Installation Issues
189+
169190
- **Network Timeouts**: Scientific packages are large, increase pip timeout
170191
- **Missing System Dependencies**: Some packages require system libraries
171192
- **Version Conflicts**: Pin to specific Python versions (3.9-3.12)
172193

173194
### Runtime Issues
195+
174196
- **Missing Dependencies**: Many features require specific scientific software
175197
- **Configuration Errors**: JSON files have complex nested schemas
176198
- **HPC Connectivity**: Machine files require proper authentication setup

README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<picture><source media="(prefers-color-scheme: dark)" srcset="./doc/_static/logo-dark.svg"><source media="(prefers-color-scheme: light)" srcset="./doc/_static/logo.svg"><img alt="DP-GEN logo" src="./doc/_static/logo.svg"></picture>
22

3-
--------------------------------------------------------------------------------
3+
______________________________________________________________________
44

55
# DP-GEN: A concurrent learning platform for the generation of reliable deep learning based potential energy models
66

@@ -10,16 +10,17 @@
1010
[![conda install](https://img.shields.io/conda/dn/conda-forge/dpgen?label=conda%20install)](https://anaconda.org/conda-forge/dpgen)
1111
[![pip install](https://img.shields.io/pypi/dm/dpgen?label=pip%20install)](https://pypi.org/project/dpgen)
1212

13-
DP-GEN (Deep Potential GENerator) is a software written in Python, delicately designed to generate a deep learning based model of interatomic potential energy and force field. DP-GEN is dependent on [DeePMD-kit](https://github.com/deepmodeling/deepmd-kit/). With highly scalable interface with common softwares for molecular simulation, DP-GEN is capable to automatically prepare scripts and maintain job queues on HPC machines (High Performance Cluster) and analyze results.
13+
DP-GEN (Deep Potential GENerator) is a software written in Python, delicately designed to generate a deep learning based model of interatomic potential energy and force field. DP-GEN is dependent on [DeePMD-kit](https://github.com/deepmodeling/deepmd-kit/). With highly scalable interface with common softwares for molecular simulation, DP-GEN is capable to automatically prepare scripts and maintain job queues on HPC machines (High Performance Cluster) and analyze results.
1414

1515
If you use this software in any publication, please cite:
1616

1717
Yuzhi Zhang, Haidi Wang, Weijie Chen, Jinzhe Zeng, Linfeng Zhang, Han Wang, and Weinan E, DP-GEN: A concurrent learning platform for the generation of reliable deep learning based potential energy models, Computer Physics Communications, 2020, 253, 107206.
1818

1919
## Highlighted features
20-
+ **Accurate and efficient**: DP-GEN is capable to sample more than tens of million structures and select only a few for first principles calculation. DP-GEN will finally obtain a uniformly accurate model.
21-
+ **User-friendly and automatic**: Users may install and run DP-GEN easily. Once successfully running, DP-GEN can dispatch and handle all jobs on HPCs, and thus there's no need for any personal effort.
22-
+ **Highly scalable**: With modularized code structures, users and developers can easily extend DP-GEN for their most relevant needs. DP-GEN currently supports for HPC systems ([Slurm](https://slurm.schedmd.com/), [PBS](https://www.openpbs.org/), LSF and cloud machines), Deep Potential interface with DeePMD-kit, MD interface with [LAMMPS](https://www.lammps.org/), [Gromacs](http://www.gromacs.org/), [AMBER](https://ambermd.org/), Calypso and *ab-initio* calculation interface with [VASP](https://www.vasp.at/), [PWSCF](https://www.quantum-espresso.org/), [CP2K](https://www.cp2k.org/), [SIESTA](https://departments.icmab.es/leem/siesta/), [Gaussian](https://gaussian.com/), Abacus, [PWmat](http://www.pwmat.com/), etc. We're sincerely welcome and embraced to users' contributions, with more possibilities and cases to use DP-GEN.
20+
21+
- **Accurate and efficient**: DP-GEN is capable to sample more than tens of million structures and select only a few for first principles calculation. DP-GEN will finally obtain a uniformly accurate model.
22+
- **User-friendly and automatic**: Users may install and run DP-GEN easily. Once successfully running, DP-GEN can dispatch and handle all jobs on HPCs, and thus there's no need for any personal effort.
23+
- **Highly scalable**: With modularized code structures, users and developers can easily extend DP-GEN for their most relevant needs. DP-GEN currently supports for HPC systems ([Slurm](https://slurm.schedmd.com/), [PBS](https://www.openpbs.org/), LSF and cloud machines), Deep Potential interface with DeePMD-kit, MD interface with [LAMMPS](https://www.lammps.org/), [Gromacs](http://www.gromacs.org/), [AMBER](https://ambermd.org/), Calypso and *ab-initio* calculation interface with [VASP](https://www.vasp.at/), [PWSCF](https://www.quantum-espresso.org/), [CP2K](https://www.cp2k.org/), [SIESTA](https://departments.icmab.es/leem/siesta/), [Gaussian](https://gaussian.com/), Abacus, [PWmat](http://www.pwmat.com/), etc. We're sincerely welcome and embraced to users' contributions, with more possibilities and cases to use DP-GEN.
2324

2425
## Download and Install
2526

@@ -39,24 +40,25 @@ dpgen -h
3940

4041
DP-GEN contains the following workflows:
4142

42-
* [`dpgen run`](https://docs.deepmodeling.com/projects/dpgen/en/latest/run/): Main process of Deep Potential Generator.
43-
* [Init](https://docs.deepmodeling.com/projects/dpgen/en/latest/init/): Generating initial data.
44-
* `dpgen init_bulk`: Generating initial data for bulk systems.
45-
* `dpgen init_surf`: Generating initial data for surface systems.
46-
* `dpgen init_reaction`: Generating initial data for reactive systems.
47-
* [`dpgen simplify`](https://docs.deepmodeling.com/projects/dpgen/en/latest/simplify/): Reducing the amount of existing dataset.
48-
* [`dpgen autotest`](https://docs.deepmodeling.com/projects/dpgen/en/latest/autotest/): Autotest for Deep Potential.
43+
- [`dpgen run`](https://docs.deepmodeling.com/projects/dpgen/en/latest/run/): Main process of Deep Potential Generator.
44+
- [Init](https://docs.deepmodeling.com/projects/dpgen/en/latest/init/): Generating initial data.
45+
- `dpgen init_bulk`: Generating initial data for bulk systems.
46+
- `dpgen init_surf`: Generating initial data for surface systems.
47+
- `dpgen init_reaction`: Generating initial data for reactive systems.
48+
- [`dpgen simplify`](https://docs.deepmodeling.com/projects/dpgen/en/latest/simplify/): Reducing the amount of existing dataset.
49+
- [`dpgen autotest`](https://docs.deepmodeling.com/projects/dpgen/en/latest/autotest/): Autotest for Deep Potential.
4950

5051
For detailed usage and parameters, read [DP-GEN documentation](https://docs.deepmodeling.com/projects/dpgen/).
5152

5253
## Tutorials and examples
5354

54-
* [Tutorials](https://tutorials.deepmodeling.com/en/latest/Tutorials/DP-GEN/): basic tutorials for DP-GEN.
55-
* [Examples](examples): input files in [JSON](https://docs.python.org/3/library/json.html) format.
56-
* [Publications](https://blogs.deepmodeling.com/papers/dpgen/): Published research articles using DP-GEN.
57-
* [User guide](https://docs.deepmodeling.com/projects/dpgen/en/latest/user-guide/): frequently asked questions listed in troubleshooting.
55+
- [Tutorials](https://tutorials.deepmodeling.com/en/latest/Tutorials/DP-GEN/): basic tutorials for DP-GEN.
56+
- [Examples](examples): input files in [JSON](https://docs.python.org/3/library/json.html) format.
57+
- [Publications](https://blogs.deepmodeling.com/papers/dpgen/): Published research articles using DP-GEN.
58+
- [User guide](https://docs.deepmodeling.com/projects/dpgen/en/latest/user-guide/): frequently asked questions listed in troubleshooting.
5859

5960
## License
61+
6062
The project dpgen is licensed under [GNU LGPLv3.0](./LICENSE).
6163

6264
## Contributing

0 commit comments

Comments
 (0)