Skip to content

Commit f0453ff

Browse files
authored
Merge pull request #8 from deepmodeling/master
master update
2 parents fdb43dc + 53049b7 commit f0453ff

Some content is hidden

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

77 files changed

+4682
-571
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "source/op/cuda/cub"]
2+
path = source/op/cuda/cub
3+
url = git://github.com/NVlabs/cub.git

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ matrix:
3131
- CC=gcc-4.8
3232
- CXX=g++-4.8
3333
- TENSORFLOW_VERSION=1.14
34+
- python: 3.6
35+
env:
36+
- CC=gcc-5
37+
- CXX=g++-5
38+
- TENSORFLOW_VERSION=1.14
39+
- python: 3.6
40+
env:
41+
- CC=gcc-8
42+
- CXX=g++-8
43+
- TENSORFLOW_VERSION=1.14
3444
- python: 3.7
3545
env:
3646
- CC=gcc-5

README.md

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
- [License and credits](#license-and-credits)
1010
- [Deep Potential in a nutshell](#deep-potential-in-a-nutshell)
1111
- [Download and install](#download-and-install)
12+
- [Easy installation methods](#easy-installation-methods)
13+
- [With Docker](#with-docker)
14+
- [With conda](#with-conda)
15+
- [Offline packages](#offline-packages)
1216
- [Install the python interaction](#install-the-python-interface)
13-
- [Easy installation methods](#easy-installation-methods)
1417
- [Install the Tensorflow's python interface](#install-the-tensorflows-python-interface)
1518
- [Install the DeePMD-kit's python interface](#install-the-deepmd-kits-python-interface)
1619
- [Install the C++ interface](#install-the-c-interface)
@@ -29,6 +32,7 @@
2932
- [Include deepmd in the pair style](#include-deepmd-in-the-pair-style)
3033
- [Long-range interaction](#long-range-interaction)
3134
- [Run path-integral MD with i-PI](#run-path-integral-md-with-i-pi)
35+
- [Use deep potential with ASE](#use-deep-potential-with-ase)
3236
- [Troubleshooting](#troubleshooting)
3337

3438
# About DeePMD-kit
@@ -83,11 +87,29 @@ In addition to building up potential energy models, DeePMD-kit can also be used
8387

8488
Please follow our [github](https://github.com/deepmodeling/deepmd-kit) webpage to see the latest released version and development version.
8589

86-
## Install the python interface
90+
## Easy installation methods
91+
There various easy methods to install DeePMD-kit. Choose one that you prefer. If you want to build by yourself, jump to the next two sections.
92+
93+
### With Docker
94+
A docker for installing the DeePMD-kit on CentOS 7 is available [here](https://github.com/frankhan91/deepmd-kit_docker).
95+
96+
### With conda
97+
DeePMD-kit is avaiable with [conda](https://github.com/conda/conda). Install [Anaconda](https://www.anaconda.com/distribution/#download-section) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html) first.
98+
99+
To install the CPU version:
100+
```bash
101+
conda install deepmd-kit=*=*cpu lammps-dp=*=*cpu -c deepmodeling
102+
```
87103

88-
### Easy installation methods
89-
A docker for installing the DeePMD-kit on CentOS 7 is available [here](https://github.com/frankhan91/deepmd-kit_docker). We are currently working on installation methods using the `conda` package management system and `pip` tools. Hope these will come out soon.
104+
To install the GPU version containing [CUDA 10.0](https://docs.nvidia.com/deploy/cuda-compatibility/index.html#binary-compatibility__table-toolkit-driver):
105+
```bash
106+
conda install deepmd-kit=*=*gpu lammps-dp=*=*gpu -c deepmodeling
107+
```
108+
109+
### Offline packages
110+
Both CPU and GPU version offline package are avaiable in [the Releases page](https://github.com/deepmodeling/deepmd-kit/releases).
90111

112+
## Install the python interface
91113
### Install the Tensorflow's python interface
92114
First, check the python version and compiler version on your machine
93115
```bash
@@ -102,6 +124,14 @@ source $tensorflow_venv/bin/activate
102124
pip install --upgrade pip
103125
pip install --upgrade tensorflow==1.14.0
104126
```
127+
It is notice that everytime a new shell is started and one wants to use `DeePMD-kit`, the virtual environment should be activated by
128+
```bash
129+
source $tensorflow_venv/bin/activate
130+
```
131+
if one wants to skip out of the virtual environment, he/she can do
132+
```bash
133+
deactivate
134+
```
105135
If one has multiple python interpreters named like python3.x, it can be specified by, for example
106136
```bash
107137
virtualenv -p python3.7 $tensorflow_venv
@@ -121,7 +151,7 @@ One should remember to activate the virtual environment every time he/she uses d
121151
Clone the DeePMD-kit source code
122152
```bash
123153
cd /some/workspace
124-
git clone https://github.com/deepmodeling/deepmd-kit.git deepmd-kit
154+
git clone --recursive https://github.com/deepmodeling/deepmd-kit.git deepmd-kit -b devel
125155
```
126156
If one downloads the .zip file from the github, then the default folder of source code would be `deepmd-kit-master` rather than `deepmd-kit`. For convenience, you may want to record the location of source to a variable, saying `deepmd_source_dir` by
127157
```bash
@@ -483,7 +513,7 @@ Running an MD simulation with LAMMPS is simpler. In the LAMMPS input file, one n
483513
pair_style deepmd graph.pb
484514
pair_coeff
485515
```
486-
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. A detailed documentation of this pair style is [here](doc/lammps-pair-style-deepmd.md).
516+
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. [A detailed documentation of this pair style is available.](doc/lammps-pair-style-deepmd.md).
487517

488518
### Long-range interaction
489519
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
@@ -524,6 +554,30 @@ The option **`graph_file`** provides the file name of the frozen model.
524554

525555
The `dp_ipi` gets the atom names from an [XYZ file](https://en.wikipedia.org/wiki/XYZ_file_format) provided by **`coord_file`** (meanwhile ignores all coordinates in it), and translates the names to atom types by rules provided by **`atom_type`**.
526556

557+
## Use deep potential with ASE
558+
559+
Deep potential can be set up as a calculator with ASE to obtain potential energies and forces.
560+
```python
561+
from ase import Atoms
562+
from deepmd.calculator import DP
563+
564+
water = Atoms('H2O',
565+
positions=[(0.7601, 1.9270, 1),
566+
(1.9575, 1, 1),
567+
(1., 1., 1.)],
568+
cell=[100, 100, 100],
569+
calculator=DP(model="frozen_model.pb"))
570+
print(water.get_potential_energy())
571+
print(water.get_forces())
572+
```
573+
574+
Optimization is also available:
575+
```python
576+
from ase.optimize import BFGS
577+
dyn = BFGS(water)
578+
dyn.run(fmax=1e-6)
579+
print(water.get_positions())
580+
```
527581

528582
# Troubleshooting
529583
In consequence of various differences of computers or systems, problems may occur. Some common circumstances are listed as follows.
@@ -533,11 +587,7 @@ If other unexpected problems occur, you're welcome to contact us for help.
533587

534588
When the version of DeePMD-kit used to training model is different from the that of DeePMD-kit running MDs, one has the problem of model compatability.
535589

536-
DeePMD-kit guarantees that the codes with the same major and minor revisions are compatible. That is to say v0.12.5 is compatible to v0.12.0, but is not compatible to v0.11.0. When way of fixing it is to restart the training with the new revisions and a slightly increased `stop_batch`, say 1,000,000 to 1,001,000 if the `save_freq` was set to 1,000. Typically one runs
537-
```bash
538-
dp train --restart model.ckpt revised_input.json
539-
```
540-
and freeze the new model.
590+
DeePMD-kit guarantees that the codes with the same major and minor revisions are compatible. That is to say v0.12.5 is compatible to v0.12.0, but is not compatible to v0.11.0 nor v1.0.0.
541591

542592
## Installation: inadequate versions of gcc/g++
543593
Sometimes you may use a gcc/g++ of version <4.9. If you have a gcc/g++ of version > 4.9, say, 7.2.0, you may choose to use it by doing

deepmd/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from .env import set_mkl
2-
from .DeepEval import DeepEval
3-
from .DeepPot import DeepPot
4-
from .DeepPolar import DeepPolar
5-
from .DeepWFC import DeepWFC
2+
from .DeepEval import DeepEval
3+
from .DeepPot import DeepPot
4+
from .DeepDipole import DeepDipole
5+
from .DeepPolar import DeepPolar
6+
from .DeepPolar import DeepGlobalPolar
7+
from .DeepWFC import DeepWFC
68

79
set_mkl()
810

doc/lammps-pair-style-deepmd.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ This pair style takes the deep potential defined in a model file that usually ha
3535

3636
The model deviation evalulate the consistency of the force predictions from multiple models. By default, only the maximal, minimal and averge model deviations are output. If the key `atomic` is set, then the model deviation of force prediction of each atom will be output.
3737

38-
By default, the model deviation is output in absolute value. If the keyword `relative` is set, then the relative model deviation will be output, which is defined by
38+
By default, the model deviation is output in absolute value. If the keyword `relative` is set, then the relative model deviation will be output. The relative model deviation of the force on atom `i` is defined by
3939
```math
40-
|Df|
41-
Ef = -------------
42-
|f| + level
40+
|Df_i|
41+
Ef_i = -------------
42+
|f_i| + level
4343
```
44-
where `Df` is the model deviation of a force, `|f|` is the norm of the force and `level` is provided as the parameter of the keyword `relative`.
44+
where `Df_i` is the absolute model deviation of the force on atom `i`, `|f_i|` is the norm of the the force and `level` is provided as the parameter of the keyword `relative`.
4545

4646

4747
## Restrictions
@@ -50,6 +50,8 @@ where `Df` is the model deviation of a force, `|f|` is the norm of the force and
5050

5151
- The `atom_style` of the system should be `atomic`.
5252

53+
- When using the `atomic` key word of `deepmd` is set, one should not use this pair style with MPI parallelization.
54+
5355

5456
[DP]:https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.120.143001
5557
[DP-SE]:https://arxiv.org/abs/1805.09003

examples/fparam/data/.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
*raw
2-
1+
*.raw
2+
convert_aparam.py
21.2 KB
Binary file not shown.
21.2 KB
Binary file not shown.
21.2 KB
Binary file not shown.
21.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)