Comments (9)
There is no way to convert a graph to structure. Getting a structure to graph is easy. But going backwards is non-trivial. Otherwise, "inverse design" would actually be simple.
What I would suggest you do is to link a structure to a graph and when you need to link the prediction from the graph to the structure, you use that information.
from matgl.
Hi, thank you for your quick reply!
I'm not sure if I understood you correctly, but my problem isn't coming from matching a prediction to a graph. I would like to use the gradient from the model (which is with respect to the graph) to inform a change in the structure itself. Is that possible?
from matgl.
Perhaps the title of my issue is misleading, let me elaborate on the problem briefly.
Currently the process to make the prediction is:
- Pass structure in
- Convert structure to graph
- Make a prediction on the graph
What I would like to do is after step 3:
4. Extract gradient from model,
5. Convert gradient from the embedding representation into the gradient on each atom position.
I think this is similar to what is done to extract the forces when computing energy, except I would like to do it when making a prediction using "MEGNet-MP-2019.4.1-BandGap-mfi".
from matgl.
That's the same thing. In the PES models, both energy and forces (the gradient of the energies) are explicitly handled as part of the prediction. So you do have the actual structure gradient in this case.
But for property prediction models, you are predicting the band gap. You have the gradient of the band gap wrt to the graph. While you can "move" the graph in the direction of the gradient, that is no easy way to translate the modified graph back to a structure.
Note that the gradient of band gap wrt to graph is not a force per se. It is not like the PES model where the gradient is an actual force on each atom that you can use to move the atoms using a Verlet algorithm.
from matgl.
Based on your first point, if the procedure is the same could I modify the property prediction to return the gradient with respect to the structure as well? If I cannot, is the reason that the atomic positions aren't an explicit input into the property prediction model and therefore I cannot access this?
Regarding your second point, am I correct in saying that although I do have access to the gradient of the band gap with respect to the graph, there is no easy way to convert this into a gradient as a gradient with respect to the structure (as a mathematical computation rather than a physical representation of a force)?
from matgl.
Hi @mwolinska. Thank you for your questions. @shyuep is right that we only return the gradient of bandgap with respect to graph attributes include nodes, edges and states for property models. If you really want to get the gradient of bandgap with respect to atomic positions. I would suggest you explicitly calculating the gradient of bond expansion (edge attributes) with respect to atomic position and then perform matrix multiplication with the gradient of band gap with respect to bond expansion (edge attributes).
from matgl.
Hi @kenko911, thank you for your suggestion! Do you think computing the gradient of bond expansion with respect to atomic position from your implementation would be fairly straightforward?
from matgl.
Based on the script you provided, I am confident that you can figure it out by your own ;). I will close this issue if no further question. Thanks.
from matgl.
Thank you!
from matgl.
Related Issues (20)
- what are the outputted units for stress? HOT 2
- Does the example training script work for multi-gpu training? HOT 1
- [Bug]: RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! HOT 5
- TensorNet HOT 1
- [Bug]: `RuntimeError: expected scalar type Float but found Double` HOT 1
- [Bug]: Cannot load from checkpoint HOT 2
- [Bug]: pymatgen CI broken due to transitive `pydantic` dependency via `matgl->dgl->pydantic`.
- [Bug]: Incompataibility with `dgl==2.1.0` and `torch==2.2.2` HOT 11
- [Bug]: Getting ValueError due to run "Training a M3GNet Formation Energy Model with PyTorch Lightning.ipynb" without any change in code. HOT 2
- [Bug]: AttributeError: 'M3GNet' object has no attribute 'calc_stresses' HOT 1
- [Feature Request]: change the home page info in your page
- [Bug]: ValueError: Bad serialized model or bad model name. It is possible that you have an older model cached. Please clear your cache by running `python -c "import matgl; matgl.clear_cache()"` HOT 2
- [Question] M3GNet finetuning and MD HOT 2
- [Bug]: GPU utilization low and multi-core CPU utilization only around 100% during training HOT 1
- [Bug]: pypi/release version not consistent with git repo for models HOT 2
- [Bug]: RMSE and MAE are the same in the outputted test metric HOT 3
- UserWarrning in `_basis.py` HOT 1
- [Bug]: Finetuned model is worse than pretrained model HOT 18
- [Feature Request]: Update `pytorch_lightning` to `lightning` HOT 1
- FYI: There are no 1.1.2 PyPI wheels HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from matgl.