atomistic-machine-learning / schnetpack

SchNetPack - Deep Neural Networks for Atomistic Systems
Other
791 stars 215 forks source link

question about the stress calculation #548

Closed XinjianOUYANG closed 1 year ago

XinjianOUYANG commented 1 year ago

Hi! I have a question about how you calculate the predicted stress using the energy derivative. Do you using the energy derivative with resepct to the relative distance between atoms to calculate the stress?

Cound you explain the formula for the stress calculaton?

Thanks a lot Xinjian OUYANG

stefaanhessmann commented 1 year ago

Hi @XinjianOUYANG,

we compute the stress as a derivative of the energy with respect to the strain. Have a look at equation 9 of this document. Since we can not directly access the strain tensor, add a virtual torch.zeros tensor to the positions and cell parameters. This allows to compute the derivative of the energy with respect to the strain tensor. You can have a look at schnatpack.atomistic.response.Strain for the code details.

I hope this helps to answer you question.

Best Stefaan

XinjianOUYANG commented 1 year ago

Thank for the explanation. It clearly answers my question.

Thank you very much and I appreciate your help!