Skip to content

Commit 64d7e62

Browse files
kirk0830mohanchen
andauthored
Feature: ABACUS light-weight ASE plugin implementation (#6950)
* Feature: abacus light-weight ase plugin * preparing the examples of MD and MTD * feat: 添加ABACUS v3.9.0.x版本支持并完善测试 fix(io): 移除legacyio.py中已弃用的read_istate函数 test: 添加xtest.sh测试脚本和测试文件 ci: 配置GitHub Actions工作流实现自动化测试 docs: 更新示例脚本包括DOS计算、约束MD、MTD和常规MD refactor(core): 清理未完成的restart测试代码 style: 统一文件格式和代码风格 * test: 注释掉测试中删除eig_occ.txt的代码 * test(abacuslite): 添加从running_log读取电子求解器类型和能带的测试 添加测试用例验证从running_log文件中正确读取电子求解器类型和能带信息。同时包含对轨迹、力和应力读取功能的测试。 * test: 更新测试用例以使用新的MD_dump示例文件 修改测试文件路径和预期值以匹配新的测试数据文件nspin4-gamma-mddump,该文件包含2帧数据而非原来的11帧,且alat_in_angstrom值不同 * test(abacuslite): 修复测试方法命名并添加缺失的测试断言 修复测试方法命名错误,将read_*改为test_read_*以正确执行测试 添加对轨迹、力和应力读取功能的详细测试断言 更新应力测试以匹配实际单位转换逻辑 * test(abacuslite): 为TestLatestIO添加原子和k点类型检查 添加对读取结果中原子和k点类型的断言检查,确保返回的Atoms对象及其计算器属性类型正确 * fix(io): 修正测试脚本和IO模块中的问题 - 在xtest.sh中添加set -e以确保错误时退出 - 修复generalio.py中的类型提示和路径处理 - 更新legacyio.py以支持非共线磁矩读取 - 添加新的测试文件并更新测试用例 - 修正KPT文件读写逻辑 * feat(tests): 添加新的测试脚本和更新现有测试 refactor(core): 重构核心测试用例,使用临时目录并简化测试逻辑 feat(ksampling): 添加k路径生成功能,集成seekpath库 docs(examples): 更新带结构示例,引用seekpath并简化代码 * Fix the workflow configuration * ci(workflow): configure, build and install ABACUS * ci(workflow): change the image name * ci(workflow): create soft link from abacus_2p to abacus * update or delete the reference values * fix the integration test case of band * recover the calculation of scf integration test * add indent for the check on bandstructure.json file * Explicitly restrict the possible type of esolver_type to ksdft * fix the inconsistency of atom order between ase and abacus * remove the neb example temporarily * recover the neb.py example * Move files to the interfaces/ASE_interface directory --------- Co-authored-by: Mohan Chen <mohanchen@pku.edu.cn>
1 parent 9dcaae1 commit 64d7e62

38 files changed

+7402
-1
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Atomic Simulation Environment (ASE) Plugin Test
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
test:
8+
name: abacuslite
9+
runs-on: ubuntu-latest
10+
container:
11+
image: ghcr.io/deepmodeling/abacus-gnu
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Miniconda
18+
uses: conda-incubator/setup-miniconda@v3
19+
with:
20+
miniconda-version: 'latest'
21+
activate-environment: abacuslite
22+
python-version: '3.10'
23+
24+
- name: Install dependencies
25+
shell: bash -l {0}
26+
run: |
27+
conda install -y pip
28+
pip install numpy scipy matplotlib
29+
30+
- name: Install abacuslite
31+
shell: bash -l {0}
32+
run: |
33+
cd interfaces/ASE_interface
34+
pip install .
35+
36+
- name: Configure & Build ABACUS (GNU)
37+
run: |
38+
git config --global --add safe.directory `pwd`
39+
export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${SUPERLU32_DIST_ROOT}/lib:${PEXSI32_ROOT}/lib:${LD_LIBRARY_PATH}
40+
export PKG_CONFIG_PATH=${GKLIB_ROOT}/lib/pkgconfig:${METIS32_ROOT}/lib/pkgconfig:${PARMETIS32_ROOT}/lib/pkgconfig:${SUPERLU32_DIST_ROOT}/lib/pkgconfig:${PEXSI32_ROOT}/lib/pkgconfig:${PKG_CONFIG_PATH}
41+
export CPATH=${GKLIB_ROOT}/include:${METIS32_ROOT}/include:${PARMETIS32_ROOT}/include:${SUPERLU32_DIST_ROOT}/include:${PEXSI32_ROOT}/include:${CPATH}
42+
export CMAKE_PREFIX_PATH=${PEXSI32_ROOT}:${SUPERLU_DIST32_ROOT}:${PARMETIS32_ROOT}:${METIS32_ROOT}:${GKLIB_ROOT}:${CMAKE_PREFIX_PATH}
43+
rm -rf build
44+
cmake -B build
45+
cmake --build build -j2
46+
47+
- name: Install and Soft Link ABACUS
48+
run: |
49+
cmake --install build
50+
if [ -f /usr/local/bin/abacus_2p ]; then
51+
ln -sf /usr/local/bin/abacus_2p /usr/local/bin/abacus
52+
fi
53+
54+
- name: Run unit tests
55+
shell: bash -l {0}
56+
run: |
57+
cd interfaces/ASE_interface/abacuslite
58+
chmod +x xtest.sh
59+
./xtest.sh
60+
61+
- name: Run integration tests
62+
shell: bash -l {0}
63+
run: |
64+
cd interfaces/ASE_interface/tests
65+
chmod +x xtest.sh
66+
./xtest.sh

interfaces/ASE_interface/README

Lines changed: 0 additions & 1 deletion
This file was deleted.

interfaces/ASE_interface/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# abacuslite
2+
3+
## Introduction
4+
5+
abacuslite is a lightweight plugin for ABACUS (Atomic-orbital Based Ab-initio Computation at UStc), implementing the ASE (Atomic Simulation Environment) calculator interface.
6+
7+
### Key Features
8+
9+
- **Lightweight Design**: Implemented as a plugin, no need to modify ASE core code
10+
- **Version Compatibility**: No longer restricted to specific ASE versions, works with most ASE versions
11+
- **ASE Integration**: Uses ASE as the running platform, making ABACUS a callable calculator within it
12+
- **Function Support**: Currently only supports SCF (Self-Consistent Field) functionality, returning energy, forces, stress, etc.
13+
14+
## Installation
15+
16+
Installation is very simple, just execute the following command in the project root directory:
17+
18+
```bash
19+
pip install .
20+
```
21+
22+
## Usage Examples
23+
24+
Please refer to the example scripts in the `examples` folder. Recommended learning path:
25+
26+
1. **scf.py** - Basic SCF calculation example
27+
2. **relax.py** - Atomic position relaxation calculation
28+
3. **cellrelax.py** - Cell parameter relaxation calculation
29+
4. **bandstructure.py** - Band structure calculation
30+
5. **dos.py** - Density of states calculation
31+
6. **md.py** - Molecular dynamics simulation
32+
7. **constraintmd.py** - Constrained molecular dynamics simulation
33+
8. **metadynamics.py** - Metadynamics simulation
34+
35+
More usage examples will be provided in future versions.
36+
37+
## Authors
38+
39+
- Yuyang Ji
40+
- Zhenxiong Shen
41+
- Yike Huang
42+
- Zhaoqing Liu
43+
44+
## Acknowledgments
45+
46+
Thanks to the ABACUS development team for their support and contributions.
47+
48+
## License
49+
50+
[Fill in according to the actual project license]
51+
52+
## Contact
53+
54+
If you have any questions or suggestions, please contact us through:
55+
56+
- GitHub: [deepmodeling/abacus-develop](https://github.com/deepmodeling/abacus-develop)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'''
2+
interfaces to Atomic-orbital Based Ab-initio Computation at UStc (ABACUS),
3+
for more information about this DFT calculator,
4+
please refer to the Github official repository:
5+
https://github.com/deepmodeling/abacus-develop
6+
and online-manual:
7+
https://abacus.deepmodeling.com/en/latest/index.html
8+
9+
For a more complete ABACUS pre-/post-processing workflow package,
10+
please refer to the ABACUSTest package:
11+
https://github.com/pxlxingliang/abacus-test
12+
'''
13+
from .core import *

0 commit comments

Comments
 (0)