Skip to content

Commit a0e321a

Browse files
authored
Merge pull request brucefan1983#981 from Kick-H/master
Added installation instructions for gpumd-dp project in `doc`
2 parents 85c0d65 + ab8b114 commit a0e321a

File tree

9 files changed

+160
-486
lines changed

9 files changed

+160
-486
lines changed

doc/gpumd/input_parameters/dump_xyz.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ Syntax
1414
1515
dump_xyz <grouping_method> <group_id> <inverval> <filename> {<property_1> <property_2> ...}
1616
17-
* :attr:`grouping_method` and :attr:`group_id` are the grouping method and the related group ID to be used.
17+
* :attr:`grouping_method` and :attr:`group_id` are the grouping method and the related group ID to be used.
18+
1819
If :attr:`grouping_method` is negative, :attr:`group_id` will be ignored and data for the whole system will be output.
1920

2021
* :attr:`interval` is the output interval (number of steps) of the data.
2122

22-
* :attr:`filename` is the output file.
23+
* :attr:`filename` is the output file.
24+
2325
If it is ended by a star (*), the data for one frame will be output to one file, named by changing the star to the step number.
2426

2527
* Then one can write the properties to be output, and the allowed properties include: :attr:`mass`, :attr:`velocity`, :attr:`force`, :attr:`potential`, :attr:`virial`, and :attr:`unwrapped_position`.

doc/gpumd/input_parameters/potential.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Available potential models
1818
* :ref:`Lennard-Jones (LJ) potential <lennard_jones_potential>`
1919
* :ref:`Neuroevolution potential (NEP) <nep_formalism>`
2020
* :ref:`Hybrid NEP+ILP potential <nep_ilp>`
21+
* :ref:`Deep Potential (DP) <use_dp_in_gpumd>`
2122

2223
Syntax
2324
------

doc/installation.rst

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,157 @@ The setup instructions are below:
133133
* Follow the remaining :program:`GPUMD` installation instructions
134134

