uf3 / uf3

UF3: a python library for generating ultra-fast interatomic potentials
Apache License 2.0
60 stars 21 forks source link

Partial 3-body terms #119

Open tawe141 opened 3 months ago

tawe141 commented 3 months ago

Hi,

Is there any interest in implementing a UF3 model with only some 3-body terms? I have a (rather hacky) way of training this potential by directly modifying ChemicalSystem.interaction_map[3], and this does seem to train and I can do predictions with it. From the LAMMPS implementation, it doesn't seem like there's any change needed, as the user just needs to specify what 3-body coeffs are needed. I think the only thing that needs to change is making sure that loading models from configs takes into account cases where not all 3-body terms are present. Thoughts?

monk-04 commented 3 months ago

@tawe141 Can you please elaborate more using an Example?

Consider a system with A, B elements-

The 3-body terms are- A-A-A, A-A-B, A-B-B, B-A-A, B-A-B, B-B-B

Are you suggesting, for example, not training for B-A-B and B-A-A terms?

tawe141 commented 3 months ago

Yes that's what I meant!

monk-04 commented 3 months ago

I will prescribe caution when excluding certain three-body terms during training. At the very least, in cases where certain three-body terms are not trained, the corresponding 2-body should be strong enough to avoid atom overlap in the MD simulations.

May I ask what kind of system/material you are interested in?

As for implementing the feature you requested, it depends on how many users would desire such a feature.

tawe141 commented 3 months ago

Thanks for the heads up. Is there a way to train UF3 with ZBL or similar?

I'm working on surface adsorption systems. As for implementing it, I can submit a PR, but I'd like to see how large of a performance effect it has first to evaluate the impact.

monk-04 commented 3 months ago

By ZBL I am assuming you mean the Ziegler-Biersack-Littmark (ZBL) screened nuclear repulsion potential. There's no direct way to train UF3 with ZBL.

However, one can probably hand-tune the 2-body potentials, i.e., coefficients corresponding to small distances, to capture a similar effect.

The bspline basis functions of UF3 provide local support, which makes the above possible.

Let's consider the W example in the examples directory- https://github.com/uf3/uf3/blob/develop/examples/tungsten_extxyz/uf23_potential_demo.ipynb

From the pair distribution plot in that notebook, there are no distance data points between 0 and 2 Å. So, the 2-body coefficients that act on the bspline that are active over this domain can be adjusted to some extent.

This adjustment won't affect the model accuracy/error for distances, let's say, at 5 Å.

However, care should be taken while hand-tuning the coefficients as the bspline active at 1.8 Å might also be active at 2.05 Å where there are distance data points.

Please take the above suggestion/comment with a grain of salt, as I am not that familiar with the ZBL potential.

Also pair_style hybrid might be useful for your application if you have a ZBL potential that acts at very small distances, let's say 0-1 Å in combination with a UF3 potential. Caution!!- this will probably introduce a discontunity in the potential energy landscape.

sunghjung3 commented 3 months ago

@tawe141 In one of the branches in my personal fork of UF3, I included a feature to train UF3 with ZBL, but the model actually does slightly worse than using only UF3.

My theory is that when the ZBL energies and forces are subtracted from the DFT energies and forces, artificial wiggles are introduced, which requires a larger number of B-spline basis functions to fit. Thus, keeping the number of basis functions the same, ZBL actually worsens the model performance.

monk-04 commented 3 months ago

@tawe141 I suggest we open a new 'discussion' (https://github.com/uf3/uf3/discussions), as I believe your original issue has been resolved.