You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+82-17Lines changed: 82 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,9 @@
17
17
-[License](#license)
18
18
19
19
# Install DeePMD-kit
20
-
The installation of the DeePMD-kit is lengthy, but do not be panic. Just follow step by step. Wish you good luck..
20
+
The installation of the DeePMD-kit is lengthy, but do not be panic. Just follow step by step. Wish you good luck..
21
+
22
+
A docker for installing the DeePMD-kit on CentOS 7 is available [here](https://github.com/TimChen314/deepmd-kit_docker).
21
23
22
24
## Install tensorflow's Python interface
23
25
There are two ways of installing the Python interface of tensorflow, either [using google's binary](https://www.tensorflow.org/install/install_linux), or [installing from sources](https://www.tensorflow.org/install/install_sources). When you are using google's binary, do not forget to add the option `-DTF_GOOGLE_BIN=true` when building DeePMD-kit.
DeePMD-kit provide module for running serial MD simulation with Lammps. Notice that the parallel running is not support at this moment. Now make the DeePMD-kit module for lammps.
173
+
DeePMD-kit provide module for running MD simulation with Lammps. Now make the DeePMD-kit module for lammps.
172
174
```bash
173
175
cd$deepmd_source_dir/source/build
174
176
make lammps
175
177
```
176
-
If everything works fine, DeePMD-kit will generate a module called `USER-DEEPMD` in the `build` directory. Now download your favorite Lammps code, and uncompress it (I assume that you have downloaded the tar `lammps-stable.tar.gz`)
178
+
DeePMD-kit will generate a module called `USER-DEEPMD` in the `build` directory. Now download your favorite Lammps code, and uncompress it (I assume that you have downloaded the tar `lammps-stable.tar.gz`)
The option `-j4` means using 4 processes in parallel. You may want to be use a different number according to your hardware.
194
+
195
+
If everything works fine, you will end up with an executable `lmp_mpi`.
196
+
197
+
The DeePMD-kit module can be removed from Lammps source code by
198
+
```bash
199
+
make no-user-deepmd
190
200
```
191
-
The option `-j4` means using 4 processes in parallel. You may want to be use a different number according to your hardware. If everything works fine, you will end up with an executable
192
-
`lmp_serial`.
193
201
194
202
# Use DeePMD-kit
195
203
In this text, we will call the deep neural network that is used to represent the interatomic interactions (Deep Potential) the **model**. The typical procedure of using DeePMD-kit is
It generates two sets `set.000`, `set.001` and `set.002`, with each set contains 2000 frames. The last set (`set.002`) is used as testing set, while the rest sets (`set.000` and `set.001`) are used as training sets. One do not need to take care the binary data files in each of the `set.*` directories. The path containing `set.*` and `type.raw` is called a *system*.
239
247
240
248
## Train a model
249
+
### The standard DeePMD model
241
250
The method of training is explained in our [DeePMD paper][1]. With the source code we provide a small training dataset taken from 400 frames generated by NVT ab-initio water MD trajectory with 300 frames for training and 100 for testing. [An example training parameter file](./examples/train/water.json) is provided. One can try with the training by
The option **`rcut_r`** is the cut-off radius for neighbor searching. The `sel_a` and `sel_r` are the maximum selected numbers of fully-local-coordinate and radial-only-coordinate atoms from the neighbor list, respectively. `sel_a + sel_r` should larger than the maximum possible number of neighbors in the cut-off radius. `sel_a` and `sel_r` are vectors, the length of the vectors are same as the number of atom types in the system. `sel_a[i]` and `sel_r[i]` denote the selected number of neighbors of type `i`.
305
+
The option **`rcut`** is the cut-off radius for neighbor searching. The `sel_a` and `sel_r` are the maximum selected numbers of fully-local-coordinate and radial-only-coordinate atoms from the neighbor list, respectively. `sel_a + sel_r` should larger than the maximum possible number of neighbors in the cut-off radius. `sel_a` and `sel_r` are vectors, the length of the vectors are same as the number of atom types in the system. `sel_a[i]` and `sel_r[i]` denote the selected number of neighbors of type `i`.
299
306
300
307
The option **`axis_rule`** specifies how to make the axis for the local coordinate of each atom. For each atom type, 6 integers should be provided. The first three for the first axis, while the last three for the second axis. Within the three integers, the first one specifies if the axis atom is fully-local-coordinated (`0`) or radial-only-coordinated (`1`). The second integer specifies the type of the axis atom. If this number is less than 0, saying `t < 0`, then this axis exclude atom of type `-(t+1)`. If the third integer is, saying `s`, then the axis atom is the `s`th nearest neighbor satisfying the previous two conditions.
301
308
@@ -314,15 +321,63 @@ The options **`start_pref_e`**, **`limit_pref_e`**, **`start_pref_f`**, **`limit
Since we do not have virial data, the virial prefactors `start_pref_v` and `limit_pref_v` are set to 0.
317
325
318
-
The option **`num_threads`** specifies the number of threads used in the training.
319
-
320
-
The option **`seed`** specifies the random seed for neural network initialization.
326
+
The option **`seed`** specifies the random seed for neural network initialization. If not provided, the `seed` will be initialized with `None`.
321
327
322
328
During the training, the error of the model is tested every **`disp_freq`** batches with **`numb_test`** frames from the last set in the **`systems`** directory on the fly, and the results are output to **`disp_file`**.
323
329
324
330
Checkpoints will be written to files with prefix **`save_ckpt`** every **`save_freq`** batches. If **`restart`** is set to `true`, then the training will start from the checkpoint named **`load_ckpt`**, rather than from scratch.
325
331
332
+
Several command line options can be passed to `dp_train`, this can be checked with
333
+
```bash
334
+
$ $deepmd_root/bin/dp_train --help
335
+
```
336
+
An explanation will be provided
337
+
```
338
+
positional arguments:
339
+
INPUT the input json database
340
+
341
+
optional arguments:
342
+
-h, --help show this help message and exit
343
+
-t INTER_THREADS, --inter-threads INTER_THREADS
344
+
With default value 0. Setting the "inter_op_parallelism_threads" key for the tensorflow, the "intra_op_parallelism_threads" will be set by the env variable OMP_NUM_THREADS
345
+
--init-model INIT_MODEL
346
+
Initialize a model by the provided checkpoint
347
+
--restart RESTART Restart the training from the provided checkpoint
348
+
```
349
+
The keys `intra_op_parallelism_threads` and `inter_op_parallelism_threads` are Tensorflow configurations for multithreading, which are explained [here](https://www.tensorflow.org/performance/performance_guide#optimizing_for_cpu). Skipping `-t` and `OMP_NUM_THREADS` leads to the default setting of these keys in the Tensorflow.
350
+
351
+
**`--init-model model.ckpt`**, for example, initializes the model training with an existing model that is stored in the checkpoint `model.ckpt`, the network architectures should match.
352
+
353
+
**`--restart model.ckpt`**, continues the training from the checkpoint `model.ckpt`.
354
+
355
+
### The smooth DeePMD model
356
+
The smooth version of DeePMD can be trained by the DeePMD-kit. [An example training parameter file](./examples/train/water_smth.json) is provided. One can try with the training by
357
+
```bash
358
+
$ cd$deepmd_source_dir/examples/train/
359
+
$ $deepmd_root/bin/dp_train water_smth.json
360
+
```
361
+
The difference between the standard and smooth DeePMD models lies in the model parameters:
362
+
```json
363
+
"use_smooth": true,
364
+
"sel_a": [46, 92],
365
+
"rcut_smth": 5.80,
366
+
"rcut": 6.00,
367
+
"filter_neuron": [25, 50, 100],
368
+
"filter_resnet_dt": false,
369
+
"n_axis_neuron": 16,
370
+
"n_neuron": [240, 240, 240],
371
+
"resnet_dt": true,
372
+
```
373
+
The `sel_r` option is skipped by the smooth version and the model use fully-local-coordinate for all neighboring atoms. The `sel_a` should larger than the maximum possible number of neighbors in the cut-off radius `rcut`.
374
+
375
+
The descriptors will decay smoothly from **`rcut_smth`** to the cutoff radius `rcut`.
376
+
377
+
**`filter_neuron`** provides the size of the filter network (also called local-embedding network). If the size of the next layer is the same or twice as the previous layer, then a skip connection is build (ResNet). **`filter_resnet_dt`** tells if a timestep is used in the skip connection. By default it is `false`. **`n_axis_neuron`** specifies the number of axis filter, which should be much smaller than the size of the last layer of the filter network.
378
+
379
+
**`n_neuron`** specifies the fitting network. If the size of the next layer is the same as the previous layer, then a skip connection is build (ResNet). **`resnet_dt`** tells if a timestep is used in the skip connection. By default it is `true`.
380
+
326
381
327
382
## Freeze the model
328
383
The trained neural network is extracted from a checkpoint and dumped into a database. This process is called "freeze" a model. Typically one does
in the folder where the model is trained. The output database is called `graph.pb`.
333
388
334
-
335
389
## Run MD with Lammps
336
390
Run an MD simulation with Lammps is simpler. In the Lammps input file, one needs to specify the pair style as follows
337
391
```bash
@@ -340,6 +394,17 @@ pair_coeff
340
394
```
341
395
where `graph.pb` is the file name of the frozen model. The `pair_coeff` should be left blank. It should be noted that Lammps counts atom types starting from 1, therefore, all Lammps atom type will be firstly subtracted by 1, and then passed into the DeePMD-kit engine to compute the interactions.
342
396
397
+
### With long-range interaction
398
+
The reciprocal space part of the long-range interaction can be calculated by lammps command `kspace_style`. To use it with DeePMD-kit, one writes
In this setting, the direct space part of the long-range interaction is ignored by the `pair_modify` command, because this part is fitted in the DeePMD model. The splitting parameter `gewald` is modified by the `kspace_modify` command.
343
408
344
409
## Run path-integral MD with i-PI
345
410
The i-PI works in a client-server model. The i-PI provides the server for integrating the replica positions of atoms, while the DeePMD-kit provides a client named `dp_ipi` that computes the interactions (including energy, force and virial). The server and client communicates via the Unix domain socket or the Internet socket. The client can be started by
0 commit comments