135135
Following these steps will enable the :ref:`plumed keyword <kw_plumed>`.
136+
137+
.. _use_dp_in_gpumd:
138+
.. index::
139+
single: Deep Potential
140+
141+
GPUMD supports DP potential project
142+
=====================================
143+
144+
0 Program Introduction
145+
----------------------
146+
This is the beginning of GPUMD's support for other machine learning potential functions.
147+
148+
0.1 Necessary instructions
149+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
150+
- This is a test version.
151+
- Only potential function files ending with ``.pb`` in deepmd are supported, that is, the potential function files of the tensorflow version generated using ``dp --tf`` freeze.
152+
153+
0.2 Installation Dependencies
154+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
155+
- You must ensure that the new version of DP is installed and can run normally. This program contains DP-related dependencies.
156+
- The installation environment requirements of GPUMD itself must be met.
157+
158+
1 Installation details
159+
----------------------
160+
Use the instance in AutoDL for testing. If one need testing use AutoDL, please contact Ke Xu ([email protected]).
161+
162+
And we have created an image in `AutoDL <https://www.autodl.com/>`_ that can run GPUMD-DP directly, which can be shared with the account that provides the user ID. Then, you will not require the following process and can be used directly.
163+
164+
2 GPUMD-DP installation (Offline version)
165+
-------------------------------------------
166+
167+
2.0 DP installation (Offline version)
168+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
169+
Use the latest version of DP installation steps::
170+
171+
>> $ # Copy data and unzip files.
172+
>> $ cd /root/autodl-tmp/
173+
>> $ wget https://mirror.nju.edu.cn/github-release/deepmodeling/deepmd-kit/v3.0.0/deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh.0 -O deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh.0
174+
>> $ wget https://mirror.nju.edu.cn/github-release/deepmodeling/deepmd-kit/v3.0.0/deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh.1 -O deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh.1
175+
>> $ cat deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh.0 deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh.1 > deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh
176+
>> $ # rm deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh.0 deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh.1 # Please use with caution "rm"
177+
>> $ sh deepmd-kit-3.0.0-cuda126-Linux-x86_64.sh -p /root/autodl-tmp/deepmd-kit -u # Just keep pressing Enter/yes.
178+
>> $ source /root/autodl-tmp/deepmd-kit/bin/activate /root/autodl-tmp/deepmd-kit
179+
>> $ dp -h
180+
181+
After running according to the above steps, using ``dp -h`` can successfully display no errors.
182+
183+
2.1 GPUMD-DP installation
184+
~~~~~~~~~~~~~~~~~~~~~~~~~
185+
The GitHub link is `Here <https://github.com/Kick-H/GPUMD/tree/7af5267f4d8ba720830c154f11634a1942b66b08>`_.
186+
::
187+
188+
>> $ wget https://codeload.github.com/Kick-H/GPUMD/zip/7af5267f4d8ba720830c154f11634a1942b66b08
189+
>> $ cd ${GPUMD}/src-v0.1
190+
191+
Modify ``makefile`` as follows:
192+
193+
- Line 19 is changed from ``CUDA_ARCH=-arch=sm_60`` to ``CUDA_ARCH=-arch=sm_89`` (for RTX 4090). Modify according to the corresponding graphics card model.
194+
- Line 25 is changed from ``INC = -I./`` to ``INC = -I./ -I/root/miniconda3/deepmd-kit/source/build/path_to_install/include/deepmd``
195+
- Line 27 is changed from ``LIBS = -lcublas -lcusolver`` to ``LIBS = -lcublas -lcusolver -L/root/miniconda3/deepmd-kit/source/build/path_to_install/lib -ldeepmd_cc``
196+
197+
Then run the following installation command::
198+
199+
>> $ sudo echo "export LD_LIBRARY_PATH=/root/miniconda3/deepmd-kit/source/build/path_to_install/lib:$LD_LIBRARY_PATH" >> /root/.bashrc
200+
>> $ source /root/.bashrc
201+
>> $ make gpumd -j
202+
203+
2.2 Running Tests
204+
~~~~~~~~~~~~~~~~~
205+
::
206+
207+
>> $ cd /root/miniconda3/GPUMD-bu0/tests/dp
208+
>> $ ../../src/gpumd
209+
210+
3 GPUMD-DP installation (Online version)
211+
-------------------------------------------
212+
213+
3.0 Introduction
214+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215+
This is to use the online method to install the `GPUMD-DP` version, you need to connect the machine to the Internet and use github and other websites.
216+
217+
3.1 Conda environment
218+
~~~~~~~~~~~~~~~~~~~~~
219+
Create a new conda environment with Python and activate it::
220+
221+
>> $ conda create -n tf-gpu2 python=3.9
222+
>> $ conda install -c conda-forge cudatoolkit=11.8
223+
>> $ pip install --upgrade tensorflow
224+
225+
3.3 download deep-kit and install
226+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
227+
Download DP source code and compile the source files following DP docs. Here are the cmake commands::
228+
229+
>> $ git clone https://github.com/deepmodeling/deepmd-kit.git
230+
>> $ cd deepmd-kit/source
231+
>> $ mkdir build && cd build
232+
>> $ cmake -DENABLE_TENSORFLOW=TRUE -DUSE_CUDA_TOOLKIT=TRUE -DCMAKE_INSTALL_PREFIX=`path_to_install` -DUSE_TF_PYTHON_LIBS=TRUE ../
233+
>> $ make -j && make install
234+
235+
We just need the DP C++ interface, so we don't source all DP environment. The libraries will be installed in ``path_to_install``.
236+
237+
3.4 Configure the makefile of ``GPUMD``
238+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
239+
The GitHub link is `Here <https://github.com/Kick-H/GPUMD/tree/7af5267f4d8ba720830c154f11634a1942b66b08>`_.
240+
::
241+
242+
>> $ wget https://codeload.github.com/Kick-H/GPUMD/zip/7af5267f4d8ba720830c154f11634a1942b66b08
243+
>> $ cd ${GPUMD}/src
244+
>> $ vi makefile
245+
246+
Configure the makefile of GPUMD. The DP code is included by macro definition ``USE_TENSORFLOW``. So add it to ``CFLAGS``:
247+
248+
``CFLAGS = -std=c++14 -O3 $(CUDA_ARCH) -DUSE_TENSORFLOW``
249+
250+
Then link the DP C++ libraries. Add the following two lines to update the include and link paths and compile GPUMD:
251+
252+
``INC += -Ipath_to_install/include/deepmd``
253+
254+
``LDFLAGS += -Lpath_to_install/lib -ldeepmd_cc``
255+
256+
Then, you can install it using the following command::
257+
258+
>> $ make gpumd -j
259+
260+
3.5 Run ``GPUMD``
261+
~~~~~~~~~~~~~~~~~
262+
263+
When running GPUMD, if an error occurs stating that the DP libraries could not be found, add the library path temporarily with::
264+
265+
LD_LIBRARY_PATH=path_to_install/lib:$LD_LIBRARY_PATH
266+
267+
Or add the environment permanently to the ``~/.bashrc``::
268+
269+
>> $ sudo echo "export LD_LIBRARY_PATH=/root/miniconda3/deepmd-kit/source/build/path_to_install/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
270+
>> $ source ~/.bashrc
271+
272+
3.6 Run Test
273+
~~~~~~~~~~~~
274+
275+
This DP interface requires two files: a setting file and a DP potential file. The first file is very simple and is used to inform GPUMD of the atom number and types. For example, the ``dp.txt`` is shown in here for use the ``potential dp.txt DP_POTENTIAL_FILE.pb`` command in the ``run.in`` file::
276+
277+
dp 2 O H
278+
279+
Notice
280+
~~~~~~~
281+
The type list in the setting file and the potential file must be the same.
282+
283+
Example
284+
~~~~~~~
285+
* Some water simulations using the ``DP`` model in ``GPUMD``: https://github.com/brucefan1983/GPUMD/discussions
286+
287+
References
288+
~~~~~~~~~~
289+
* DeePMD-kit: https://github.com/deepmodeling/deepmd-kit

tools/mtp2nep/example/readme.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

tools/mtp2nep/example/train.cfg

Lines changed: 0 additions & 129 deletions
This file was deleted.

0 commit comments

Comments
 (0)