Skip to content

Commit

Permalink
Merge pull request #15 from stanfordbshan/dev
Browse files Browse the repository at this point in the history
HTMACat1.0.2更新
更新内容如下:
1.为了更好的反馈问题和提供建议,提供了issues模板
2.添加了SML标识各物种以SMILES形式读取
3.添加了workflow,实现每次push到master分支时都会自动编译wheel并发布到release
  • Loading branch information
wuyaos authored Mar 17, 2023
2 parents c7f7c67 + 760511d commit 8ebab80
Show file tree
Hide file tree
Showing 23 changed files with 334 additions and 103 deletions.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: 问题模板
about: 如发现Bug,请按此模板提交issues,不按模板提交的问题将直接关闭。提交问题务必描述清楚、附上日志,描述不清导致无法理解和分析的问题也可能会被直接关闭。
---

## 你使用的 HTMACat 是什么版本,什么环境?

> HTMACat 版本: x.x.x
>
> 环境: python x.x in windows or linux, install_requires
>
## 你遇到什么问题了?

> 描述一下你遇到的问题
## 是否已经浏览过Issues仍无法解决?

> 请搜索Issues列表、查看wiki跟TG公众号的更新说明,已经解释过的问题不要重复提问

## 你期望的结果

> 描述以下你期望的结果
## 给出程序界面截图、后台运行日志或配置文件

> 请提供截图及配置文件截图
> 其它问题提供后台日志
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: 功能需求模板
about: 如有新功能需要需要提交,请按此模板创建issues
---

## 你使用的 HTMACat 是什么版本,什么环境?

> HTMACat 版本: x.x.x
>
> 环境: python x.x in windows or linux, install_requires
>
## 你想要新增或者改进什么功能?

> 你想要新增或者改进什么功能?
## 这个功能有什么可以参考的资料吗?

> 这个功能有什么可以参考的资料吗?是否可以列举一些,不要引用同类但商业化软件的任何内容.
49 changes: 49 additions & 0 deletions .github/workflows/auto_gen_whl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Python package

on:
push:
branches:
- master
pull_request:
branches:
- master
types:
- ready_for_review
- review_requested

jobs:
build:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v2
- name: Publish Python Package
uses: actions/setup-python@v2
with:
python-version: 3.8
publish-package: true

