-
Notifications
You must be signed in to change notification settings - Fork 84
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
Training on stresses #102
Comments
Hello Daniel! This is certainly not a trivial task but overall I would say that it is feasible. The expressions for the stress tensor can be found in this publication. An implementation would require two major parts: 1. Prediction As far as I can see it should be straightforward to implement the prediction for an existing NNP. All quantities necessary (forces, distances) are already computed during the force calculation and can afterwards be retrieved to compute also the stress tensor. 2. Training If I didn't miss anything the virial stress expression in the above paper would mean for the training that the derivatives of stress with respect to NN weights are just constructed from the force derivatives, hence this should not be very complicated either. It's good that recently the So yes, I think it can be done and if you have some experience in C/C++ coding it will probably not be very difficult. I will try to be helpful and point you to the corresponding parts in the code. However, I have to mention that the amount of time that I can spend on n2p2 development at this point is rather limited, considering that there are already other PRs in progress (#77, #92). So the major part of coding will have to rest on your shoulders. Still, it would be great if you want to try it.. I would suggest to start a new feature branch and immediately create a "draft" pull request, so we can discuss the further proceeding there. Best, Andreas |
Hi Andreas, Thanks for the response! I'm definitely interested. I may have to drop it if it becomes too difficult as it's not a key priority for my project. For now, let's focus on (1). This will help me get a bit more familiar with the code and make sure I have the notation/units worked out correctly. Let me dig into this a bit more and I'll message you when I'm ready. (I'll need to set up my development environment a bit more). Daniel |
Great, I am looking forward to this! Don't worry.. if you have to drop it I will still be useful as I will most likely continue it at some point.. it's definitely on my list but also not at a high priority. Just to get you started here is some basic thing which should be added: So far the configuration file format does not support stresses to be read in. Similarly, the Lines 75 to 84 in 3f03449
To support reading in the reference stresses I suggest to introduce a new keyword
This can be simply done by adding another else if (splitLine.at(0) == "stress")
{
stressRef[0] = ...
...
} section here: Lines 131 to 243 in 3f03449
Best, Andi |
Hi Andi, Please find a pull request #103. I've added some notes for discussion. By the way I can't seem to build the code on anything other than the main branch. It seems like sed complains about an empty variable. Can you confirm it's possible to build the code outside of master? Best, Daniel |
Hi Daniel, I'm afraid the However, an issue with Best, Andi |
Hi Andi, Actually, I had made a branch from master (perhaps I should change this to the 4G-HDNNP-prediction branch). Turned out it was my branch naming convention that was causing the crash. I've made a PR with a fix #106. I often use forward slashes in my branch name: feat/my_feature, patch/my_patch, ... My PR will still break if someone pushes a branch with a plus sign (+) but I think that should be comparatively rare. The ideal fix would be simply to strip all special symbols first. |
Is your feature request related to a problem? Please describe.
DFT calculations usually include the stress output which can help out in training (if the settings are sufficiently converged). I would really like to use this for my calculations. I'm willing to invest of a bit of time implementing this but want to know if it's feasible.
The text was updated successfully, but these errors were encountered: