njzjz / deepmd-gnn

DeePMD-kit plugin for various graph neural network models
GNU Lesser General Public License v3.0
21 stars 3 forks source link

LAMMPS compatibility #13

Closed mutingx closed 1 month ago

mutingx commented 2 months ago

I'm trying to run LAMMPS with models trained by deepmd-mace. The deepmd-mace was installed following the README.md and it did work. But when running lmp -i in.lmp, it failed with the following message:

 DeePMD-kit C API Error: DeePMD-kit Error: incompatable model: version 0.0 in graph, but version 1.1
 Last command: pair_style   deepmd frozen_model.pth

Should I recompile the dp part or the lmp part? How to recompile LAMMPS with the new "libdeepmd_mace.so"? Best wishes.

njzjz commented 2 months ago

incompatable model: version 0.0 in graph, but version 1.1

This error is from the TensorFlow backend. Did you use an old version?

mutingx commented 2 months ago

I thought I've used the PyTorch backend. The model was trained with dp --pt train and was frozen with dp --pt freeze. The warning messages during training and freezing are as follow: The TorchScript type system doesn't support instance-level annotations on empty non-base types ininit. Instead, either 1) use a type annotation in the class body, or 2) wrap the type intorch.jit.Attribute` The versions are:DeePMD version: 3.0.0b3,tensorflow: 2.16.1andtorch: 2.4.0+cu124`

Before testing deepmd-mace, I trained a deepmd-kit model with dp train with the same environment. That model can be used by lmp.

njzjz commented 2 months ago

Please check whether you use the latest code on the devel branch to compile the C++ interface. The plugin support (https://github.com/deepmodeling/deepmd-kit/pull/4073) has not been released to any release version.

mutingx commented 2 months ago

I used the released version. Thanks for your help! That's quite helpful and I will try the latest codes

njzjz commented 1 month ago

v3.0.0b4 has been released, so it should not be a problem anymore.