Skip to content

Commit 1db2195

Browse files
[pre-commit.ci] pre-commit autoupdate (#2752)
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.284 → v0.0.285](astral-sh/ruff-pre-commit@v0.0.284...v0.0.285) - [github.com/asottile/blacken-docs: 1.15.0 → 1.16.0](adamchainz/blacken-docs@1.15.0...1.16.0) <!--pre-commit.ci end--> --------- Signed-off-by: Jinzhe Zeng <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jinzhe Zeng <[email protected]>
1 parent 7146c3d commit 1db2195

File tree

6 files changed

+67
-49
lines changed

6 files changed

+67
-49
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ repos:
3333
files: \.py$
3434
- repo: https://github.com/astral-sh/ruff-pre-commit
3535
# Ruff version.
36-
rev: v0.0.284
36+
rev: v0.0.285
3737
hooks:
3838
- id: ruff
3939
args: ["--fix"]
@@ -45,7 +45,7 @@ repos:
4545
args: ["--write"]
4646
# Python inside docs
4747
- repo: https://github.com/asottile/blacken-docs
48-
rev: 1.15.0
48+
rev: 1.16.0
4949
hooks:
5050
- id: blacken-docs
5151
# C++

deepmd/fit/polar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ def __init__(
107107
self.scale = [1.0 for ii in range(self.ntypes)]
108108
# if self.diag_shift is None:
109109
# self.diag_shift = [0.0 for ii in range(self.ntypes)]
110-
if type(self.sel_type) is not list:
110+
if not isinstance(self.sel_type, list):
111111
self.sel_type = [self.sel_type]
112112
self.sel_type = sorted(self.sel_type)
113113
self.constant_matrix = np.zeros(
114114
self.ntypes
115115
) # self.ntypes x 1, store the average diagonal value
116116
# if type(self.diag_shift) is not list:
117117
# self.diag_shift = [self.diag_shift]
118-
if type(self.scale) is not list:
118+
if not isinstance(self.scale, list):
119119
self.scale = [self.scale for ii in range(self.ntypes)]
120120
self.scale = np.array(self.scale)
121121
self.dim_rot_mat_1 = descrpt.get_dim_rot_mat_1()

doc/development/create-a-model.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ After implementation, you need to register the component with a key:
1616
```py
1717
from deepmd.descriptor import Descriptor
1818

19+
1920
@Descriptor.register("some_descrpt")
2021
class SomeDescript(Descriptor):
2122
def __init__(self, arg1: bool, arg2: float) -> None:
@@ -32,6 +33,7 @@ from typing import List
3233
from dargs import Argument
3334
from deepmd.utils.argcheck import descrpt_args_plugin
3435

36+
3537
@descrpt_args_plugin.register("some_descrpt")
3638
def descrpt_some_args() -> List[Argument]:
3739
return [
@@ -57,11 +59,13 @@ The arguments here should be consistent with the class arguments of your new com
5759
You may use `setuptools` to package new codes into a new Python package. It's crucial to add your new component to `entry_points['deepmd']` in `setup.py`:
5860

5961
```py
60-
entry_points={
61-
'deepmd': [
62-
'some_descrpt=deepmd_some_descrtpt:SomeDescript',
62+
entry_points = (
63+
{
64+
"deepmd": [
65+
"some_descrpt=deepmd_some_descrtpt:SomeDescript",
6366
],
6467
},
68+
)
6569
```
6670

6771
where `deepmd_some_descrtpt` is the module of your codes. It is equivalent to `from deepmd_some_descrtpt import SomeDescript`.

doc/model/dprc.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,23 @@ As described in the paper, the DPRc model only corrects $E_\text{QM}$ and $E_\te
5757
{ref}`exclude_types <model/descriptor[se_e2_a]/exclude_types>` can be generated by the following Python script:
5858
```py
5959
from itertools import combinations_with_replacement, product
60+
6061
qm = (0, 1, 3, 5)
6162
mm = (2, 4)
62-
print("QM/QM:", list(map(list, list(combinations_with_replacement(mm, 2)) + list(product(qm, mm)))))
63-
print("QM/MM:", list(map(list, list(combinations_with_replacement(qm, 2)) + list(combinations_with_replacement(mm, 2)))))
63+
print(
64+
"QM/QM:",
65+
list(map(list, list(combinations_with_replacement(mm, 2)) + list(product(qm, mm)))),
66+
)
67+
print(
68+
"QM/MM:",
69+
list(
70+
map(
71+
list,
72+
list(combinations_with_replacement(qm, 2))
73+
+ list(combinations_with_replacement(mm, 2)),
74+
)
75+
),
76+
)
6477
```
6578

6679
Also, DPRc assumes MM atom energies ({ref}`atom_ener <model/fitting_net[ener]/atom_ener>`) are zero:
Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,36 @@
1-
# Interfaces out of DeePMD-kit
2-
3-
The codes of the following interfaces are not a part of the DeePMD-kit package and maintained by other repositories. We list these interfaces here for user convenience.
4-
5-
## dpdata
6-
7-
[dpdata](https://github.com/deepmodeling/dpdata) provides the `predict` method for `System` class:
8-
9-
```py
10-
import dpdata
11-
dsys = dpdata.LabeledSystem('OUTCAR')
12-
dp_sys = dsys.predict("frozen_model_compressed.pb")
13-
```
14-
15-
By inferring with the DP model `frozen_model_compressed.pb`, dpdata will generate a new labeled system `dp_sys` with inferred energies, forces, and virials.
16-
17-
## OpenMM plugin for DeePMD-kit
18-
19-
An [OpenMM](https://github.com/openmm/openmm) plugin is provided from [JingHuangLab/openmm_deepmd_plugin](https://github.com/JingHuangLab/openmm_deepmd_plugin), written by the [Huang Lab](http://www.compbiophysics.org/) at Westlake University.
20-
21-
## AMBER interface to DeePMD-kit
22-
23-
An [AMBER](https://ambermd.org/) interface to DeePMD-kit is written by the [York [Lab](https://theory.rutgers.edu/) from Rutgers University. It is open-source at [GitLab RutgersLBSR/AmberDPRc](https://gitlab.com/RutgersLBSR/AmberDPRc/). Details can be found in [this paper](https://doi.org/10.1021/acs.jctc.1c00201).
24-
25-
## DP-GEN
26-
27-
[DP-GEN](https://github.com/deepmodeling/dpgen) provides a workflow to generate accurate DP models by calling DeePMD-kit's command line interface (CLI) in the local or remote server. Details can be found in [this paper](https://doi.org/10.1016/j.cpc.2020.107206).
28-
29-
## MLatom
30-
31-
[Mlatom](http://mlatom.com/) provides an interface to the DeePMD-kit within MLatom's workflow by calling DeePMD-kit's CLI. Details can be found in [this paper](https://doi.org/10.1007/s41061-021-00339-5).
32-
33-
## ABACUS
34-
35-
[ABACUS](https://github.com/deepmodeling/abacus-develop/) can run molecular dynamics with a DP model. User is required to [build ABACUS with DeePMD-kit](https://abacus.deepmodeling.com/en/latest/advanced/install.html#build-with-deepmd-kit).
1+
# Interfaces out of DeePMD-kit
2+
3+
The codes of the following interfaces are not a part of the DeePMD-kit package and maintained by other repositories. We list these interfaces here for user convenience.
4+
5+
## dpdata
6+
7+
[dpdata](https://github.com/deepmodeling/dpdata) provides the `predict` method for `System` class:
8+
9+
```py
10+
import dpdata
11+
12+
dsys = dpdata.LabeledSystem("OUTCAR")
13+
dp_sys = dsys.predict("frozen_model_compressed.pb")
14+
```
15+
16+
By inferring with the DP model `frozen_model_compressed.pb`, dpdata will generate a new labeled system `dp_sys` with inferred energies, forces, and virials.
17+
18+
## OpenMM plugin for DeePMD-kit
19+
20+
An [OpenMM](https://github.com/openmm/openmm) plugin is provided from [JingHuangLab/openmm_deepmd_plugin](https://github.com/JingHuangLab/openmm_deepmd_plugin), written by the [Huang Lab](http://www.compbiophysics.org/) at Westlake University.
21+
22+
## AMBER interface to DeePMD-kit
23+
24+
An [AMBER](https://ambermd.org/) interface to DeePMD-kit is written by the [York [Lab](https://theory.rutgers.edu/) from Rutgers University. It is open-source at [GitLab RutgersLBSR/AmberDPRc](https://gitlab.com/RutgersLBSR/AmberDPRc/). Details can be found in [this paper](https://doi.org/10.1021/acs.jctc.1c00201).
25+
26+
## DP-GEN
27+
28+
[DP-GEN](https://github.com/deepmodeling/dpgen) provides a workflow to generate accurate DP models by calling DeePMD-kit's command line interface (CLI) in the local or remote server. Details can be found in [this paper](https://doi.org/10.1016/j.cpc.2020.107206).
29+
30+
## MLatom
31+
32+
[Mlatom](http://mlatom.com/) provides an interface to the DeePMD-kit within MLatom's workflow by calling DeePMD-kit's CLI. Details can be found in [this paper](https://doi.org/10.1007/s41061-021-00339-5).
33+
34+
## ABACUS
35+
36+
[ABACUS](https://github.com/deepmodeling/abacus-develop/) can run molecular dynamics with a DP model. User is required to [build ABACUS with DeePMD-kit](https://abacus.deepmodeling.com/en/latest/advanced/install.html#build-with-deepmd-kit).

doc/train/training.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ import matplotlib.pyplot as plt
4646

4747
data = np.genfromtxt("lcurve.out", names=True)
4848
for name in data.dtype.names[1:-1]:
49-
plt.plot(data['step'], data[name], label=name)
49+
plt.plot(data["step"], data[name], label=name)
5050
plt.legend()
51-
plt.xlabel('Step')
52-
plt.ylabel('Loss')
53-
plt.xscale('symlog')
54-
plt.yscale('log')
51+
plt.xlabel("Step")
52+
plt.ylabel("Loss")
53+
plt.xscale("symlog")
54+
plt.yscale("log")
5555
plt.grid()
5656
plt.show()
5757
```

0 commit comments

Comments
 (0)