Skip to content

Commit 30c78c0

Browse files
bump lammps to stable_2Aug2023 (#2717)
Signed-off-by: Jinzhe Zeng <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent ea27f29 commit 30c78c0

File tree

12 files changed

+106
-49
lines changed

12 files changed

+106
-49
lines changed

doc/install/install-lammps.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ make lammps
1414
DeePMD-kit will generate a module called `USER-DEEPMD` in the `build` directory, which supports either double or single float precision interface. Now download the LAMMPS code, and uncompress it.
1515
```bash
1616
cd /some/workspace
17-
wget https://github.com/lammps/lammps/archive/stable_23Jun2022_update4.tar.gz
18-
tar xf stable_23Jun2022_update4.tar.gz
17+
wget https://github.com/lammps/lammps/archive/stable_2Aug2023.tar.gz
18+
tar xf stable_2Aug2023.tar.gz
1919
```
20-
The source code of LAMMPS is stored in the directory `lammps-stable_23Jun2022_update4`. Now go into the LAMMPS code and copy the DeePMD-kit module like this
20+
The source code of LAMMPS is stored in the directory `lammps-stable_2Aug2023`. Now go into the LAMMPS code and copy the DeePMD-kit module like this
2121
```bash
22-
cd lammps-stable_23Jun2022_update4/src/
22+
cd lammps-stable_2Aug2023/src/
2323
cp -r $deepmd_source_dir/source/build/USER-DEEPMD .
2424
make yes-kspace
2525
make yes-extra-fix
@@ -46,15 +46,15 @@ Starting from `8Apr2021`, LAMMPS also provides a plugin mode, allowing one to bu
4646
Now download the LAMMPS code (`8Apr2021` or later), and uncompress it:
4747
```bash
4848
cd /some/workspace
49-
wget https://github.com/lammps/lammps/archive/stable_23Jun2022_update4.tar.gz
50-
tar xf stable_23Jun2022_update4.tar.gz
49+
wget https://github.com/lammps/lammps/archive/stable_2Aug2023.tar.gz
50+
tar xf stable_2Aug2023.tar.gz
5151
```
5252

53-
The source code of LAMMPS is stored in the directory `lammps-stable_23Jun2022_update4`. The directory of the source code should be specified as the CMAKE argument `LAMMPS_SOURCE_ROOT` during installation of the DeePMD-kit C++ interface. Now go into the LAMMPS directory and create a directory called `build`
53+
The source code of LAMMPS is stored in the directory `lammps-stable_2Aug2023`. The directory of the source code should be specified as the CMAKE argument `LAMMPS_SOURCE_ROOT` during installation of the DeePMD-kit C++ interface. Now go into the LAMMPS directory and create a directory called `build`
5454

5555
```bash
56-
mkdir -p lammps-stable_23Jun2022_update4/build/
57-
cd lammps-stable_23Jun2022_update4/build/
56+
mkdir -p lammps-stable_2Aug2023/build/
57+
cd lammps-stable_2Aug2023/build/
5858
```
5959
Now build LAMMPS. Note that `PLUGIN` and `KSPACE` packages must be enabled, and `BUILD_SHARED_LIBS` must be set to `yes`. You can install any other package you want.
6060
```bash

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ manylinux-x86_64-image = "quay.io/pypa/manylinux_2_28_x86_64:2022-11-19-1b19e81"
7676
manylinux-aarch64-image = "quay.io/pypa/manylinux_2_28_aarch64:2022-11-19-1b19e81"
7777

7878
[tool.cibuildwheel.macos]
79-
environment = { PIP_PREFER_BINARY="1", DP_LAMMPS_VERSION="stable_23Jun2022_update4", DP_ENABLE_IPI="1" }
79+
environment = { PIP_PREFER_BINARY="1", DP_LAMMPS_VERSION="stable_2Aug2023", DP_ENABLE_IPI="1" }
8080
before-all = [
8181
"""if [[ "$CIBW_BUILD" != *macosx_arm64* ]]; then brew install mpich; fi""",
8282
]
@@ -88,7 +88,7 @@ repair-wheel-command = """if [[ "$CIBW_BUILD" == *macosx_arm64* ]]; then rm -rf
8888
[tool.cibuildwheel.linux]
8989
repair-wheel-command = "auditwheel repair --exclude libtensorflow_framework.so.2 --exclude libtensorflow_framework.so.1 --exclude libtensorflow_framework.so --exclude _pywrap_tensorflow_internal.so --exclude libtensorflow_cc.so.2 -w {dest_dir} {wheel}"
9090
environment-pass = ["CIBW_BUILD", "DP_VARIANT"]
91-
environment = { PIP_PREFER_BINARY="1", DP_VARIANT="cuda", DP_LAMMPS_VERSION="stable_23Jun2022_update4", DP_ENABLE_IPI="1", MPI_HOME="/usr/lib64/mpich", PATH="/usr/lib64/mpich/bin:$PATH" }
91+
environment = { PIP_PREFER_BINARY="1", DP_VARIANT="cuda", DP_LAMMPS_VERSION="stable_2Aug2023", DP_ENABLE_IPI="1", MPI_HOME="/usr/lib64/mpich", PATH="/usr/lib64/mpich/bin:$PATH" }
9292
before-all = [
9393
"""{ if [ "$(uname -m)" = "x86_64" ] ; then curl https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run -O && bash cuda_11.8.0_520.61.05_linux.run --silent --toolkit; fi }""",
9494
"yum install -y mpich-devel",

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ def get_tag(self):
134134
"sphinxcontrib-bibtex",
135135
],
136136
"lmp": [
137-
"lammps~=2022.6.23.4.0; platform_system=='Linux'",
138-
"lammps~=2022.6.23.4.0; platform_system!='Linux'",
137+
"lammps~=2023.8.2.0.0; platform_system=='Linux'",
138+
"lammps~=2023.8.2.0.0; platform_system!='Linux'",
139139
*find_libpython_requires,
140140
],
141141
"ipi": [

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} -DUSE_TF_PYTHON_LIBS=TRUE ${CUDA_ARGS} -DLAMMPS_VERSION=stable_23Jun2022_update4 ..
23+
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DUSE_TF_PYTHON_LIBS=TRUE ${CUDA_ARGS} -DLAMMPS_VERSION=stable_2Aug2023 ..
2424
make -j${NPROC}
2525
make install
2626

source/install/build_from_c.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ NPROC=$(nproc --all)
1313
BUILD_TMP_DIR=${SCRIPT_PATH}/../build
1414
mkdir -p ${BUILD_TMP_DIR}
1515
cd ${BUILD_TMP_DIR}
16-
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DDEEPMD_C_ROOT=${DEEPMD_C_ROOT} -DLAMMPS_VERSION=stable_23Jun2022_update4 ..
16+
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DDEEPMD_C_ROOT=${DEEPMD_C_ROOT} -DLAMMPS_VERSION=stable_2Aug2023 ..
1717
make -j${NPROC}
1818
make install
1919
make lammps

source/install/build_lammps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ BUILD_TMP_DIR=${SCRIPT_PATH}/../build_lammps
1414
mkdir -p ${BUILD_TMP_DIR}
1515
cd ${BUILD_TMP_DIR}
1616
# download LAMMMPS
17-
LAMMPS_VERSION=stable_23Jun2022_update4
17+
LAMMPS_VERSION=stable_2Aug2023
1818
if [ ! -d "lammps-${LAMMPS_VERSION}" ]; then
1919
curl -L -o lammps.tar.gz https://github.com/lammps/lammps/archive/refs/tags/${LAMMPS_VERSION}.tar.gz
2020
tar vxzf lammps.tar.gz

source/install/test_cc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ INSTALL_PREFIX=${SCRIPT_PATH}/../../dp_test
1111
BUILD_TMP_DIR=${SCRIPT_PATH}/../build_tests
1212
mkdir -p ${BUILD_TMP_DIR}
1313
cd ${BUILD_TMP_DIR}
14-
cmake -DINSTALL_TENSORFLOW=TRUE -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DTENSORFLOW_ROOT=${INSTALL_PREFIX} -DBUILD_TESTING:BOOL=TRUE -DLAMMPS_VERSION=stable_23Jun2022_update4 ..
14+
cmake -DINSTALL_TENSORFLOW=TRUE -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DTENSORFLOW_ROOT=${INSTALL_PREFIX} -DBUILD_TESTING:BOOL=TRUE -DLAMMPS_VERSION=stable_2Aug2023 ..
1515
make -j${NPROC}
1616
make install
1717

source/install/test_cc_local.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ INSTALL_PREFIX=${SCRIPT_PATH}/../../dp_test
1212
BUILD_TMP_DIR=${SCRIPT_PATH}/../build_tests
1313
mkdir -p ${BUILD_TMP_DIR}
1414
cd ${BUILD_TMP_DIR}
15-
cmake -DINSTALL_TENSORFLOW=FALSE -DUSE_TF_PYTHON_LIBS=TRUE -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DBUILD_TESTING:BOOL=TRUE -DLAMMPS_VERSION=stable_23Jun2022_update4 ..
15+
cmake -DINSTALL_TENSORFLOW=FALSE -DUSE_TF_PYTHON_LIBS=TRUE -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DBUILD_TESTING:BOOL=TRUE -DLAMMPS_VERSION=stable_2Aug2023 ..
1616
make -j${NPROC}
1717
make install
1818

source/lmp/tests/test_deeptensor.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ def _lammps(data_file) -> PyLammps:
9999

100100
@pytest.fixture
101101
def lammps():
102-
yield _lammps(data_file=data_file)
102+
lmp = _lammps(data_file=data_file)
103+
yield lmp
104+
lmp.close()
103105

104106

105107
# @pytest.fixture
@@ -114,4 +116,7 @@ def test_compute_deeptensor_atom(lammps):
114116
lammps.variable("tensor atom c_tensor[1]")
115117
lammps.dump("1 all custom 1 dump id c_tensor[1]")
116118
lammps.run(0)
117-
assert np.array(lammps.variables["tensor"].value) == pytest.approx(expected_d)
119+
idx_map = lammps.lmp.numpy.extract_atom("id") - 1
120+
assert np.array(lammps.variables["tensor"].value) == pytest.approx(
121+
expected_d[idx_map]
122+
)

source/lmp/tests/test_dplr.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,9 @@ def _lammps(data_file) -> PyLammps:
296296

297297
@pytest.fixture
298298
def lammps():
299-
yield _lammps(data_file=data_file)
299+
lmp = _lammps(data_file=data_file)
300+
yield lmp
301+
lmp.close()
300302

301303

302304
def test_pair_deepmd_sr(lammps):
@@ -350,12 +352,18 @@ def test_pair_deepmd_lr(lammps):
350352
lammps.fix(f"0 all dplr model {pb_file.resolve()} type_associate 1 3 bond_type 1")
351353
lammps.fix_modify("0 virial yes")
352354
lammps.run(0)
353-
for ii in range(2):
354-
assert lammps.atoms[6 + ii].position == pytest.approx(expected_WC[ii])
355+
for ii in range(8):
356+
if lammps.atoms[ii].id > 6:
357+
assert lammps.atoms[ii].position == pytest.approx(
358+
expected_WC[lammps.atoms[ii].id - 7]
359+
)
355360
assert lammps.eval("elong") == pytest.approx(expected_e_kspace)
356361
assert lammps.eval("pe") == pytest.approx(expected_e_lr)
357-
for ii in range(6):
358-
assert lammps.atoms[ii].force == pytest.approx(expected_f_lr[ii])
362+
for ii in range(8):
363+
if lammps.atoms[ii].id <= 6:
364+
assert lammps.atoms[ii].force == pytest.approx(
365+
expected_f_lr[lammps.atoms[ii].id - 1]
366+
)
359367
lammps.run(1)
360368

361369

@@ -443,8 +451,12 @@ def test_min_dplr(lammps):
443451
lammps.min_style("cg")
444452
lammps.minimize("0 1.0e-6 2 2")
445453
for ii in range(8):
446-
assert lammps.atoms[ii].position == pytest.approx(expected_x_min_step1[ii])
454+
assert lammps.atoms[ii].position == pytest.approx(
455+
expected_x_min_step1[lammps.atoms[ii].id - 1]
456+
)
447457
assert lammps.eval("pe") == pytest.approx(expected_e_min_step1)
448458
assert lammps.eval("elong") == pytest.approx(expected_e_kspace_min_step1)
449459
for ii in range(8):
450-
assert lammps.atoms[ii].force == pytest.approx(expected_f_min_step1[ii])
460+
assert lammps.atoms[ii].force == pytest.approx(
461+
expected_f_min_step1[lammps.atoms[ii].id - 1]
462+
)

0 commit comments

Comments
 (0)