- name: Build wheel and source distribution
run: |
cd src
pip install setuptools wheel
python setup.py sdist bdist_wheel
- name: Release version
id: release_version
run: |
cd src
app_version=$(cat setup.py | grep version | sed "s/version='\([0-9]\+\.[0-9]\+\.[0-9]\+\)',/\1/" | sed s/[[:space:]]//g)
echo "app_version=$app_version" >> $GITHUB_ENV
echo "app_version=$app_version"
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: src/dist/*.whl
tag: v${{env.app_version}}
release_name: v${{env.app_version}}
overwrite: true
file_glob: true
body: ${{github.event.head_commit.message}}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ wheels/
*.vasp
MANIFEST
script/
dist/
.vscode/

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down Expand Up @@ -99,4 +101,6 @@ venv.bak/
# mypy
.mypy_cache/

# custom
# custom
example/backup*
example/zjwang*
37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,23 @@ download the install script:[install_wheel.bat](https://raw.githubusercontent.co
```shell
./install_wheel.bat # Windows
./install_wheel.sh # linux
pip install HTMACat.whl # [download from releases](https://github.com/stanfordbshan/HTMACat-kit/releases/latest)
```
### 2) Manual installation

```shell
# windows
pip install ase numpy==1.23.5 scikit-learn
pip install https://raw.githubusercontent.com/stanfordbshan/HTMACat-kit/master/requires_wheel/FireWorks-2.0.3-py3-none-any.whl
pip install https://raw.githubusercontent.com/stanfordbshan/HTMACat-kit/master/requires_wheel/CatKit-0.5.4-py3-none-any.requires_wheel
for /f "tokens=1,* delims=:" %%A in ('curl -ks https://api.github.com/repos/stanfordbshan/HTMACat-kit/releases/latest ^| find "browser_download_url"') do (
pip install -U %%B
)

#linux
pip install ase numpy==1.23.5 scikit-learn
pip install https://raw.githubusercontent.com/stanfordbshan/HTMACat-kit/master/requires_wheel/FireWorks-2.0.3-py3-none-any.whl
pip install https://raw.githubusercontent.com/stanfordbshan/HTMACat-kit/master/requires_wheel/CatKit-0.5.4-py3-none-any.whl
pip install HTMACat.whl # [download from releases](https://github.com/stanfordbshan/HTMACat-kit/releases/latest)
pip install --upgrade $(curl -s https://api.github.com/repos/stanfordbshan/HTMACat-kit/releases/latest | grep "browser_download_url.*\.whl" | cut -d : -f 2,3 | tr -d \")
```
# Getting started
Expand All @@ -45,11 +54,11 @@ pip install HTMACat.whl # [download from releases](https://github.com/stanfordbs
```shell
Cu # Doping elements
0 1 1L 2 3 b1 # Doping type
H NH2 NO N2 N2O O2 H2O # Adsorption species
1 1 1 2 2 1 # Adsorption type
b1 # Doping type
SML C(=O)O # Adsorption species (SMILES of formic acid)
1 2 # Adsorption type
```
Where the first line of the file is the doping element and the second line is the doping type, 0 corresponds to no doping, 1, 2 and 3 correspond to surface layers doped with 1, 2 and 3 atoms, respectively, and 1L and b1 represent surface layer substitution and bulk equivalent proportional substitution. Users can modify the corresponding parameters to achieve customized modeling according to their research needs.
Where the first line of the file is the doping element and the second line is the doping type, 0 corresponds to no doping, 1, 2 and 3 correspond to surface layers doped with 1, 2 and 3 atoms, respectively, and 1L and b1 represent surface layer substitution and bulk equivalent proportional substitution. The third and fourth lines respectively represent the adsorbate species and the adsorption types. <b>Please note that the adsorbates should be declared by their SMILES expressions if the third line starts with 'SML'!</b> If no 'SML' at the beginning of this line, the species are represented in their chemical formula. <b>To avoid ambiguity, it is recommended that SMILES be used when declaring complex species.</b> Users can modify the corresponding parameters to achieve customized modeling according to their research needs.
(2) run script
Expand All @@ -63,11 +72,11 @@ pip install HTMACat.whl # [download from releases](https://github.com/stanfordbs
```shell
Cu # Doping elements
1 1L 2 3 # Doping type
NH2 H2O;NH H2O;N H2O;NH2 H;NH H;N H # Co-adsorption species
1 1;1 1;1 1;1 1;1 1;1 1 # Adsorption type
3 # Doping type
SML N [O];[NH2] [OH];[N] [N];[N] [O];[N] [N]=O # Co-adsorption species
1 1;1 1;1 1;1 1;1 1 # Adsorption type
```
The first line represents the dopant element, the second line represents the dopant type, the third and fourth lines respectively represent the co-adsorbate species and the co-adsorption type. Different co-adsorption combinations are separated by ";".
The first line represents the dopant element, the second line represents the dopant type, the third and fourth lines respectively represent the co-adsorbate species (also in SMILES format) and the co-adsorption type. Different co-adsorption combinations are separated by ";".
(2) run script
Expand All @@ -82,4 +91,10 @@ pip install HTMACat.whl # [download from releases](https://github.com/stanfordbs
* Jiaqiang Yang email:[jqyang_hust@hust.edu.cn](mailto:jqyang_hust@hust.edu.cn)
* Feifeng Wu email:[wufeifeng_hust@163.com](wufeifeng_hust@163.com)
* Bin Shan email:[bshan@mail.hust.edu.cn](bshan@mail.hust.edu.cn)
* Bin Shan email:[bshan@mail.hust.edu.cn](bshan@mail.hust.edu.cn)
# Links
* Materials Design and Nano-Manufacturing Center@HUST:http://www.materialssimulation.com/
4 changes: 4 additions & 0 deletions example/Formic_acid_ads-SML/Model
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Cu
b1
SML C(=O)O
1
File renamed without changes.
4 changes: 4 additions & 0 deletions example/Formic_acid_ads/Model
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Cu
b1
HCOOH
1
File renamed without changes.
4 changes: 4 additions & 0 deletions example/coads-SML/Model
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Cu
3
SML N [O];[NH2] [OH];[N] [N];[N] [O];[N] [N]=O
1 1;1 1;1 1;1 1;1 1
1 change: 1 addition & 0 deletions example/coads-SML/StrucInfo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Au fcc 4.16 111
File renamed without changes.
1 change: 1 addition & 0 deletions example/coads/StrucInfo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Au fcc 4.16 111
4 changes: 0 additions & 4 deletions example/single-adsorption/Model

This file was deleted.

5 changes: 4 additions & 1 deletion install_wheel.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
pip install ase numpy==1.23.5 scikit-learn
pip install https://raw.githubusercontent.com/stanfordbshan/HTMACat-kit/master/requires_wheel/FireWorks-2.0.3-py3-none-any.whl
pip install https://raw.githubusercontent.com/stanfordbshan/HTMACat-kit/master/requires_wheel/CatKit-0.5.4-py3-none-any.whl
pip install https://raw.githubusercontent.com/stanfordbshan/HTMACat-kit/master/requires_wheel/CatKit-0.5.4-py3-none-any.requires_wheel
for /f "tokens=1,* delims=:" %%A in ('curl -ks https://api.github.com/repos/stanfordbshan/HTMACat-kit/releases/latest ^| find "browser_download_url"') do (
pip install -U %%B
)
3 changes: 2 additions & 1 deletion install_wheel.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
pip install ase numpy==1.23.5 scikit-learn
pip install https://raw.githubusercontent.com/stanfordbshan/HTMACat-kit/master/requires_wheel/FireWorks-2.0.3-py3-none-any.whl
pip install https://raw.githubusercontent.com/stanfordbshan/HTMACat-kit/master/requires_wheel/CatKit-0.5.4-py3-none-any.whl
pip install https://raw.githubusercontent.com/stanfordbshan/HTMACat-kit/master/requires_wheel/CatKit-0.5.4-py3-none-any.whl
pip install --upgrade $(curl -s https://api.github.com/repos/stanfordbshan/HTMACat-kit/releases/latest | grep "browser_download_url.*\.whl" | cut -d : -f 2,3 | tr -d \")
12 changes: 0 additions & 12 deletions script/install.bat

This file was deleted.

13 changes: 0 additions & 13 deletions script/install.sh

This file was deleted.

30 changes: 18 additions & 12 deletions src/HTMACat/model/Construct_Coadsorption.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ def Construct_coadsorption(Path_Info,Model,spec_ads_stable):
Ele_dop=model.readline().split()
Natom_dop=model.readline().split()
Ads=model.readline().split(';')
SML = False
if 'SML' == Ads[0].split()[0]:
SML = True
Ads[0] = Ads[0][3:]
else:
pass
Index=model.readline().split(';')
model.close()
LatInfo = open(Path_Info,"r+")
Expand Down Expand Up @@ -41,11 +47,11 @@ def Construct_coadsorption(Path_Info,Model,spec_ads_stable):
ads=ads.strip()
ads_symb='_'.join(ads.split(' '))
if Index[k].strip() == '1 1':
slabs_ads=Construct_coadsorption_11(slabs,ads,dis_inter,spec_ads_stable)
slabs_ads=Construct_coadsorption_11(slabs,ads,dis_inter,spec_ads_stable,SML)
elif Index[k].strip() == '1 2':
slabs_ads=Construct_coadsorption_12(slabs,ads,dis_inter)
slabs_ads=Construct_coadsorption_12(slabs,ads,dis_inter,SML)
elif Index[k].strip() == '2 2':
slabs_ads=Construct_coadsorption_22(slabs,ads,dis_inter)
slabs_ads=Construct_coadsorption_22(slabs,ads,dis_inter,SML)
#view(slabs_ads)
for m,slab_ad in enumerate(slabs_ads):
#write_vasp("%s_%s_%s_%s_%s.vasp" %(mname,mfacet,natom_dop,ads_symb,m), slab_ad, direct=True, sort=[''], vasp5=True)
Expand All @@ -59,11 +65,11 @@ def Construct_coadsorption(Path_Info,Model,spec_ads_stable):
ads=ads.strip()
ads_symb='_'.join(ads.split(' '))
if Index[k].strip() == '1 1':
slabs_ads=Construct_coadsorption_11(slabs,ads,dis_inter,spec_ads_stable)
slabs_ads=Construct_coadsorption_11(slabs,ads,dis_inter,spec_ads_stable,SML)
elif Index[k].strip() == '1 2':
slabs_ads=Construct_coadsorption_12(slabs,ads,dis_inter)
slabs_ads=Construct_coadsorption_12(slabs,ads,dis_inter,SML)
elif Index[k].strip() == '2 2':
slabs_ads=Construct_coadsorption_22(slabs,ads,dis_inter)
slabs_ads=Construct_coadsorption_22(slabs,ads,dis_inter,SML)
for m,slab_ad in enumerate(slabs_ads):
write_vasp("%s_%s_%s_b1_%s.vasp" %(mname,mfacet,ads_symb,m), slab_ad, direct=True, sort=[''], vasp5=True)
print("%s %s adsorption on b1 doped systemare finished!" %(ads_symb,m+1))
Expand All @@ -76,11 +82,11 @@ def Construct_coadsorption(Path_Info,Model,spec_ads_stable):
ads=ads.strip()
ads_symb='_'.join(ads.split(' '))
if Index[k].strip() == '1 1':
slabs_ads=Construct_coadsorption_11(slabs_dop,ads,dis_inter,spec_ads_stable)
slabs_ads=Construct_coadsorption_11(slabs_dop,ads,dis_inter,spec_ads_stable,SML)
elif Index[k].strip() == '1 2':
slabs_ads=Construct_coadsorption_12(slabs_dop,ads,dis_inter)
slabs_ads=Construct_coadsorption_12(slabs_dop,ads,dis_inter,SML)
elif Index[k].strip() == '2 2':
slabs_ads=Construct_coadsorption_22(slabs_dop,ads,dis_inter)
slabs_ads=Construct_coadsorption_22(slabs_dop,ads,dis_inter,SML)
#view(slabs_ads)
for m,slab_ad in enumerate(slabs_ads):
write_vasp("%s_%s_%s_%s_%s_%s.vasp" %(mname,ele_dop,mfacet,natom_dop,ads_symb,m), slab_ad, direct=True, sort=[''], vasp5=True)
Expand All @@ -94,11 +100,11 @@ def Construct_coadsorption(Path_Info,Model,spec_ads_stable):
ads=ads.strip()
ads_symb='_'.join(ads.split(' '))
if Index[k].strip() == '1 1':
slabs_ads=Construct_coadsorption_11(slabs_dop,ads,dis_inter,spec_ads_stable)
slabs_ads=Construct_coadsorption_11(slabs_dop,ads,dis_inter,spec_ads_stable,SML)
elif Index[k].strip() == '1 2':
slabs_ads=Construct_coadsorption_12(slabs_dop,ads,dis_inter)
slabs_ads=Construct_coadsorption_12(slabs_dop,ads,dis_inter,SML)
elif Index[k].strip() == '2 2':
slabs_ads=Construct_coadsorption_22(slabs_dop,ads,dis_inter)
slabs_ads=Construct_coadsorption_22(slabs_dop,ads,dis_inter,SML)
## To choose the config whose neighbor list includes the doped atoms
slabs_ads_near=[]
for slb in slabs_ads:
Expand Down
Loading

0 comments on commit 8ebab80

Please sign in to comment.