Skip to content

Commit 659128b

Browse files
committed
fix bugs
1 parent f1e427a commit 659128b

File tree

4 files changed

+19
-49
lines changed

4 files changed

+19
-49
lines changed

_config.next.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,5 @@ vendors:
7070
internal: jsdelivr
7171
plugins: jsdelivr
7272
preconnect: true
73+
mermaid:
74+
enable: true

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ highlight:
4646
auto_detect: true
4747
marked:
4848
lazyload: true
49+
smartypants: false
4950

5051
# Home page setting
5152
# path: Root path for your blogs index page. (default = '')

source/_posts/tutorial1.md

Lines changed: 12 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ tags:
77
- DeePMD-kit
88
---
99

10-
DeePMD-kit is a software to implement Deep Potential.
11-
There is a lot of information on the Internet, but there are not so many tutorials for the new hand, and the official guide is too long.
12-
Today, I’ll take you 5 minutes to get started with DeePMD-kit.
10+
DeePMD-kit is a software to implement Deep Potential. There is a lot of information on the Internet, but there are not so many tutorials for the new hand, and the official guide is too long. Today, I'll take you 5 minutes to get started with DeePMD-kit.
1311

1412
Let's take a look at the training process of DeePMD-kit:
1513

@@ -18,51 +16,28 @@ A[Prepare data] --> B[Training]
1816
B --> C[Freeze the model]
1917
{% endmermaid %}
2018

21-
What? Only three steps?
22-
Yes, it's that simple.
23-
Preparing data is converting the computational results of DFT to data that can be recognized by the DeePMD-kit.
24-
Training is train a Deep Potential model using the DeePMD-kit with data prepared in the previous step.
25-
Finally, what we need to do is to freeze the restart file in the training process into a model, in other words is to extract the neural network parameters into a file for subsequent use.
26-
I believe you can't wait to get started. Let's go!
19+
What? Only three steps? Yes, it's that simple. Preparing data is converting the computational results of DFT to data that can be recognized by the DeePMD-kit. Training is train a Deep Potential model using the DeePMD-kit with data prepared in the previous step. Finally, what we need to do is to freeze the restart file in the training process into a model, in other words is to extract the neural network parameters into a file for subsequent use. I believe you can't wait to get started. Let's go!
2720

