Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel update #22

Merged
merged 86 commits into from
May 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
159e45d
Merge pull request #1217 from amcadmus/master
amcadmus Oct 15, 2021
0d8fe0a
bump the Python version to 3.10 (#1465)
njzjz Feb 4, 2022
82c787d
do some small optimization to ops (#943)
njzjz Feb 11, 2022
f015f58
fix bug of mixed precision training (#1471)
denghuilu Feb 15, 2022
b26ef18
assign energy shift stats if atomic energies are assigned (#1477)
njzjz Feb 16, 2022
33a1dfa
calculate neighbor statistics from CLI (#1476)
njzjz Feb 17, 2022
17d1443
recover input stats from frozen models (#1482)
njzjz Feb 19, 2022
45c2feb
test: move loading graphs to setUpClass (#1484)
njzjz Feb 20, 2022
e6a7358
add an interface to eval descriptors (#1483)
njzjz Feb 21, 2022
f2b6f7b
run test_python in the pre-built container (#1487)
njzjz Feb 22, 2022
d9a4a86
typo: 'should be in consistent' -> 'should be consistent' (#1490)
CompRhys Feb 22, 2022
87b4930
make OpenMP an optional dependency (#1498)
njzjz Feb 23, 2022
ea7fbde
typo: 'productive' -> 'production' (#1497)
CompRhys Feb 23, 2022
ff48565
pass integer zero to memset (#1499)
njzjz Feb 23, 2022
52ba6d9
fix the example of inference with C++ interface (#1504)
njzjz Feb 23, 2022
336c273
typos: fix more small grammar issues on install pages (#1503)
CompRhys Feb 23, 2022
3eb2550
y-axis should use log scale instead of symlog (#1514)
njzjz Feb 27, 2022
0ff22bc
Merge branch 'master' into devel
Mar 7, 2022
a009fc9
Merge pull request #1543 from amcadmus/devel
wanghan-iapcm Mar 7, 2022
3e54fea
Merge pull request #1542 from amcadmus/master
wanghan-iapcm Mar 7, 2022
c0bc101
add the deepmodeling banner to doc (#1529)
njzjz Mar 7, 2022
69989b4
fix the name of deeptensor/atom and dplr plugin (#1548)
njzjz Mar 8, 2022
70fcda6
fix macos library name (#1566)
njzjz Mar 12, 2022
d8a0844
support `type_one_side` along with `exclude_types` (#1423)
njzjz Mar 14, 2022
b4603e3
adjust sel of frozen models (#1573)
njzjz Mar 15, 2022
dfc2bdc
restore original_sel in the graph (#1574)
njzjz Mar 16, 2022
1503fc3
fix model compression bug of nan output (#1575)
denghuilu Mar 16, 2022
c49533e
support `dp convert-from 1.1` (#1587)
njzjz Mar 23, 2022
470f829
bump default LAMMPS version to `stable_29Sep2021_update3` (#1596)
njzjz Mar 25, 2022
c17873d
add atom energy bias to type embedding energy (#1592)
njzjz Mar 25, 2022
5d79471
compile CUDA code for all archs (#1595)
njzjz Mar 25, 2022
27c297c
support dp convert-from 1.0 (#1597)
njzjz Mar 25, 2022
ce1ad2a
patch #1595: GREATER_EQUAL (#1598)
njzjz Mar 25, 2022
1aa5041
fix lammps plugin creator pointer (#1602)
njzjz Mar 27, 2022
785cfa7
follow API changes from latest LAMMPS (#1601)
njzjz Mar 27, 2022
8d4d93d
add another way to load LAMMPS plugins (#1604)
njzjz Mar 28, 2022
c91a2bd
fix the bug introduced by lammps PR #2481 (#1605)
amcadmus Mar 28, 2022
cec13a1
add kspace pppm/dplr to lmp plugin library (#1603)
njzjz Mar 29, 2022
398258a
convert constants (which may change) to variables (#1606)
njzjz Mar 29, 2022
c7d8743
add a graph optimizer to parallelize prod_force_a_cpu (#1429)
njzjz Mar 30, 2022
10fdc93
refactor init_variable and support type embedding (#1610)
njzjz Apr 1, 2022
1cdf527
optimize dplr data modifier (#1615)
y1xiaoc Apr 2, 2022
bdd339e
add system names to model devi header (#1618)
njzjz Apr 3, 2022
c3cbd7e
update compress cli input file (#1633)
njzjz Apr 14, 2022
d799306
add tips for easy installation (#1634)
njzjz Apr 15, 2022
e0ca6ad
add the order of box.raw in data-conv.md (#1635)
likefallwind Apr 15, 2022
92d24d0
Correct the forward communication at ik differentiation mode in pppm_…
Yi-FanLi Apr 15, 2022
5b62a7a
fix TF version bug in #1429 (#1638)
njzjz Apr 15, 2022
4994b52
Fix compilation error while in a ROCm environment (#1628)
denghuilu Apr 16, 2022
4286937
Merge branch 'devel'
Apr 16, 2022
00d5ce9
Merge pull request #1642 from amcadmus/devel
amcadmus Apr 16, 2022
f7aec87
change default NN precision from `float64` to `default` (#1644)
njzjz Apr 18, 2022
8d291b5
fix variable declaration error (#1651)
denghuilu Apr 22, 2022
a6ca734
update TF installation doc (#1652)
njzjz Apr 23, 2022
de7ba72
migrate test_cc from conda to docker (#1650)
njzjz Apr 23, 2022
18ac81f
use float constants and functions in float functions (#1647)
njzjz Apr 28, 2022
2bf51f3
fix bug of aparam size, should be nlocal_real (#1664)
amcadmus Apr 28, 2022
85a3a0e
convert tabulate data from np.ndarray to tf.Tensor (#1657)
njzjz Apr 29, 2022
d1fa9e9
reset the graph before freezing the compressed model (#1658)
njzjz Apr 29, 2022
f8533cb
fix rcut in hybrid model compression (#1663)
njzjz Apr 29, 2022
a2443d9
add free_energy to ase calculator (#1667)
njzjz Apr 29, 2022
a31544c
rewrite data doc (#1668)
njzjz Apr 29, 2022
edfef49
migrate sphinx mathjax from jsdelivr to cdnjs (#1669)
njzjz Apr 29, 2022
28fd987
Documentation improvements (#1673)
chazeon May 3, 2022
cc136bb
provide valid_data the same type_map as train_data (#1677)
njzjz May 3, 2022
92230a3
deepmodeling.org -> deepmodeling.com (#1678)
njzjz May 3, 2022
899d102
fix compress training (#1680)
njzjz May 4, 2022
e9b27a7
doc: add information abotu supported versions of dependencies (#1683)
njzjz May 6, 2022
087ae56
supports dp convert-from 0.12 (#1685)
njzjz May 6, 2022
44cf60a
fix bug of model compression training with se_e2_r type descriptor (#…
denghuilu May 9, 2022
f275ce7
Change Typo (#1687)
likefallwind May 9, 2022
89e7149
doc: add Interfaces out of DeePMD-kit (#1691)
njzjz May 9, 2022
2038016
fix grappler compilation error with TF 1.15 ~ 2.6 (#1697)
njzjz May 11, 2022
cf8bc56
set default fparam and aparam stat and recover from graph (#1695)
njzjz May 11, 2022
f1b8dca
fix git permission issue (#1716)
njzjz May 18, 2022
c2e6b45
optimize format_nlist_i_cpu (#1717)
njzjz May 18, 2022
b534355
use net-wise tabulate range (#1665)
njzjz May 19, 2022
962c9a8
implement parallelism for neighbor stat (#1624)
njzjz May 19, 2022
eb2a3c3
render equations in markdown files (#1721)
njzjz May 21, 2022
12dd522
fix tf_cxx_abi in TF 2.9 (#1723)
njzjz May 23, 2022
b11e33f
update the latest state of easy installation (#1726)
njzjz May 24, 2022
6bd3bda
correct type behavior when atomic energy is requested (#1727)
njzjz May 25, 2022
f2b5c2c
prevent explicit slash in the path (#1713)
njzjz May 25, 2022
28707e6
throw warning in C++ if env is not set (#1728)
njzjz May 25, 2022
c4ad552
in model_devi, assumes nopbc if box is set to None (#1704)
wanghan-iapcm May 25, 2022
2288e43
avoid static CUDA linking (#1731)
njzjz May 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build_cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
- variant: cpu
- variant: cuda
steps:
- name: work around permission issue
run: git config --global --add safe.directory /__w/deepmd-kit/deepmd-kit
- uses: actions/checkout@master
with:
submodules: true
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
os: [ubuntu-18.04] #, windows-latest, macos-latest]

steps:
- name: work around permission issue
run: git config --global --add safe.directory /__w/deepmd-kit/deepmd-kit
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
Expand All @@ -25,7 +27,7 @@ jobs:

- name: Build wheels
env:
CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-*"
CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-* cp310-*"
CIBW_MANYLINUX_X86_64_IMAGE: ghcr.io/deepmodeling/manylinux2010_x86_64_tensorflow
CIBW_BEFORE_BUILD: pip install tensorflow
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux*"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/lint_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
python-version: [3.8]

steps:
- name: work around permission issue
run: git config --global --add safe.directory /__w/deepmd-kit/deepmd-kit
- uses: actions/checkout@v1
- uses: actions/setup-python@v2
with:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/test_cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ jobs:
testpython:
name: Test C++
runs-on: ubuntu-latest
container: ghcr.io/deepmodeling/deepmd-kit-test-cc:latest
steps:
- name: work around permission issue
run: git config --global --add safe.directory /__w/deepmd-kit/deepmd-kit
- uses: actions/checkout@master
- run: source/install/test_cc.sh
- run: source/install/test_cc_local.sh
env:
tensorflow_root: /usr/local
- run: source/install/codecov.sh
18 changes: 5 additions & 13 deletions .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ jobs:
- python: 3.7
gcc: 8
tf:
- python: 3.8
- python: "3.10"
gcc: 5
tf:
- python: 3.8
- python: "3.10"
gcc: 8
tf:

container: ghcr.io/deepmodeling/deepmd-kit-test-environment:py${{ matrix.python }}-gcc${{ matrix.gcc }}-tf${{ matrix.tf }}
steps:
- name: work around permission issue
run: git config --global --add safe.directory /__w/deepmd-kit/deepmd-kit
- uses: actions/checkout@master
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: pip cache
uses: actions/cache@v2
with:
Expand All @@ -62,19 +62,11 @@ jobs:
${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- run: |
sudo apt update
sudo apt install gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
- run: python -m pip install -U pip>=21.3.1
- run: pip install -e .[cpu,test] codecov
env:
CC: gcc-${{ matrix.gcc }}
CXX: g++-${{ matrix.gcc }}
TENSORFLOW_VERSION: ${{ matrix.tf }}
- run: dp --version
- name: Prepare parallel runtime
if: ${{ matrix.tf == '' }}
run: |
sudo apt install libopenmpi-dev openmpi-bin
HOROVOD_WITHOUT_GLOO=1 HOROVOD_WITH_TENSORFLOW=1 pip install horovod mpi4py
- run: pytest --cov=deepmd source/tests && codecov
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,16 @@ A full [document](doc/train/train-input-auto.rst) on options in the training inp
- [Install GROMACS](doc/install/install-gromacs.md)
- [Building conda packages](doc/install/build-conda.md)
- [Data](doc/data/index.md)
- [Data conversion](doc/data/data-conv.md)
- [System](doc/data/system.md)
- [Formats of a system](doc/data/data-conv.md)
- [Prepare data with dpdata](doc/data/dpdata.md)
- [Model](doc/model/index.md)
- [Overall](doc/model/overall.md)
- [Descriptor `"se_e2_a"`](doc/model/train-se-e2-a.md)
- [Descriptor `"se_e2_r"`](doc/model/train-se-e2-r.md)
- [Descriptor `"se_e3"`](doc/model/train-se-e3.md)
- [Descriptor `"hybrid"`](doc/model/train-hybrid.md)
- [Descriptor `sel`](doc/model/sel.md)
- [Fit energy](doc/model/train-energy.md)
- [Fit `tensor` like `Dipole` and `Polarizability`](doc/model/train-fitting-tensor.md)
- [Train a Deep Potential model using `type embedding` approach](doc/model/train-se-e2-a-tebd.md)
Expand All @@ -120,37 +122,31 @@ A full [document](doc/train/train-input-auto.rst) on options in the training inp
- [LAMMPS commands](doc/third-party/lammps-command.md)
- [Run path-integral MD with i-PI](doc/third-party/ipi.md)
- [Run MD with GROMACS](doc/third-party/gromacs.md)
- [Interfaces out of DeePMD-kit](doc/third-party/out-of-deepmd-kit.md)

# Code structure

The code is organized as follows:

* `data/raw`: tools manipulating the raw data files.

* `examples`: examples.

* `deepmd`: DeePMD-kit python modules.

* `source/api_cc`: source code of DeePMD-kit C++ API.

* `source/ipi`: source code of i-PI client.

* `source/lib`: source code of DeePMD-kit library.

* `source/lmp`: source code of Lammps module.

* `source/gmx`: source code of Gromacs plugin.

* `source/op`: tensorflow op implementation. working with library.


# Troubleshooting

- [Model compatibility](doc/troubleshooting/model-compatability.md)
- [Model compatibility](doc/troubleshooting/model_compatability.md)
- [Installation](doc/troubleshooting/installation.md)
- [The temperature undulates violently during early stages of MD](doc/troubleshooting/md-energy-undulation.md)
- [MD: cannot run LAMMPS after installing a new version of DeePMD-kit](doc/troubleshooting/md-version-compatibility.md)
- [Do we need to set rcut < half boxsize?](doc/troubleshooting/howtoset-rcut.md)
- [How to set sel?](doc/troubleshooting/howtoset-sel.md)
- [The temperature undulates violently during early stages of MD](doc/troubleshooting/md_energy_undulation.md)
- [MD: cannot run LAMMPS after installing a new version of DeePMD-kit](doc/troubleshooting/md_version_compatibility.md)
- [Do we need to set rcut < half boxsize?](doc/troubleshooting/howtoset_rcut.md)
- [How to set sel?](doc/troubleshooting/howtoset_sel.md)
- [How to control the number of nodes used by a job?](doc/troubleshooting/howtoset_num_nodes.md)
- [How to tune Fitting/embedding-net size?](doc/troubleshooting/howtoset_netsize.md)

Expand Down
4 changes: 3 additions & 1 deletion deepmd/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class DP(Calculator):
"""

name = "DP"
implemented_properties = ["energy", "forces", "virial", "stress"]
implemented_properties = ["energy", "free_energy", "forces", "virial", "stress"]

def __init__(
self,
Expand Down Expand Up @@ -102,6 +102,8 @@ def calculate(
atype = [self.type_dict[k] for k in symbols]
e, f, v = self.dp.eval(coords=coord, cells=cell, atom_types=atype)
self.results['energy'] = e[0][0]
# see https://gitlab.com/ase/ase/-/merge_requests/2485
self.results['free_energy'] = e[0][0]
self.results['forces'] = f[0]
self.results['virial'] = v[0].reshape(3, 3)

Expand Down
9 changes: 6 additions & 3 deletions deepmd/descriptor/descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,16 +351,19 @@ def get_feed_dict(self,
return feed_dict

def init_variables(self,
model_file: str,
graph: tf.Graph,
graph_def: tf.GraphDef,
suffix : str = "",
) -> None:
"""
Init the embedding net variables with the given dict

Parameters
----------
model_file : str
The input model file
graph : tf.Graph
The input frozen model graph
graph_def : tf.GraphDef
The input frozen model graph_def
suffix : str, optional
The suffix of the scope

Expand Down
11 changes: 7 additions & 4 deletions deepmd/descriptor/hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,21 +279,24 @@ def enable_mixed_precision(self, mixed_prec : dict = None) -> None:


def init_variables(self,
model_file : str,
graph: tf.Graph,
graph_def: tf.GraphDef,
suffix : str = "",
) -> None:
"""
Init the embedding net variables with the given dict

Parameters
----------
model_file : str
The input frozen model file
graph : tf.Graph
The input frozen model graph
graph_def : tf.GraphDef
The input frozen model graph_def
suffix : str, optional
The suffix of the scope
"""
for idx, ii in enumerate(self.descrpt_list):
ii.init_variables(model_file, suffix=f"{suffix}_{idx}")
ii.init_variables(graph, graph_def, suffix=f"{suffix}_{idx}")

def get_tensor_names(self, suffix : str = "") -> Tuple[str]:
"""Get names of tensors.
Expand Down
21 changes: 20 additions & 1 deletion deepmd/descriptor/loc_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from deepmd.env import default_tf_session_config
from deepmd.utils.sess import run_sess
from .descriptor import Descriptor
from deepmd.utils.graph import get_tensor_by_name_from_graph

@Descriptor.register("loc_frame")
class DescrptLocFrame (Descriptor) :
Expand Down Expand Up @@ -367,4 +368,22 @@ def _compute_dstats_sys_nonsmth (self,
def _compute_std (self,sumv2, sumv, sumn) :
return np.sqrt(sumv2/sumn - np.multiply(sumv/sumn, sumv/sumn))


def init_variables(self,
graph: tf.Graph,
graph_def: tf.GraphDef,
suffix : str = "",
) -> None:
"""
Init the embedding net variables with the given dict

Parameters
----------
graph : tf.Graph
The input frozen model graph
graph_def : tf.GraphDef
The input frozen model graph_def
suffix : str, optional
The suffix of the scope
"""
self.davg = get_tensor_by_name_from_graph(graph, 'descrpt_attr%s/t_avg' % suffix)
self.dstd = get_tensor_by_name_from_graph(graph, 'descrpt_attr%s/t_std' % suffix)
17 changes: 11 additions & 6 deletions deepmd/descriptor/se.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Tuple, List

from deepmd.env import tf
from deepmd.utils.graph import get_embedding_net_variables
from deepmd.utils.graph import get_embedding_net_variables_from_graph_def, get_tensor_by_name_from_graph
from .descriptor import Descriptor


Expand Down Expand Up @@ -92,20 +92,25 @@ def pass_tensors_from_frz_model(self,
self.descrpt_reshape = descrpt_reshape

def init_variables(self,
model_file : str,
graph: tf.Graph,
graph_def: tf.GraphDef,
suffix : str = "",
) -> None:
"""
Init the embedding net variables with the given frozen model
Init the embedding net variables with the given dict

Parameters
----------
model_file : str
The input frozen model file
graph : tf.Graph
The input frozen model graph
graph_def : tf.GraphDef
The input frozen model graph_def
suffix : str, optional
The suffix of the scope
"""
self.embedding_net_variables = get_embedding_net_variables(model_file, suffix = suffix)
self.embedding_net_variables = get_embedding_net_variables_from_graph_def(graph_def, suffix = suffix)
self.davg = get_tensor_by_name_from_graph(graph, 'descrpt_attr%s/t_avg' % suffix)
self.dstd = get_tensor_by_name_from_graph(graph, 'descrpt_attr%s/t_std' % suffix)

@property
def precision(self) -> tf.DType:
Expand Down
Loading