-
Notifications
You must be signed in to change notification settings - Fork 25
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
Stress Calculation in ForceRegressionTask
#302
Conversation
I personally prefer |
volume = torch.linalg.det(cell).abs().unsqueeze(-1) | ||
stress = virials / volume.view(-1, 1, 1) | ||
stress = torch.where( | ||
torch.abs(stress) < 1e10, stress, torch.zeros_like(stress) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this hard coded value?
For something like this, I don't actually know if it's actually more performant to just clip values, instead of using torch.where
where you have to allocate a zeros_like
tensor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is an inspired bit from here. im assuming it is helpful in tasks which compute losses from stress. happy to remove the line and reconsider adding it back if/when we do stress related training.
For now this is fine, but I have to say that |
I agree, it could use some organizing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, merge when ready
This PR adds the ability to perform stress calculations inside the
ForceRegressionTask
, and is inspired by the implementation here: https://github.com/ACEsuit/mace/blob/main/mace/modules/utils.py. This functionality if usefull in downstream tasks that require this parameter, and will be helpful for future MatSciML tasks such as aStressRegressionTask
or similar.