Skip to content

Commit 159e45d

Browse files
authored
Merge pull request #1217 from amcadmus/master
Merge recent updates on devel to master.
2 parents d477507 + 4bc3b27 commit 159e45d

File tree

11 files changed

+33
-27
lines changed

11 files changed

+33
-27
lines changed

.readthedocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
version: 2
22
conda:
3-
environment: doc/environment.yml
3+
environment: doc/environment.yml
4+
formats: all

deepmd/descriptor/hybrid.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@ class DescrptHybrid (Descriptor):
2626
2727
Parameters
2828
----------
29-
descrpt_list : list
29+
list : list
3030
Build a descriptor from the concatenation of the list of descriptors.
3131
"""
3232
def __init__ (self,
33-
descrpt_list : list
33+
list : list
3434
) -> None :
3535
"""
3636
Constructor
3737
"""
38+
# warning: list is conflict with built-in list
39+
descrpt_list = list
3840
if descrpt_list == [] or descrpt_list is None:
3941
raise RuntimeError('cannot build descriptor from an empty list of descriptors.')
4042
formatted_descript_list = []

deepmd/descriptor/se_a.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import Tuple, List, Dict, Any
44

55
from deepmd.env import tf
6-
from deepmd.common import get_activation_func, get_precision, ACTIVATION_FN_DICT, PRECISION_DICT, docstring_parameter, get_np_precision
6+
from deepmd.common import get_activation_func, get_precision, ACTIVATION_FN_DICT, PRECISION_DICT, docstring_parameter
77
from deepmd.utils.argcheck import list_to_doc
88
from deepmd.env import GLOBAL_TF_FLOAT_PRECISION
99
from deepmd.env import GLOBAL_NP_FLOAT_PRECISION
@@ -13,7 +13,7 @@
1313
from deepmd.utils.tabulate import DPTabulate
1414
from deepmd.utils.type_embed import embed_atom_type
1515
from deepmd.utils.sess import run_sess
16-
from deepmd.utils.graph import load_graph_def, get_tensor_by_name_from_graph, get_embedding_net_variables
16+
from deepmd.utils.graph import load_graph_def, get_tensor_by_name_from_graph
1717
from .descriptor import Descriptor
1818
from .se import DescrptSe
1919

@@ -133,7 +133,6 @@ def __init__ (self,
133133
self.compress_activation_fn = get_activation_func(activation_function)
134134
self.filter_activation_fn = get_activation_func(activation_function)
135135
self.filter_precision = get_precision(precision)
136-
self.filter_np_precision = get_np_precision(precision)
137136
self.exclude_types = set()
138137
for tt in exclude_types:
139138
assert(len(tt) == 2)
@@ -687,7 +686,7 @@ def _filter_lower(
687686
net = 'filter_-1_net_' + str(type_i)
688687
else:
689688
net = 'filter_' + str(type_input) + '_net_' + str(type_i)
690-
return op_module.tabulate_fusion(self.table.data[net].astype(self.filter_np_precision), info, xyz_scatter, tf.reshape(inputs_i, [natom, shape_i[1]//4, 4]), last_layer_size = outputs_size[-1])
689+
return op_module.tabulate_fusion(tf.cast(self.table.data[net], self.filter_precision), info, xyz_scatter, tf.reshape(inputs_i, [natom, shape_i[1]//4, 4]), last_layer_size = outputs_size[-1])
691690
else:
692691
if (not is_exclude):
693692
xyz_scatter = embedding_net(

deepmd/utils/argcheck.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,8 @@ def loss_ener():
478478
doc_limit_pref_v = limit_pref('virial')
479479
doc_start_pref_ae = start_pref('atom_ener')
480480
doc_limit_pref_ae = limit_pref('atom_ener')
481+
doc_start_pref_pf = start_pref('atom_pref')
482+
doc_limit_pref_pf = limit_pref('atom_pref')
481483
doc_relative_f = 'If provided, relative force error will be used in the loss. The difference of force will be normalized by the magnitude of the force in the label with a shift given by `relative_f`, i.e. DF_i / ( || F || + relative_f ) with DF denoting the difference between prediction and label and || F || denoting the L2 norm of the label.'
482484
return [
483485
Argument("start_pref_e", [float,int], optional = True, default = 0.02, doc = doc_start_pref_e),
@@ -488,6 +490,8 @@ def loss_ener():
488490
Argument("limit_pref_v", [float,int], optional = True, default = 0.00, doc = doc_limit_pref_v),
489491
Argument("start_pref_ae", [float,int], optional = True, default = 0.00, doc = doc_start_pref_ae),
490492
Argument("limit_pref_ae", [float,int], optional = True, default = 0.00, doc = doc_limit_pref_ae),
493+
Argument("start_pref_pf", [float,int], optional = True, default = 0.00, doc = doc_start_pref_pf),
494+
Argument("limit_pref_pf", [float,int], optional = True, default = 0.00, doc = doc_limit_pref_pf),
491495
Argument("relative_f", [float,None], optional = True, doc = doc_relative_f)
492496
]
493497

doc/install/install-from-source.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ One may add the following arguments to `cmake`:
174174
| -DCUDA_TOOLKIT_ROOT_DIR=<value> | Path | Detected automatically | The path to the CUDA toolkit directory. |
175175
| -DUSE_ROCM_TOOLKIT=<value> | `TRUE` or `FALSE` | `FALSE` | If `TRUE`, Build GPU support with ROCM toolkit. |
176176
| -DROCM_ROOT=<value> | Path | Detected automatically | The path to the ROCM toolkit directory. |
177-
| -DLAMMPS_VERSION_NUMBER=<value> | Number | `20201029` | Only neccessary for LAMMPS built-in mode. The version number of LAMMPS (yyyymmdd). |
177+
| -DLAMMPS_VERSION_NUMBER=<value> | Number | `20210929` | Only neccessary for LAMMPS built-in mode. The version number of LAMMPS (yyyymmdd). |
178178
| -DLAMMPS_SOURCE_ROOT=<value> | Path | - | Only neccessary for LAMMPS plugin mode. The path to the LAMMPS source code (later than 8Apr2021). If not assigned, the plugin mode will not be enabled. |
179179

180180
If the cmake has executed successfully, then

doc/install/install-lammps.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ make lammps
1212
DeePMD-kit will generate a module called `USER-DEEPMD` in the `build` directory. If you need low precision version, move `env_low.sh` to `env.sh` in the directory. Now download the LAMMPS code (`29Oct2020` or later), and uncompress it:
1313
```bash
1414
cd /some/workspace
15-
wget https://github.com/lammps/lammps/archive/stable_29Oct2020.tar.gz
16-
tar xf stable_29Oct2020.tar.gz
15+
wget https://github.com/lammps/lammps/archive/stable_29Sep2021.tar.gz
16+
tar xf stable_29Sep2021.tar.gz
1717
```
18-
The source code of LAMMPS is stored in directory `lammps-stable_29Oct2020`. Now go into the LAMMPS code and copy the DeePMD-kit module like this
18+
The source code of LAMMPS is stored in directory `lammps-stable_29Sep2021`. Now go into the LAMMPS code and copy the DeePMD-kit module like this
1919
```bash
20-
cd lammps-stable_29Oct2020/src/
20+
cd lammps-stable_29Sep2021/src/
2121
cp -r $deepmd_source_dir/source/build/USER-DEEPMD .
2222
```
2323
Now build LAMMPS
@@ -43,22 +43,22 @@ Starting from `8Apr2021`, LAMMPS also provides a plugin mode, allowing one build
4343
Now download the LAMMPS code (`8Apr2021` or later), and uncompress it:
4444
```bash
4545
cd /some/workspace
46-
wget https://github.com/lammps/lammps/archive/patch_30Jul2021.tar.gz
47-
tar xf patch_30Jul2021.tar.gz
46+
wget https://github.com/lammps/lammps/archive/stable_29Sep2021.tar.gz
47+
tar xf stable_29Sep2021.tar.gz
4848
```
49-
The source code of LAMMPS is stored in directory `lammps-patch_30Jul2021`. Now go into the LAMMPS code and create a directory called `build`
49+
The source code of LAMMPS is stored in directory `lammps-stable_29Sep2021`. Now go into the LAMMPS code and create a directory called `build`
5050
```bash
51-
mkdir -p lammps-patch_30Jul2021/build/
52-
cd lammps-patch_30Jul2021/build/
51+
mkdir -p lammps-stable_29Sep2021/build/
52+
cd lammps-stable_29Sep2021/build/
5353
```
5454
Now build LAMMPS. Note that `PLUGIN` and `KSPACE` package must be enabled, and `BUILD_SHARED_LIBS` must be set to `yes`. You can install any other package you want.
5555
```bash
56-
cmake -D PKG_PLUGIN=ON -D PKG_KSPACE=ON -D LAMMPS_INSTALL_RPATH=ON -D BUILD_SHARED_LIBS=yes -D CMAKE_INSTALL_PREFIX=${deepmd_root} ../cmake
56+
cmake -D PKG_PLUGIN=ON -D PKG_KSPACE=ON -D LAMMPS_INSTALL_RPATH=ON -D BUILD_SHARED_LIBS=yes -D CMAKE_INSTALL_PREFIX=${deepmd_root} -D CMAKE_INSTALL_LIBDIR=lib -D CMAKE_INSTALL_FULL_LIBDIR=${deepmd_root}/lib ../cmake
5757
make -j4
5858
make install
5959
```
6060

6161
If everything works fine, you will end up with an executable `${deepmd_root}/lmp`.
6262
```bash
6363
${deepmd_root}/lmp -h
64-
```
64+
```

doc/third-party/lammps-command.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
If you are using the plugin mode, enable DeePMD-kit package in LAMMPS with `plugin` command:
66

77
```
8-
plugin load path/to/deepmd/lib/libdeepmd_lmp.so
8+
plugin load libdeepmd_lmp.so
99
```
1010

1111
The built-in mode doesn't need this step.

examples/water/lmp/in.plugin.lammps

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ read_data water.lmp
1111
mass 1 16
1212
mass 2 2
1313

14-
# load the plugin at <install_prefix>/lib/libdeepmd_lmp.so
15-
plugin load ../../../dp/lib/libdeepmd_lmp.so
14+
# load the deepmd plugin
15+
plugin load libdeepmd_lmp.so
1616

1717
pair_style deepmd frozen_model.pb
1818
pair_coeff * *

source/install/build_cc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ NPROC=$(nproc --all)
2020
BUILD_TMP_DIR=${SCRIPT_PATH}/../build
2121
mkdir -p ${BUILD_TMP_DIR}
2222
cd ${BUILD_TMP_DIR}
23-
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DINSTALL_TENSORFLOW=TRUE ${CUDA_ARGS} -DLAMMPS_VERSION=patch_30Jul2021 -DUSE_TTM=TRUE ..
23+
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DINSTALL_TENSORFLOW=TRUE ${CUDA_ARGS} -DLAMMPS_VERSION=stable_29Sep2021 -DUSE_TTM=TRUE ..
2424
make -j${NPROC}
2525
make install
2626

source/install/build_lammps.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ BUILD_TMP_DIR=${SCRIPT_PATH}/../build_lammps
1515
mkdir -p ${BUILD_TMP_DIR}
1616
cd ${BUILD_TMP_DIR}
1717
# download LAMMMPS
18-
LAMMPS_VERSION=patch_30Jul2021
18+
LAMMPS_VERSION=stable_29Sep2021
1919
if [ ! -d "lammps-${LAMMPS_VERSION}" ]
2020
then
2121
curl -L -o lammps.tar.gz https://github.com/lammps/lammps/archive/refs/tags/${LAMMPS_VERSION}.tar.gz
@@ -25,7 +25,7 @@ fi
2525
cd ${BUILD_TMP_DIR}/lammps-${LAMMPS_VERSION}
2626
mkdir -p ${BUILD_TMP_DIR}/lammps-${LAMMPS_VERSION}/build
2727
cd ${BUILD_TMP_DIR}/lammps-${LAMMPS_VERSION}/build
28-
cmake -C ../cmake/presets/all_off.cmake -D PKG_PLUGIN=ON -D PKG_KSPACE=ON -D BUILD_SHARED_LIBS=yes -D LAMMPS_INSTALL_RPATH=ON -D CMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} ../cmake
28+
cmake -C ../cmake/presets/all_off.cmake -D PKG_PLUGIN=ON -D PKG_KSPACE=ON -D BUILD_SHARED_LIBS=yes -D LAMMPS_INSTALL_RPATH=ON -D CMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -D CMAKE_INSTALL_LIBDIR=lib -D CMAKE_INSTALL_FULL_LIBDIR=${INSTALL_PREFIX}/lib ../cmake
2929

3030
make -j${NPROC}
3131
make install

0 commit comments

Comments
 (0)