deepmodeling / DMFF

DMFF (Differentiable Molecular Force Field) is a Jax-based python package that provides a full differentiable implementation of molecular force field models.
GNU Lesser General Public License v3.0
143 stars 41 forks source link

[BUG] LJ switch function #183

Open marvcks opened 1 month ago

marvcks commented 1 month ago

Bug summary

I think the use of switch function is wrong in DMFF. https://github.com/deepmodeling/DMFF/blob/dcc9fa5a4516c06b2fd3383372a68bd68b70ffb0/dmff/classical/inter.py#L49C1-L54C21 It should be:

if self.isSwitch:
      x = (dr_norm - self.r_switch) / (self.r_cut - self.r_switch)
      S = 1 - 6. * x ** 5 + 15. * x ** 4 - 10. * x ** 3
      E = jnp.where(dr_norm > self.r_switch, E * S, E)
      E = jnp.where(dr_norm >= self.r_cut, 0., E)

DMFF Version

v1.0.0

JAX Version

0.4.20

OpenMM Version

8.1.1

How did you download the software?

Built from source

Input Files, Running Commands, Error Log, etc.

Value Error.

Steps to Reproduce

No need to reproduce.

Further Information, Files, and Links

No response