Skip to content

Commit

Permalink
Merge devel to master (#1161)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnguseZhang authored Mar 21, 2023
2 parents 355f8ed + 8453131 commit 4be4f6d
Show file tree
Hide file tree
Showing 355 changed files with 18,655 additions and 21,551 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/request-for-help.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Before asking questions, you can
search the previous issues or discussions
check [Manual](https://github.com/deepmodeling/dpgen).

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

This issue tracker is for tracking dpgen development related issues only.
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
strategy:
matrix:
python-version: [3.8, 3.9]
PYMATGEN_VERSION: [2022.7.19]

steps:
- uses: actions/checkout@v2
Expand All @@ -19,12 +18,16 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install coverage pymatgen==${{ matrix.PYMATGEN_VERSION }} -e .
run: pip install coverage git+https://github.com/materialsproject/pymatgen@b56698019098247ff54f50997a67c562b4375fc3 -e .
- name: Test
run: coverage run --source=./dpgen -m unittest -v && coverage report
- uses: codecov/codecov-action@v3
pass:
needs: [build]
runs-on: ubuntu-latest
if: always()
steps:
- run: echo "All jobs passed"
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,3 @@ dbconfig.json
_build
tests/generator/calypso_test_path
doc/api/

38 changes: 38 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
# there are many log files in tests
# TODO: seperate py files and log files
- id: trailing-whitespace
exclude: "^tests/.*$"
- id: end-of-file-fixer
exclude: "^tests/.*$"
- id: check-yaml
exclude: "^conda/.*$"
#- id: check-json
- id: check-added-large-files
- id: check-merge-conflict
- id: check-symlinks
exclude: "^tests/tools/run_report_test_output/.*$"
- id: check-toml
# Python
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black-jupyter
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.253
hooks:
- id: ruff
args: ["--fix"]
# numpydoc
- repo: https://github.com/Carreau/velin
rev: 0.0.12
hooks:
- id: velin
args: ["--write"]
ci:
autoupdate_branch: devel
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
![logo](./doc/logo.svg)

--------------------------------------------------------------------------------

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

[![GitHub release](https://img.shields.io/github/release/deepmodeling/dpgen.svg?maxAge=86400)](https://github.com/deepmodeling/dpgen/releases/)
[![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)
![Citations](https://citations.njzjz.win/10.1016/j.cpc.2020.107206)
[![Citations](https://citations.njzjz.win/10.1016/j.cpc.2020.107206)](https://badge.dimensions.ai/details/doi/10.1016/j.cpc.2020.107206)
[![conda install](https://img.shields.io/conda/dn/conda-forge/dpgen?label=conda%20install)](https://anaconda.org/conda-forge/dpgen)
[![pip install](https://img.shields.io/pypi/dm/dpgen?label=pip%20install)](https://pypi.org/project/dpgen)

Expand Down
10 changes: 10 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ignore:
- "tests"
coverage:
status:
project:
default:
threshold: 100%
patch:
default:
threshold: 100%
4 changes: 2 additions & 2 deletions conda/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
channel_sources:
channel_sources:
- defaults
- conda-forge
channel_targets:
channel_targets:
- deepmodeling
2 changes: 1 addition & 1 deletion conda/construct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ channels:
specs:
- python 3.8
- pip
- dpgen {{ version }}
- dpgen {{ version }}

ignore_duplicate_files: True

Expand Down
22 changes: 11 additions & 11 deletions doc/autotest/Auto-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If, for some reasons, the main program terminated at stage `run`, one can easily
`relax.json` is the parameter file. An example for `deepmd` relaxation is given as:
```json
{
"structures": "confs/mp-*",
"structures": ["confs/mp-*"],
"interaction": {
"type": "deepmd",
"model": "frozen_model.pb",
Expand All @@ -30,8 +30,8 @@ where the key `structures` provides the structures to relax. `interaction` is pr
### Task type
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:

**VASP**:
**VASP**:

The default of `potcar_prefix` is "".
```json
"interaction": {
Expand All @@ -41,8 +41,8 @@ The default of `potcar_prefix` is "".
"potcars": {"Al": "POTCAR.al", "Mg": "POTCAR.mg"}
}
```
**ABACUS**:
**ABACUS**:

The default of `potcar_prefix` is "". The path of potcars/orb_files/deepks_desc is `potcar_prefix` + `potcars`/`orb_files`/`deepks_desc`.
```json
"interaction": {
Expand All @@ -62,7 +62,7 @@ The default of `potcar_prefix` is "". The path of potcars/orb_files/deepks_desc
```json
"interaction": {
"type": "deepmd",
"model": "frozen_model.pb",
"model": "frozen_model.pb",
"type_map": {"Al": 0, "Mg": 1}
}
```
Expand All @@ -81,8 +81,8 @@ Please make sure the [USER-MEAMC package](https://lammps.sandia.gov/doc/Packages
Please make sure the [MANYBODY package](https://lammps.sandia.gov/doc/Packages_details.html#pkg-manybody) has already been installed in LAMMPS
```json
"interaction": {
"type": "eam_fs (eam_alloy)",
"model": "AlMg.eam.fs (AlMg.eam.alloy)",
"type": "eam_fs (eam_alloy)",
"model": "AlMg.eam.fs (AlMg.eam.alloy)",
"type_map": {"Al": 1, "Mg": 2}
}
```
Expand All @@ -96,9 +96,9 @@ Now the supported property types are `eos`, `elastic`, `vacancy`, `interstitial`
There are three operations in auto test package, namely `make`, `run`, and `post`. Here we take `eos` property as an example for property type.

### Make
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:
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:
```bash
dpgen autotest make relaxation.json
dpgen autotest make relaxation.json
```

### Run
Expand All @@ -110,5 +110,5 @@ dpgen autotest run relaxation.json machine.json
### Post
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:
```bash
dpgen autotest post relaxation.json
dpgen autotest post relaxation.json
```
10 changes: 5 additions & 5 deletions doc/autotest/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Auto test
:caption: Guidelines

Auto-test

.. _Main-components::

.. toctree::
:maxdepth: 2
:caption: Main components

Task-type
Property-type
Make-run-and-post
Expand All @@ -25,7 +25,7 @@ Auto test
.. toctree::
:maxdepth: 2
:caption: Structure relaxation

relaxation/index.rst

.. _Property::
Expand All @@ -41,13 +41,13 @@ Auto test
.. toctree::
:maxdepth: 2
:caption: Refine

refine/index.rst

.. _Reproduce::

.. toctree::
:maxdepth: 2
:caption: Reproduce

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

other parameters in `cal_setting` and `cal_type` in `relaxation` also apply in `property`.
Expand Down Expand Up @@ -116,4 +116,4 @@ Key words | data structure | example | description
supercell_size | List of Int | [1,1,10] | the supercell to be constructed, default = [1,1,5]
min_vacuum_size | Int or Float | 10 | minimum size of vacuum width, default = 20
add_fix | List of String | ['true','true','false'] | whether to fix atoms in the direction, default = ['true','true','false'] (standard method)
n_steps | Int | 20 | Number of points for gamma-line calculation, default = 10
n_steps | Int | 20 | Number of points for gamma-line calculation, default = 10
2 changes: 1 addition & 1 deletion doc/autotest/property/Property-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Use command
```bash
dpgen autotest post property.json
```
to post results as `result.json` and `result.out` in each property's path.
to post results as `result.json` and `result.out` in each property's path.
2 changes: 1 addition & 1 deletion doc/autotest/property/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Property
Property-make
Property-run
Property-post
properties/index.rst
properties/index.rst
8 changes: 4 additions & 4 deletions doc/autotest/property/properties/EOS-make.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## EOS make

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

**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.
**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.

**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.
**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.

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

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

`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]`.

**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]`.
**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]`.
2 changes: 0 additions & 2 deletions doc/autotest/property/properties/EOS-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,3 @@ onf_dir: /root/auto_test_example/deepmd/confs/std-fcc/eos_00
... ...
17.935 -3.7088
```


2 changes: 1 addition & 1 deletion doc/autotest/property/properties/Interstitial-make.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

**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.

**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.
**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.
2 changes: 1 addition & 1 deletion doc/autotest/property/properties/Interstitial-post.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Interstitial post

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

#### result.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Surface get started and input examples

`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.
`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.

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

Expand All @@ -18,7 +18,7 @@
"min_slab_size": 10,
"min_vacuum_size":11,
"max_miller": 2,
"cal_type": "static"
"cal_type": "static"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion doc/autotest/property/properties/Surface-make.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Surface make

**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.
**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.

**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.
4 changes: 2 additions & 2 deletions doc/autotest/property/properties/Vacancy-make.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Vacancy make

**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.
**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.

**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.

**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.
**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.
2 changes: 1 addition & 1 deletion doc/autotest/property/properties/Vacancy-post.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Vacancy post

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

#### result.json
Expand Down
2 changes: 1 addition & 1 deletion doc/autotest/property/properties/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Properties
Surface-get-started-and-input-examples
Surface-make
Surface-run
Surface-post
Surface-post
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Refine get started and input examples

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.
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.


An example of the input file `refine.json` is given below:
Expand Down
4 changes: 2 additions & 2 deletions doc/autotest/refine/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Refine

.. toctree::
:maxdepth: 2

Refine-get-started-and-input-examples
Refine-make
Refine-run
Refine-post
Refine-post
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Relaxation get started and input examples

The relaxation of a structure should be carried out before calculating all other properties.
The relaxation of a structure should be carried out before calculating all other properties.

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.
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.

An example of the input file for relaxation by VASP:

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

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).


4 changes: 0 additions & 4 deletions doc/autotest/relaxation/Relaxation-make.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,3 @@ print "Final Stress (xx yy zz xy xz yz) = ${Pxx} ${Pyy} ${Pzz} ${Pxy} ${Pxz} ${P
If user provides lammps input command file `in.lammps`, the `thermo_style` and `dump` commands should be the same as the above file.

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




Loading

0 comments on commit 4be4f6d

Please sign in to comment.