openmm / openmm-ml

High level API for using machine learning models in OpenMM simulations
Other
75 stars 25 forks source link

adding the torchani `EnergyShifter` to subtract the self energies of molecules #44

Closed dominicrufa closed 3 months ago

dominicrufa commented 1 year ago

would it be possible to add EnergyShifter to the current torchani workflow in order to remove the self energy of molecules treated with ML? Energies at present are very large/small and there is concern that this could leading to numerical instability with finite precision.

dominicrufa commented 1 year ago

@peastman, it's not obvious to me how to place it in anipotential. the documentation here seems to suggest that the EnergyShifter adds another multiple of the self interaction energy onto the pre-computed energy, unless i am reading it incorrectly.

peastman commented 1 year ago

I think it's already included:

>>> model = torchani.models.ANI1ccx(periodic_table_index=True)
>>> print(model.energy_shifter.self_energies)
tensor([ -0.5992, -38.0375, -54.6745, -75.1604], dtype=torch.float64)