-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow structures without three-body interaction in cutoff radius -- isolated atoms or two-body regions #85
Conversation
I am trying to figure out the code, but in general, I am not in favor of solutions that depend on the ext packages treating isolated atoms as special cases. Isolated atom support should be part and parcel of the model and layers. In other words, given a graph of isolated atoms, the model and layers should yield a result. |
Thanks for the comments. I agree with it. I think there is overlapping in the ase.py and pymatgen.py ext package scripts about processing the structures or atoms into graph. Shall we unify that part into a function file in utils? Or do you have any suggestions where this piece of code should go? @shyuep |
@JiQi535 Thanks a lot for your contributions! I just have a look on the changes and I think the solution is not ideal.
|
I created minimum possible number of artificial edges longer than cutoff so that node feature about atom type can be stored. Passing an empty graph seems not able to distinguish different isolated atoms. These artificial edges have bond length over cutoff radius, so that their respective rbf values equals to zero (the same as the rbf right at cutoff radius). Therefore, these edges do pass through convolutions, but the results won't be affected by these artificial bonds (edges), as they are treated same as bond equal to cutoff radius. @kenko911
The compute_3body is slightly modified to make sure that sbf equals to 0 for bonds over cutoff radius, whereas it was previously only equal to 0 when bond is equal to cutoff radius. I think this change is physical. |
|
From my tests, the energy increases smoothly when bond distances increase until bond distances equal to cutoff radius, after which the energy remains constant and equals to energy when bond lengths equal to 5 angstrom. As the energy of structure without isolated atoms is not changed after my changes, and isolated atoms have energy same as the energy when bond lengths equal to 5 angstrom, I don't think the energy of isolated atom is wrong. Could you show me an example that isolated atom has wrong energy? |
@shyuep In the latest commit, I have moved the overlapped codes of graph construction in ext packages related .py files to matgl/graph/converters.py. Please have a look. Again, I believe that the current implementation handles the special cases, i.e., (1) isolated atoms and (2) regions with only two-body interactions correctly without the extra effort to batch extra graph with three-body interactions (what the TF version needs). I have sent my test structures to @kenko911, and I'm looking forward to any new discussions or suggestions. |
Signed-off-by: JiQi535 <[email protected]>
@JiQi535 Could you please also test the training with isolated atoms and two-bodys? Thanks! |
Signed-off-by: JiQi535 <[email protected]>
The previous code is not working for structures containing isolated atoms or only two-body interactions in certain 5 Å spherical regions.
This PR solve this problem without much impact on computation speed. It has been tested to work on a few cases:
Some re-formattings are not related to "allow structures without three-body interaction in cutoff radius", as they were done by Black.
Finally, thanks @kenko911 for providing suggestions and helpful discussions, though the changes I have done are not the same with yours. Please kindly have a look and point out if there is unseen problem in this way of solving the issue. Thanks and looking forward to discussing with you.