Bug summary
In deepmd v3, the inference results from the DPLR model are incorrect when using the Python interface. In deepmd-v3, the long-range correction (i.e., the data modifier) is not calculated and added to the final results. It should be relevant to the change in architecture in the inference module.
DeePMD-kit Version
DeePMD-kit v3.0.1
Backend and its version
TensorFlow v2.18.0-rc2-4-g6550e4bd802
How did you download the software?
pip
Input Files, Running Commands, Error Log, etc.
Test python script for v2:
from ase import build
import numpy as np
from deepmd.infer import DeepPot
dp = DeepPot("graph.pb")
dm = dp.dm
type_map = ["O", "H"]
atoms = build.molecule("H2O")
atoms.set_cell([10, 10, 10])
atoms.center()
atype = np.array([type_map.index(a) for a in atoms.symbols])
out = dp.eval(
atoms.get_positions().reshape(1, -1),
atoms.get_cell().reshape(1, -1),
atype,
)
print(out[0])
out_dm = dm.eval(
atoms.get_positions().reshape(1, -1),
atoms.get_cell().reshape(1, -1),
atype,
)
print(out_dm[0])
Output:
[[-494.9365821]]
[46.573121]
Test python script for v3:
from ase import build
import numpy as np
from deepmd.tf.infer.data_modifier import DipoleChargeModifier
from deepmd.infer import DeepPot
dp = DeepPot("graph.pb")
dm = DipoleChargeModifier(
"dw_model.pb",
model_charge_map=[-8],
sys_charge_map=[6, 1],
ewald_h=0.5,
ewald_beta=0.4,
)
type_map = ["O", "H"]
atoms = build.molecule("H2O")
atoms.set_cell([10, 10, 10])
atoms.center()
atype = np.array([type_map.index(a) for a in atoms.symbols])
out = dp.eval(
atoms.get_positions().reshape(1, -1),
atoms.get_cell().reshape(1, -1),
atype,
)
print(out[0])
out_dm = dm.eval(
atoms.get_positions().reshape(1, -1),
atoms.get_cell().reshape(1, -1),
atype,
)
print(out_dm[0])
Output:
[[-541.5097031]]
[46.573121]
In both cases, the energies from data modifier are identical. However, the total energy in v3 = the total energy in v2 + the energy of data modifier.
Steps to Reproduce
Please download the attached models and run the scripts above with deepmd v2/v3.
Further Information, Files, and Links
H2O_dplr_model.zip
Bug summary
In deepmd v3, the inference results from the DPLR model are incorrect when using the Python interface. In deepmd-v3, the long-range correction (i.e., the data modifier) is not calculated and added to the final results. It should be relevant to the change in architecture in the inference module.
DeePMD-kit Version
DeePMD-kit v3.0.1
Backend and its version
TensorFlow v2.18.0-rc2-4-g6550e4bd802
How did you download the software?
pip
Input Files, Running Commands, Error Log, etc.
Test python script for v2:
Output:
Test python script for v3:
Output:
In both cases, the energies from data modifier are identical. However, the total energy in v3 = the total energy in v2 + the energy of data modifier.
Steps to Reproduce
Please download the attached models and run the scripts above with deepmd v2/v3.
Further Information, Files, and Links
H2O_dplr_model.zip