Skip to content
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.

Can MEGNet be made end-to-end differentiable wrt atomic positions of atoms? #301

Open
CompRhys opened this issue Nov 7, 2021 · 8 comments

Comments

@CompRhys
Copy link

CompRhys commented Nov 7, 2021

How hard would it be to change the construction of the local environment graph to be end-to-end differentiable? This would involve the neighbour list function inside pymatgen being refactored to include a sub-function that returns the index and image index allowing the distances to be computed from TF tensors of the atom positions?

Thinking about BOWSR there would be some benefit to regularising the force predictions of the MEGNet surrogate model to be ~0 given that it is trained on the relaxed structures in MP. As far as I understand the model is not currently given any signal about these structures being local minima.

@CompRhys
Copy link
Author

CompRhys commented Nov 7, 2021

link to #170

@chc273
Copy link
Contributor

chc273 commented Nov 7, 2021

@CompRhys For the pymatgen part, i have done the function you described. Try get_neighbor_list method of Structure.

End-to-end is definitely doable by starting from atom positions.

@chc273
Copy link
Contributor

chc273 commented Nov 7, 2021

For the idea on BOWS, what you described is correct. I think this is definitely worth trying by including the force regularization. Please keep me posted, thanks!

@CompRhys
Copy link
Author

CompRhys commented Nov 7, 2021

Am mostly a pytorch user but if the function is already implemented I will have a look at whether it's easy to make the change here after I submit my thesis in a few weeks. Conceivably the change should be hot swappable provided there are no issues arising out of differences in precision between numpy arrays and TF tensors.

@CompRhys
Copy link
Author

CompRhys commented Mar 7, 2022

@chc273 did you implement this in order to run the phonon calcs with m3gnet?

@chc273
Copy link
Contributor

chc273 commented Mar 7, 2022

@CompRhys Do you mean energy derivative to calculate the forces? Yes. m3gnet will be a new codebase though

@CompRhys
Copy link
Author

Yep, will await new codebase and see if it can be back ported. Is new code also TF based?

@chc273
Copy link
Contributor

chc273 commented Mar 11, 2022

@CompRhys thanks. Yes, the code is in TF.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants