Deep potential plugin for CP2K implemented from C interface#3145
Deep potential plugin for CP2K implemented from C interface#3145oschuett merged 19 commits intocp2k:masterfrom
Conversation
| DEALLOCATE (fist_nonbond_env%deepmd_data%force) | ||
| END IF | ||
| IF (ASSOCIATED(fist_nonbond_env%deepmd_data%use_indices)) THEN | ||
| DEALLOCATE (fist_nonbond_env%deepmd_data%use_indices) |
There was a problem hiding this comment.
I would refactor that into a routine in the DeepMD module
src/manybody_deepmd.F
Outdated
| ALLOCATE (use_atom(n_atoms)) | ||
| ALLOCATE (use_atom_type(n_atoms)) | ||
| use_atom = .FALSE. | ||
| use_atom_type = 100 ! just initial the array |
| SUBROUTINE pair_potential_deepmd_copy(deepmd_source, deepmd_dest) | ||
| TYPE(deepmd_pot_type), POINTER :: deepmd_source, deepmd_dest | ||
|
|
||
| IF (.NOT. ASSOCIATED(deepmd_source)) RETURN |
There was a problem hiding this comment.
I would rather nullify deepmd_dest
|
It's so nice to see DeePMD land after all :-) This PR looks very good to me. My only concern is with the H2O-DPLR-model.pb file because its 10.3 MB. Is there maybe a smaller model we could use for testing? |
I just replaced the model as one of 1.6 MB in AISSquare. It could be a rather small one to reproduce results just similar to calculation result for a W cell as shown in materials project. |
Make code Pretty adapt to libdeepmd_c fix dummy argument of BIND(C) fix some bug in compilation
test: add regtest for DeePMD
fix: fix compiling when no `-D__DEEPMD` style: reformat INSTALL document
test: use W-DP-HYB-model as test case
8d1452d to
bc6def1
Compare
|
Seems like there is a memory leak. Can you fix this in DeepMD? Otherwise you could add a suppression. |
As discussed in deepmodeling/deepmd-kit#3045, there is memory leak in Tensorflow and Protobuf, which could not be so easily fixed, while @njzjz has fixed a possible leak in DeePMD-kit (deepmodeling/deepmd-kit#3062, thanks a lot.) At this moment, I think just adding suppression might be OK while the leak is not so severe that might cause the program crashing. |
|
It is nice to see this interface land! |
|
I'm also very happy to finally merge this. Great work! Btw, we now have a section on machine learning in our manual ;-) |
|
Thanks, @Cloudac7. DeePMD-kit also has a documentation page for all external interfaces. |
Enhanced based on #1620
For the implementation is fully changed, I think it would be better to just open a new PR instead of former old one.
As mentioned in #1620 , it was not a good practice to introduce C++ flags in CP2K, while at that time DeePMD-kit does not supply C interface. But now everything has changed. Since v2.2.x, DeePMD-kit C Interface is directly released together with each DeePMD-kit release, making it no need to install
libtensorflow_ccany more. In this way, C wrapper has been rewritten and now only necessary parameters are added to arch file.We also support download from toolchain. To enable the DeePMD-kit feature,
--with-deepmdflag in toolchain should not be set to no. The following ways installing has been added.--deepmd-modetogpuif GPU support is needed, and load CUDA environment before installing.--with-deepmd=/path/to/libdeepmd_c.install. For now, DeePMD-kit v2.2.7 will be installed.