Skip to content

Commit 4be4f6d

Browse files
authored
Merge devel to master (#1161)
2 parents 355f8ed + 8453131 commit 4be4f6d

File tree

355 files changed

+18655
-21551
lines changed

Some content is hidden

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

355 files changed

+18655
-21551
lines changed

.github/ISSUE_TEMPLATE/request-for-help.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Before asking questions, you can
1313
search the previous issues or discussions
1414
check [Manual](https://github.com/deepmodeling/dpgen).
1515

16-
Please **do not** post requests for help (e.g. with installing or using dpgen) here.
16+
Please **do not** post requests for help (e.g. with installing or using dpgen) here.
1717
Instead go to [discussions](https://github.com/deepmodeling/dpgen/discussions).
1818

1919
This issue tracker is for tracking dpgen development related issues only.

.github/workflows/test.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ jobs:
1010
strategy:
1111
matrix:
1212
python-version: [3.8, 3.9]
13-
PYMATGEN_VERSION: [2022.7.19]
1413

1514
steps:
1615
- uses: actions/checkout@v2
@@ -19,12 +18,16 @@ jobs:
1918
with:
2019
python-version: ${{ matrix.python-version }}
2120
- name: Install dependencies
22-
run: pip install coverage pymatgen==${{ matrix.PYMATGEN_VERSION }} -e .
21+
run: pip install coverage git+https://github.com/materialsproject/pymatgen@b56698019098247ff54f50997a67c562b4375fc3 -e .
2322
- name: Test
2423
run: coverage run --source=./dpgen -m unittest -v && coverage report
2524
- uses: codecov/codecov-action@v3
2625
pass:
2726
needs: [build]
2827
runs-on: ubuntu-latest
28+
if: always()
2929
steps:
30-
- run: echo "All jobs passed"
30+
- name: Decide whether the needed jobs succeeded or failed
31+
uses: re-actors/alls-green@release/v1
32+
with:
33+
jobs: ${{ toJSON(needs) }}

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,3 @@ dbconfig.json
4242
_build
4343
tests/generator/calypso_test_path
4444
doc/api/
45-

.pre-commit-config.yaml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.4.0
6+
hooks:
7+
# there are many log files in tests
8+
# TODO: seperate py files and log files
9+
- id: trailing-whitespace
10+
exclude: "^tests/.*$"
11+
- id: end-of-file-fixer
12+
exclude: "^tests/.*$"
13+
- id: check-yaml
14+
exclude: "^conda/.*$"
15+
#- id: check-json
16+
- id: check-added-large-files
17+
- id: check-merge-conflict
18+
- id: check-symlinks
19+
exclude: "^tests/tools/run_report_test_output/.*$"
20+
- id: check-toml
21+
# Python
22+
- repo: https://github.com/psf/black
23+
rev: 22.12.0
24+
hooks:
25+
- id: black-jupyter
26+
- repo: https://github.com/charliermarsh/ruff-pre-commit
27+
rev: v0.0.253
28+
hooks:
29+
- id: ruff
30+
args: ["--fix"]
31+
# numpydoc
32+
- repo: https://github.com/Carreau/velin
33+
rev: 0.0.12
34+
hooks:
35+
- id: velin
36+
args: ["--write"]
37+
ci:
38+
autoupdate_branch: devel

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
![logo](./doc/logo.svg)
2+
3+
--------------------------------------------------------------------------------
4+
15
# DP-GEN: A concurrent learning platform for the generation of reliable deep learning based potential energy models
26

37
[![GitHub release](https://img.shields.io/github/release/deepmodeling/dpgen.svg?maxAge=86400)](https://github.com/deepmodeling/dpgen/releases/)
48
[![doi:10.1016/j.cpc.2020.107206](https://img.shields.io/badge/DOI-10.1016%2Fj.cpc.2020.107206-blue)](https://doi.org/10.1016/j.cpc.2020.107206)
5-
![Citations](https://citations.njzjz.win/10.1016/j.cpc.2020.107206)
9+
[![Citations](https://citations.njzjz.win/10.1016/j.cpc.2020.107206)](https://badge.dimensions.ai/details/doi/10.1016/j.cpc.2020.107206)
610
[![conda install](https://img.shields.io/conda/dn/conda-forge/dpgen?label=conda%20install)](https://anaconda.org/conda-forge/dpgen)
711
[![pip install](https://img.shields.io/pypi/dm/dpgen?label=pip%20install)](https://pypi.org/project/dpgen)
812

codecov.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ignore:
2+
- "tests"
3+
coverage:
4+
status:
5+
project:
6+
default:
7+
threshold: 100%
8+
patch:
9+
default:
10+
threshold: 100%

conda/conda_build_config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
channel_sources:
1+
channel_sources:
22
- defaults
33
- conda-forge
4-
channel_targets:
4+
channel_targets:
55
- deepmodeling

conda/construct.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ channels:
1111
specs:
1212
- python 3.8
1313
- pip
14-
- dpgen {{ version }}
14+
- dpgen {{ version }}
1515

1616
ignore_duplicate_files: True
1717

doc/autotest/Auto-test.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ If, for some reasons, the main program terminated at stage `run`, one can easily
1515
`relax.json` is the parameter file. An example for `deepmd` relaxation is given as:
1616
```json
1717
{
18-
"structures": "confs/mp-*",
18+
"structures": ["confs/mp-*"],
1919
"interaction": {
2020
"type": "deepmd",
2121
"model": "frozen_model.pb",
@@ -30,8 +30,8 @@ where the key `structures` provides the structures to relax. `interaction` is pr
3030
### Task type
3131
There are now six task types implemented in the package: `vasp`, `abacus`, `deepmd`, `meam`, `eam_fs`, and `eam_alloy`. An `inter.json` file in json format containing the interaction parameters will be written in the directory of each task after `make`. We give input examples of the `interaction` part for each type below:
3232

33-
**VASP**:
34-
33+
**VASP**:
34+
3535
The default of `potcar_prefix` is "".
3636
```json
3737
"interaction": {
@@ -41,8 +41,8 @@ The default of `potcar_prefix` is "".
4141
"potcars": {"Al": "POTCAR.al", "Mg": "POTCAR.mg"}
4242
}
4343
```
44-
**ABACUS**:
45-
44+
**ABACUS**:
45+
4646
The default of `potcar_prefix` is "". The path of potcars/orb_files/deepks_desc is `potcar_prefix` + `potcars`/`orb_files`/`deepks_desc`.
4747
```json
4848
"interaction": {
@@ -62,7 +62,7 @@ The default of `potcar_prefix` is "". The path of potcars/orb_files/deepks_desc
6262
```json
6363
"interaction": {
6464
"type": "deepmd",
65-
"model": "frozen_model.pb",
65+
"model": "frozen_model.pb",
6666
"type_map": {"Al": 0, "Mg": 1}
6767
}
6868
```
@@ -81,8 +81,8 @@ Please make sure the [USER-MEAMC package](https://lammps.sandia.gov/doc/Packages
8181
Please make sure the [MANYBODY package](https://lammps.sandia.gov/doc/Packages_details.html#pkg-manybody) has already been installed in LAMMPS
8282
```json
8383
"interaction": {
84-
"type": "eam_fs (eam_alloy)",
85-
"model": "AlMg.eam.fs (AlMg.eam.alloy)",
84+
"type": "eam_fs (eam_alloy)",
85+
"model": "AlMg.eam.fs (AlMg.eam.alloy)",
8686
"type_map": {"Al": 1, "Mg": 2}
8787
}
8888
```
@@ -96,9 +96,9 @@ Now the supported property types are `eos`, `elastic`, `vacancy`, `interstitial`
9696
There are three operations in auto test package, namely `make`, `run`, and `post`. Here we take `eos` property as an example for property type.
9797

9898
### Make
99-
The `INCAR`, `POSCAR`, `POTCAR` input files for VASP or `in.lammps`, `conf.lmp`, and the interatomic potential files for LAMMPS will be generated in the directory `confs/mp-*/relaxation/relax_task` for relaxation or `confs/mp-*/eos_00/task.[0-9]*[0-9]` for EOS. The `machine.json` file is not needed for `make`. Example:
99+
The `INCAR`, `POSCAR`, `POTCAR` input files for VASP or `in.lammps`, `conf.lmp`, and the interatomic potential files for LAMMPS will be generated in the directory `confs/mp-*/relaxation/relax_task` for relaxation or `confs/mp-*/eos_00/task.[0-9]*[0-9]` for EOS. The `machine.json` file is not needed for `make`. Example:
100100
```bash
101-
dpgen autotest make relaxation.json
101+
dpgen autotest make relaxation.json
102102
```
103103

104104
### Run
@@ -110,5 +110,5 @@ dpgen autotest run relaxation.json machine.json
110110
### Post
111111
The post process of calculation results would be performed. `result.json` in json format will be generated in `confs/mp-*/relaxation/relax_task` for relaxation and `result.json` in json format and `result.out` in txt format in `confs/mp-*/eos_00` for EOS. The `machine.json` file is also not needed for `post`. Example:
112112
```bash
113-
dpgen autotest post relaxation.json
113+
dpgen autotest post relaxation.json
114114
```

doc/autotest/index.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ Auto test
99
:caption: Guidelines
1010

1111
Auto-test
12-
12+
1313
.. _Main-components::
1414

1515
.. toctree::
1616
:maxdepth: 2
1717
:caption: Main components
18-
18+
1919
Task-type
2020
Property-type
2121
Make-run-and-post
@@ -25,7 +25,7 @@ Auto test
2525
.. toctree::
2626
:maxdepth: 2
2727
:caption: Structure relaxation
28-
28+
2929
relaxation/index.rst
3030

3131
.. _Property::
@@ -41,13 +41,13 @@ Auto test
4141
.. toctree::
4242
:maxdepth: 2
4343
:caption: Refine
44-
44+
4545
refine/index.rst
4646

4747
.. _Reproduce::
4848

4949
.. toctree::
5050
:maxdepth: 2
5151
:caption: Reproduce
52-
52+
5353
reproduce/index.rst

doc/autotest/property/Property-get-started-and-input-examples.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Key words | data structure | example | description
6161
**type** | String | "eos" | property type
6262
skip | Boolean | true | whether to skip current property or not
6363
start_confs_path | String | "../vasp/confs" | start from the equilibrium configuration in other path only for the current property type
64-
cal_setting["input_prop"] | String | "lammps_input/lammps_high" |input commands file
64+
cal_setting["input_prop"] | String | "lammps_input/lammps_high" |input commands file
6565
cal_setting["overwrite_interaction"] | Dict | | overwrite the interaction in the `interaction` part only for the current property type
6666

6767
other parameters in `cal_setting` and `cal_type` in `relaxation` also apply in `property`.
@@ -116,4 +116,4 @@ Key words | data structure | example | description
116116
supercell_size | List of Int | [1,1,10] | the supercell to be constructed, default = [1,1,5]
117117
min_vacuum_size | Int or Float | 10 | minimum size of vacuum width, default = 20
118118
add_fix | List of String | ['true','true','false'] | whether to fix atoms in the direction, default = ['true','true','false'] (standard method)
119-
n_steps | Int | 20 | Number of points for gamma-line calculation, default = 10
119+
n_steps | Int | 20 | Number of points for gamma-line calculation, default = 10

doc/autotest/property/Property-post.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ Use command
44
```bash
55
dpgen autotest post property.json
66
```
7-
to post results as `result.json` and `result.out` in each property's path.
7+
to post results as `result.json` and `result.out` in each property's path.

doc/autotest/property/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ Property
99
Property-make
1010
Property-run
1111
Property-post
12-
properties/index.rst
12+
properties/index.rst
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
## EOS make
22

3-
**Step 1.** Before `make` in EOS, the equilibrium configuration `CONTCAR` must be present in `confs/mp-*/relaxation`.
3+
**Step 1.** Before `make` in EOS, the equilibrium configuration `CONTCAR` must be present in `confs/mp-*/relaxation`.
44

5-
**Step 2.** For the input example in the previous section, when we do `make`, 40 tasks would be generated as `confs/mp-*/eos_00/task.000000, confs/mp-*/eos_00/task.000001, ... , confs/mp-*/eos_00/task.000039`. The suffix `00` is used for possible `refine` later.
5+
**Step 2.** For the input example in the previous section, when we do `make`, 40 tasks would be generated as `confs/mp-*/eos_00/task.000000, confs/mp-*/eos_00/task.000001, ... , confs/mp-*/eos_00/task.000039`. The suffix `00` is used for possible `refine` later.
66

7-
**Step 3.** If the task directory, for example `confs/mp-*/eos_00/task.000000` is not empty, the old input files in it including `INCAR`, `POSCAR`, `POTCAR`, `conf.lmp`, `in.lammps` would be deleted.
7+
**Step 3.** If the task directory, for example `confs/mp-*/eos_00/task.000000` is not empty, the old input files in it including `INCAR`, `POSCAR`, `POTCAR`, `conf.lmp`, `in.lammps` would be deleted.
88

99
**Step 4.** In each task directory, `POSCAR.orig` would link to `confs/mp-*/relaxation/CONTCAR`. Then the `scale` parameter can be calculated as:
1010

@@ -14,4 +14,4 @@ scale = (vol_current / vol_equi) ** (1. / 3.)
1414

1515
`vol_current` is the corresponding volume per atom of the current task and `vol_equi` is the volume per atom of the equilibrium configuration. Then the `poscar_scale` function in `dpgen.auto_test.lib.vasp` module would help to generate `POSCAR` file with `vol_current` in `confs/mp-*/eos_00/task.[0-9]*[0-9]`.
1616

17-
**Step 5.** According to the task type, the input file including `INCAR`, `POTCAR` or `conf.lmp`, `in.lammps` would be written in every `confs/mp-*/eos_00/task.[0-9]*[0-9]`.
17+
**Step 5.** According to the task type, the input file including `INCAR`, `POTCAR` or `conf.lmp`, `in.lammps` would be written in every `confs/mp-*/eos_00/task.[0-9]*[0-9]`.

doc/autotest/property/properties/EOS-post.md

-2
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,3 @@ onf_dir: /root/auto_test_example/deepmd/confs/std-fcc/eos_00
3131
... ...
3232
17.935 -3.7088
3333
```
34-
35-

doc/autotest/property/properties/Interstitial-make.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
**Step 2.** If `refine` is `True`, we do [refine process](../../refine/Refine-get-started-and-input-examples). If `reprod-opt` is `True` (the default is **False**), we do [reproduce process](../../reproduce/Reproduce-get-started-and-input-examples). Else, the vacancy structure (`POSCAR`) and supercell information (`supercell.out`) are written in the task directory, for example, in `confs/mp-*/interstitial_00/task.000000` with the check and possible removing of the old input files like before.
66

7-
**Step 3.** In `interstitial` by VASP, `ISIF = 3`. In `interstitial` by LAMMPS, the same `in.lammps` as that in [EOS (change_box is True)](./EOS-make) would be generated with `scale` set to one.
7+
**Step 3.** In `interstitial` by VASP, `ISIF = 3`. In `interstitial` by LAMMPS, the same `in.lammps` as that in [EOS (change_box is True)](./EOS-make) would be generated with `scale` set to one.

doc/autotest/property/properties/Interstitial-post.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Interstitial post
22

3-
For `Interstitial`, we need to calculate the energy difference between a crystal structure with and without atom added in.
3+
For `Interstitial`, we need to calculate the energy difference between a crystal structure with and without atom added in.
44
The examples of the output files `result.json` in json format and `result.out` in txt format are given below.
55

66
#### result.json

doc/autotest/property/properties/Surface-get-started-and-input-examples.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Surface get started and input examples
22

3-
`Surface` calculates the surface energy. We need to give the information of `min_slab_size`, `min_vacuum_size`, `max_miller` (default value is 2), and `pert_xz` which means perturbations in xz and will help work around vasp bug.
3+
`Surface` calculates the surface energy. We need to give the information of `min_slab_size`, `min_vacuum_size`, `max_miller` (default value is 2), and `pert_xz` which means perturbations in xz and will help work around vasp bug.
44

55
#### An example of the input file for Surface by deepmd:
66

@@ -18,7 +18,7 @@
1818
"min_slab_size": 10,
1919
"min_vacuum_size":11,
2020
"max_miller": 2,
21-
"cal_type": "static"
21+
"cal_type": "static"
2222
}
2323
]
2424
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## Surface make
22

3-
**Step 1.** Based on the equilibrium configuration, `generate_all_slabs` module in [pymatgen.core.surface](https://pymatgen.org/pymatgen.core.surface.html) would help to generate surface structure list with using `max_miller`, `min_slab_size`, and `min_vacuum_size` parameters.
3+
**Step 1.** Based on the equilibrium configuration, `generate_all_slabs` module in [pymatgen.core.surface](https://pymatgen.org/pymatgen.core.surface.html) would help to generate surface structure list with using `max_miller`, `min_slab_size`, and `min_vacuum_size` parameters.
44

55
**Step 2.** If `refine` is True, we do [refine process](../../refine/Refine-get-started-and-input-examples). If `reprod-opt` is True (the default is False), we do [reproduce process](../../reproduce/Reproduce-get-started-and-input-examples). Otherwise, the surface structure (`POSCAR`) with perturbations in xz and miller index information (`miller.out`) are written in the task directory, for example, in `confs/mp-*/interstitial_00/task.000000` with the check and possible removing of the old input files like before.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Vacancy make
22

3-
**Step 1.** The `VacancyGenerator` module in [pymatgen.analysis.defects.generators](https://pymatgen.org/pymatgen.analysis.defects.generators.html) is used to generate a set of structures with vacancy.
3+
**Step 1.** The `VacancyGenerator` module in [pymatgen.analysis.defects.generators](https://pymatgen.org/pymatgen.analysis.defects.generators.html) is used to generate a set of structures with vacancy.
44

55
**Step 2.** If there are `init_from_suffix` and `output_suffix` parameter in the `properties` part, the [refine process](../../refine/Refine-get-started-and-input-examples) follows. If reproduce is evoked, the [reproduce process](../../reproduce/Reproduce-get-started-and-input-examples) follows. Otherwise, the vacancy structure (`POSCAR`) and supercell information (`supercell.out`) are written in the task directory, for example, in `confs/mp-*/vacancy_00/task.000000` with the check and possible removing of the old input files like before.
66

7-
**Step 3.** When doing `vacancy` by VASP, `ISIF = 3`. When doing `vacancy` by LAMMPS, the same `in.lammps` as that in [EOS (change_box is True)](./EOS-make) would be generated with `scale` set to one.
7+
**Step 3.** When doing `vacancy` by VASP, `ISIF = 3`. When doing `vacancy` by LAMMPS, the same `in.lammps` as that in [EOS (change_box is True)](./EOS-make) would be generated with `scale` set to one.

doc/autotest/property/properties/Vacancy-post.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Vacancy post
22

3-
For `Vacancy`, we need to calculate the energy difference between a crystal structure with and without a vacancy.
3+
For `Vacancy`, we need to calculate the energy difference between a crystal structure with and without a vacancy.
44
The examples of the output files `result.json` in json format and `result.out` in txt format are given below.
55

66
#### result.json

doc/autotest/property/properties/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ Properties
2424
Surface-get-started-and-input-examples
2525
Surface-make
2626
Surface-run
27-
Surface-post
27+
Surface-post

doc/autotest/refine/Refine-get-started-and-input-examples.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Refine get started and input examples
22

3-
Sometimes we want to refine the calculation of a property from previous results. For example, when higher convergence criteria `EDIFF` and `EDIFFG` are necessary in VASP, the new VASP calculation is desired to start from the previous output configuration, rather than starting from scratch.
3+
Sometimes we want to refine the calculation of a property from previous results. For example, when higher convergence criteria `EDIFF` and `EDIFFG` are necessary in VASP, the new VASP calculation is desired to start from the previous output configuration, rather than starting from scratch.
44

55

66
An example of the input file `refine.json` is given below:

doc/autotest/refine/index.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Refine
44

55
.. toctree::
66
:maxdepth: 2
7-
7+
88
Refine-get-started-and-input-examples
99
Refine-make
1010
Refine-run
11-
Refine-post
11+
Refine-post

doc/autotest/relaxation/Relaxation-get-started-and-input-examples.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Relaxation get started and input examples
22

3-
The relaxation of a structure should be carried out before calculating all other properties.
3+
The relaxation of a structure should be carried out before calculating all other properties.
44

5-
First, we need input parameter file and we name it `relax.json` here. All the relaxation calculations should be taken either by `VASP`, `ABACUS`, or `LAMMPS`. Here are two input examples for `VASP` and `LAMMPS` respectively.
5+
First, we need input parameter file and we name it `relax.json` here. All the relaxation calculations should be taken either by `VASP`, `ABACUS`, or `LAMMPS`. Here are two input examples for `VASP` and `LAMMPS` respectively.
66

77
An example of the input file for relaxation by VASP:
88

@@ -81,5 +81,3 @@ maxiter | Int | 5000 | max iterations of minimizer
8181
maxeval | Int | 500000 | max number of force/energy evaluations
8282

8383
For LAMMPS relaxation and all the property calculations, **package will help to generate `in.lammps` file for user automatically** according to the property type. We can also make the final changes in the `minimize` setting (`minimize etol ftol maxiter maxeval`) in `in.lammps`. In addition, users can apply the input file for lammps commands in the `interaction` part. For further information of the LAMMPS relaxation, we refer users to [minimize command](https://lammps.sandia.gov/doc/minimize.html).
84-
85-

doc/autotest/relaxation/Relaxation-make.md

-4
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,3 @@ print "Final Stress (xx yy zz xy xz yz) = ${Pxx} ${Pyy} ${Pzz} ${Pxy} ${Pxz} ${P
9696
If user provides lammps input command file `in.lammps`, the `thermo_style` and `dump` commands should be the same as the above file.
9797

9898
**interatomic potential model**: the `frozen_model.pb` in `confs/mp-*/relaxation` would link to the `frozen_model.pb` file given in the input.
99-
100-
101-
102-

0 commit comments

Comments
 (0)