28-
The data format of the DeePMD-kit is introduced in the [official document](https://deepmd.readthedocs.io/) but seems complex.
29-
Don't worry, I'd like to introduce a data processing tool: dpdata!
30-
You can use only one line Python scripts to process data.
31-
So easy!
21+
The data format of the DeePMD-kit is introduced in the [official document](https://deepmd.readthedocs.io/) but seems complex. Don't worry, I'd like to introduce a data processing tool: dpdata! You can use only one line Python scripts to process data. So easy!
3222

3323
```py
3424
import dpdata
3525
dpdata.LabeledSystem('OUTCAR').to('deepmd/npy', 'data', set_size=200)
3626
```
3727

38-
In this example, we converted the computaional results of the VASP in the `OUTCAR` to the data format of the DeePMD-kit and saved in to a directory named `data`,
39-
where `npy` is the compressed format of the numpy, which is required by the DeePMD-kit training.
40-
We assume `OUTCAR` stores 1000 frames of molecular dynamics trajectory, then where will be 1000 points after converting.
41-
`set_size=200` means these 1000 points will be divided into 5 subsets, which is named as `data/set.000`~`data/set.004`, respectively.
42-
The size of each set is 200.
43-
In these 5 sets, `data/set.000`~`data/set.003` will be considered as the training set by the DeePMD-kit, and `data/set.004` will be considered as the test set.
44-
The last set will be considered as the test set by the DeePMD-kit by default.
45-
If there is only one set, the set will be both the training set and the test set. (Of course, such test set is meaningless.)
46-
It's required to prepare an input script to start the DeePMD-kit training.
47-
Are you still out of the fear of being dominated by INCAR script?
48-
Don't worry, it's much easier to configure the DeePMD-kit than configuring the VASP.
49-
First, let's download an example and save to `input.json`:
28+
In this example, we converted the computaional results of the VASP in the `OUTCAR` to the data format of the DeePMD-kit and saved in to a directory named `data`, where `npy` is the compressed format of the numpy, which is required by the DeePMD-kit training. We assume `OUTCAR` stores 1000 frames of molecular dynamics trajectory, then where will be 1000 points after converting. `set_size=200` means these 1000 points will be divided into 5 subsets, which is named as `data/set.000`~`data/set.004`, respectively. The size of each set is 200. In these 5 sets, `data/set.000`~`data/set.003` will be considered as the training set by the DeePMD-kit, and `data/set.004` will be considered as the test set. The last set will be considered as the test set by the DeePMD-kit by default. If there is only one set, the set will be both the training set and the test set. (Of course, such test set is meaningless.) It's required to prepare an input script to start the DeePMD-kit training. Are you still out of the fear of being dominated by INCAR script? Don't worry, it's much easier to configure the DeePMD-kit than configuring the VASP. First, let's download an example and save to `input.json`:
5029

5130
```sh
5231
wget https://raw.githubusercontent.com/deepmodeling/deepmd-kit/v1.3.3/examples/water/train/water_se_a.json -O input.json
5332
```
5433

55-
The strength of the DeePMD-kit is that the same training parameters are suitable for different systems, so we only need to slightly modify `input.json` to start training.
56-
Here is the first parameter to modify:
34+
The strength of the DeePMD-kit is that the same training parameters are suitable for different systems, so we only need to slightly modify `input.json` to start training. Here is the first parameter to modify:
5735

5836
```json
5937
"type_map": ["O", "H"],
6038
```
6139

62-
In the DeePMD-kit data, each atom type is numbered as an integer starting from 0.
63-
The parameter gives an element name to each atom in the numbering system.
64-
Here, we can copy from the content of `data/type_map.raw`.
65-
For example,
40+
In the DeePMD-kit data, each atom type is numbered as an integer starting from 0. The parameter gives an element name to each atom in the numbering system. Here, we can copy from the content of `data/type_map.raw`. For example,
6641

6742
```json
6843
"type_map": ["A", "B","C"],
@@ -74,13 +49,7 @@ Next, we are going to modify the neighbour searching parameter:
7449
"sel": [46, 92],
7550
```
7651

77-
Each number in this list gives the maximum number of atoms of each type among neighbor atoms of an atom.
78-
For example, `46` means there are at most 46 `O` (type `0`) neighbours.
79-
Here, our elements were modified to `A`, `B`, and `C`, so this parameters is also required to modify.
80-
What to do if you don’t know the maximum number of neighbors?
81-
You can be roughly estimate one by the density of the system, or try a number blindly.
82-
If it is not big enough, the DeePMD-kit will shoot WARNINGS.
83-
Below we changed it to
52+
Each number in this list gives the maximum number of atoms of each type among neighbor atoms of an atom. For example, `46` means there are at most 46 `O` (type `0`) neighbours. Here, our elements were modified to `A`, `B`, and `C`, so this parameters is also required to modify. What to do if you don't know the maximum number of neighbors? You can be roughly estimate one by the density of the system, or try a number blindly. If it is not big enough, the DeePMD-kit will shoot WARNINGS. Below we changed it to
8453

8554
```json
8655
"sel": [64, 64, 64]
@@ -98,15 +67,11 @@ to
9867
"systems": ["./data/"],
9968
```
10069

101-
It is because that the directory to write to is `./data/` in the current directory.
102-
Here I'd like to introduce the definition of the data system.
103-
The DeePMD-kit considers that data with corresponding element types and atomic numbers form a system.
104-
Our data is generated from a molecular dynamics simulation and meets this condition, so we can put them into one system.
105-
Dpdata works the same way.
106-
If data cannot be put into a system, multiple systems is required to be set as a list here:
70+
It is because that the directory to write to is `./data/` in the current directory. Here I'd like to introduce the definition of the data system. The DeePMD-kit considers that data with corresponding element types and atomic numbers form a system. Our data is generated from a molecular dynamics simulation and meets this condition, so we can put them into one system. Dpdata works the same way. If data cannot be put into a system, multiple systems is required to be set as a list here:
10771
```json
10872
"training": {
109-
"systems": [system1, system2]
73+
"systems": ["system1", "system2"]
74+
```
11075

11176
Finnally, we are likely to modify another two parameters:
11277

@@ -128,14 +93,12 @@ Now we have succesfully set a input file! To start training, we execuate
12893
dp train input.json
12994
```
13095

131-
and wait for results. During the training process, we can see `lcurve.out` to observe the error reduction.
132-
Among them, Column 4 and 5 are the test and training errors of energy (normalized by the number of atoms), and Column 6 and 7 are the test and training errors of the force.
96+
and wait for results. During the training process, we can see `lcurve.out` to observe the error reduction.Among them, Column 4 and 5 are the test and training errors of energy (normalized by the number of atoms), and Column 6 and 7 are the test and training errors of the force.
13397

13498
After training, we can use the following script to freeze the model:
13599

136100
```sh
137101
dp freeze
138102
```
139103

140-
The default filename of the output model is `frozen_model.pb`. As so, we have got a good or bad DP model.
141-
As for the reliability of this model and how to use it, I will give you a detailed tutorial in the next post.
104+
The default filename of the output model is `frozen_model.pb`. As so, we have got a good or bad DP model. As for the reliability of this model and how to use it, I will give you a detailed tutorial in the next post.

source/categories/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
title: Categories
2+
type: categories
3+
date: 2021-06-15
4+
---

0 commit comments

Comments
 (0)